Lines 1496-1501
Link Here
|
1496 |
|
1496 |
|
1497 |
return OK; |
1497 |
return OK; |
1498 |
} |
1498 |
} |
|
|
1499 |
static void log_configtest(apr_pool_t *p, server_rec *s) |
1500 |
{ |
1501 |
/* Iterate through all the virtual hosts |
1502 |
*/ |
1503 |
apr_status_t rc; |
1504 |
char *fname; |
1505 |
char *config_fname; |
1506 |
apr_file_t *logfile; |
1507 |
while (s) { |
1508 |
/* We check if we can at least open the error file. |
1509 |
*/ |
1510 |
if (s->defn_name) { |
1511 |
config_fname = s->defn_name; |
1512 |
} else { |
1513 |
config_fname = "main config file"; |
1514 |
} |
1515 |
if (s->error_fname) { |
1516 |
fname = ap_server_root_relative(p, s->error_fname); |
1517 |
logfile = NULL; |
1518 |
if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, |
1519 |
APR_OS_DEFAULT, p)) != APR_SUCCESS) { |
1520 |
ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, |
1521 |
"Could not open error log file %s for server defined in %s.",fname,config_fname); |
1522 |
} else { |
1523 |
apr_file_close(logfile); |
1524 |
} |
1525 |
} |
1526 |
/* We check if we can open the other files |
1527 |
*/ |
1528 |
multi_log_state *mls = ap_get_module_config(s->module_config, &log_config_module); |
1529 |
config_log_state *clsarray; |
1530 |
int i; |
1531 |
|
1532 |
/* |
1533 |
* Log this transaction.. |
1534 |
*/ |
1535 |
if (mls->config_logs->nelts) { |
1536 |
clsarray = (config_log_state *) mls->config_logs->elts; |
1537 |
for (i = 0; i < mls->config_logs->nelts; ++i) { |
1538 |
config_log_state *cls = &clsarray[i]; |
1539 |
fname = ap_server_root_relative(p, cls->fname); |
1540 |
logfile = NULL; |
1541 |
if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, |
1542 |
APR_OS_DEFAULT, p)) != APR_SUCCESS) { |
1543 |
ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, |
1544 |
"Could not open log file %s for server defined in %s.",fname,config_fname); |
1545 |
} else { |
1546 |
apr_file_close(logfile); |
1547 |
} |
1548 |
} |
1549 |
} |
1550 |
else if (mls->server_config_logs) { |
1551 |
clsarray = (config_log_state *) mls->server_config_logs->elts; |
1552 |
for (i = 0; i < mls->server_config_logs->nelts; ++i) { |
1553 |
config_log_state *cls = &clsarray[i]; |
1554 |
fname = ap_server_root_relative(p, cls->fname); |
1555 |
logfile = NULL; |
1556 |
if ((rc = apr_file_open(&logfile, fname, APR_APPEND | APR_WRITE | APR_CREATE | APR_LARGEFILE, |
1557 |
APR_OS_DEFAULT, p)) != APR_SUCCESS) { |
1558 |
ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, |
1559 |
"Could not open log file %s for server defined in %s.",fname,config_fname); |
1560 |
} else { |
1561 |
apr_file_close(logfile); |
1562 |
} |
1563 |
} |
1564 |
} |
1565 |
s = s->next; |
1566 |
} |
1567 |
} |
1499 |
|
1568 |
|
1500 |
static void register_hooks(apr_pool_t *p) |
1569 |
static void register_hooks(apr_pool_t *p) |
1501 |
{ |
1570 |
{ |
Lines 1503-1508
Link Here
|
1503 |
ap_hook_child_init(init_child,NULL,NULL,APR_HOOK_MIDDLE); |
1572 |
ap_hook_child_init(init_child,NULL,NULL,APR_HOOK_MIDDLE); |
1504 |
ap_hook_open_logs(init_config_log,NULL,NULL,APR_HOOK_MIDDLE); |
1573 |
ap_hook_open_logs(init_config_log,NULL,NULL,APR_HOOK_MIDDLE); |
1505 |
ap_hook_log_transaction(multi_log_transaction,NULL,NULL,APR_HOOK_MIDDLE); |
1574 |
ap_hook_log_transaction(multi_log_transaction,NULL,NULL,APR_HOOK_MIDDLE); |
|
|
1575 |
ap_hook_test_config(log_configtest,NULL,NULL,APR_HOOK_MIDDLE); |
1506 |
|
1576 |
|
1507 |
/* Init log_hash before we register the optional function. It is |
1577 |
/* Init log_hash before we register the optional function. It is |
1508 |
* possible for the optional function, ap_register_log_handler, |
1578 |
* possible for the optional function, ap_register_log_handler, |