--- modules/loggers/mod_log_config.c.logconfigtest 2006-07-11 22:38:44.000000000 -0500 +++ modules/loggers/mod_log_config.c 2009-02-19 07:35:18.000000000 -0600 @@ -1496,6 +1496,59 @@ return OK; } +static void log_configtest(apr_pool_t *p, server_rec *s) +{ + apr_status_t rc; + /* We check if we can at least open the error file. + */ + if ((rc = apr_file_open(&s->error_log, s->error_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.",s->error_fname); + } else { + apr_file_close(s->error_log); + } + /* 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]; + const char *fname = cls->fname; + apr_file_t *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.",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]; + const char *fname = cls->fname; + apr_file_t *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.",fname); + } else { + apr_file_close(logfile); + } + } + } + +} static void register_hooks(apr_pool_t *p) { @@ -1503,6 +1556,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,