ASF Bugzilla – Attachment 23282 Details for
Bug 43502
Verify that log directories exist in httpd -t config test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Checks error logs and custom logs with relative paths for the main host and virtual hosts, ignoring pipes
httpd-2.2.8-logconfigtest.patch (text/plain), 3.69 KB, created by
David Fraser
on 2009-02-19 12:48:07 UTC
(
hide
)
Description:
Checks error logs and custom logs with relative paths for the main host and virtual hosts, ignoring pipes
Filename:
MIME Type:
Creator:
David Fraser
Created:
2009-02-19 12:48:07 UTC
Size:
3.69 KB
patch
obsolete
>--- modules/loggers/mod_log_config.c.logconfigtest 2006-07-11 22:38:44.000000000 -0500 >+++ modules/loggers/mod_log_config.c 2009-02-19 12:07:57.000000000 -0600 >@@ -1496,6 +1496,77 @@ > > return OK; > } >+static void log_configtest(apr_pool_t *p, server_rec *s) >+{ >+ /* Iterate through all the virtual hosts >+ */ >+ apr_status_t rc; >+ const char *fname; >+ const char *config_fname; >+ apr_file_t *logfile; >+ while (s) { >+ /* We check if we can at least open the error file. >+ */ >+ if (s->defn_name) { >+ config_fname = s->defn_name; >+ } else { >+ config_fname = "main config file"; >+ } >+ if (s->error_fname) { >+ fname = ap_server_root_relative(p, s->error_fname); >+ logfile = NULL; >+ if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, >+ APR_OS_DEFAULT, p)) != APR_SUCCESS) { >+ ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, >+ "Could not open error log file %s for server defined in %s.",fname,config_fname); >+ } else { >+ apr_file_close(logfile); >+ } >+ } >+ /* We check if we can open the other files >+ */ >+ multi_log_state *mls = ap_get_module_config(s->module_config, &log_config_module); >+ config_log_state *clsarray; >+ int i; >+ >+ /* >+ * Log this transaction.. >+ */ >+ if (mls->config_logs->nelts) { >+ clsarray = (config_log_state *) mls->config_logs->elts; >+ for (i = 0; i < mls->config_logs->nelts; ++i) { >+ config_log_state *cls = &clsarray[i]; >+ if (*(cls->fname) == '|') continue; /* don't handle piped logs */ >+ fname = ap_server_root_relative(p, cls->fname); >+ logfile = NULL; >+ if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, >+ APR_OS_DEFAULT, p)) != APR_SUCCESS) { >+ ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, >+ "Could not open log file %s for server defined in %s.",fname,config_fname); >+ } else { >+ apr_file_close(logfile); >+ } >+ } >+ } >+ else if (mls->server_config_logs) { >+ clsarray = (config_log_state *) mls->server_config_logs->elts; >+ for (i = 0; i < mls->server_config_logs->nelts; ++i) { >+ config_log_state *cls = &clsarray[i]; >+ if (*(cls->fname) == '|') continue; /* don't handle piped logs */ >+ fname = ap_server_root_relative(p, cls->fname); >+ logfile = NULL; >+ if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, >+ APR_OS_DEFAULT, p)) != APR_SUCCESS) { >+ ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, >+ "Could not open log file %s for server defined in %s.",fname,config_fname); >+ } else { >+ apr_file_close(logfile); >+ } >+ } >+ } >+ s = s->next; >+ } >+} > > static void register_hooks(apr_pool_t *p) > { >@@ -1503,6 +1574,7 @@ > ap_hook_child_init(init_child,NULL,NULL,APR_HOOK_MIDDLE); > ap_hook_open_logs(init_config_log,NULL,NULL,APR_HOOK_MIDDLE); > ap_hook_log_transaction(multi_log_transaction,NULL,NULL,APR_HOOK_MIDDLE); >+ ap_hook_test_config(log_configtest,NULL,NULL,APR_HOOK_MIDDLE); > > /* Init log_hash before we register the optional function. It is > * possible for the optional function, ap_register_log_handler,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43502
:
22281
|
23280
|
23281
| 23282