#include "apr_thread_proc.h"Go to the source code of this file.
Classes | |
| struct | piped_log |
| The piped logging structure. More... | |
| #define | APLOG_EMERG 0 |
| #define | APLOG_ALERT 1 |
| #define | APLOG_CRIT 2 |
| #define | APLOG_ERR 3 |
| #define | APLOG_WARNING 4 |
| #define | APLOG_NOTICE 5 |
| #define | APLOG_INFO 6 |
| #define | APLOG_DEBUG 7 |
| #define | APLOG_LEVELMASK 7 |
| #define | APLOG_NOERRNO (APLOG_LEVELMASK + 1) |
| #define | APLOG_TOCLIENT ((APLOG_LEVELMASK + 1) * 2) |
| #define | APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4) |
| #define | DEFAULT_LOGLEVEL APLOG_WARNING |
| #define | APLOG_MARK __FILE__,__LINE__ |
| #define | ap_piped_log_read_fd(pl) ((pl)->fds[0]) |
| #define | ap_piped_log_write_fd(pl) ((pl)->fds[1]) |
| typedef piped_log | piped_log |
| AP_DECLARE (void) ap_open_stderr_log(apr_pool_t *p) | |
| int | ap_open_logs (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s_main) |
| int int apr_status_t const server_rec const char | __attribute__ ((format(printf, 6, 7))) |
| int AP_DECLARE_DATA | ap_default_loglevel |
| const char * | file |
| int | line |
| int int | level |
| int int apr_status_t | status |
| int int apr_status_t const server_rec * | s |
| int int apr_status_t const server_rec const char * | fmt |
| int int apr_status_t apr_pool_t * | p |
| int int apr_status_t const request_rec * | r |
| int int apr_status_t const conn_rec * | c |
| const char * | fname |
| const char * | filename |
| const char pid_t * | mypid |
| const char * | program |
|
|
A macro to access the read side of the piped log pipe
Definition at line 314 of file http_log.h. Referenced by AP_DECLARE(). |
|
|
A macro to access the write side of the piped log pipe
Definition at line 321 of file http_log.h. Referenced by AP_DECLARE(), ap_default_log_writer_init(), open_log(), open_rewritelog(), and piped_log_cleanup(). |
|
|
Definition at line 56 of file http_log.h. Referenced by AP_DECLARE(), ap_get_local_host(), ap_mpm_run(), child_main(), create_listener_thread(), main(), master_main(), perform_idle_server_maintenance(), prefork_open_logs(), set_group_privs(), set_loglevel(), setup_listeners(), start_threads(), unique_id_global_init(), and worker_open_logs(). |
|
|
|
|
Definition at line 55 of file http_log.h. Referenced by accept_mutex_off(), accept_mutex_on(), AP_DECLARE(), ap_mpm_run(), beos_accept(), child_main(), listener_thread(), main(), perform_idle_server_maintenance(), set_loglevel(), worker_main(), and worker_thread(). |
|
|
|
|
Definition at line 64 of file http_log.h. Referenced by log_error_core(). |
|
|
|
Definition at line 71 of file http_log.h. |
|
|
Definition at line 60 of file http_log.h. Referenced by ap_mpm_run(), initialize_secret(), log_error_core(), main(), master_main(), mem_cache_post_config(), set_error_document(), set_loglevel(), suexec_post_config(), util_ldap_set_connection_timeout(), and worker_main(). |
|
|
|
Definition at line 85 of file http_log.h. Referenced by AP_DECLARE(), and run_cgi_child(). |
|
|
|
Definition at line 91 of file http_log.h. Referenced by init_server_config(). |
|
|
Definition at line 272 of file http_log.h. |
|
|
|
|
||||||||||||||||||||
|
Open the error log and replace stderr with it.
Definition at line 386 of file log.c. References APLOG_CRIT, APLOG_MARK, apr_pool_create, APR_SUCCESS, clear_handle_list(), DONE, server_rec::error_fname, server_rec::error_log, server_rec::next, NULL, OK, and open_error_log(). Referenced by register_hooks(). 00388 { 00389 apr_pool_t *stderr_p; 00390 server_rec *virt, *q; 00391 int replace_stderr; 00392 00393 00394 /* Register to throw away the read_handles list when we 00395 * cleanup plog. Upon fork() for the apache children, 00396 * this read_handles list is closed so only the parent 00397 * can relaunch a lost log child. These read handles 00398 * are always closed on exec. 00399 * We won't care what happens to our stderr log child 00400 * between log phases, so we don't mind losing stderr's 00401 * read_handle a little bit early. 00402 */ 00403 apr_pool_cleanup_register(p, NULL, clear_handle_list, 00404 apr_pool_cleanup_null); 00405 00406 /* HERE we need a stdout log that outlives plog. 00407 * We *presume* the parent of plog is a process 00408 * or global pool which spans server restarts. 00409 * Create our stderr_pool as a child of the plog's 00410 * parent pool. 00411 */ 00412 apr_pool_create(&stderr_p, apr_pool_parent_get(p)); 00413 apr_pool_tag(stderr_p, "stderr_pool"); 00414 00415 if (open_error_log(s_main, 1, stderr_p) != OK) { 00416 return DONE; 00417 } 00418 00419 replace_stderr = 1; 00420 if (s_main->error_log) { 00421 apr_status_t rv; 00422 00423 /* Replace existing stderr with new log. */ 00424 apr_file_flush(s_main->error_log); 00425 rv = apr_file_dup2(stderr_log, s_main->error_log, stderr_p); 00426 if (rv != APR_SUCCESS) { 00427 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s_main, 00428 "unable to replace stderr with error_log"); 00429 } 00430 else { 00431 /* We are done with stderr_pool, close it, killing 00432 * the previous generation's stderr logger 00433 */ 00434 if (stderr_pool) 00435 apr_pool_destroy(stderr_pool); 00436 stderr_pool = stderr_p; 00437 replace_stderr = 0; 00438 /* 00439 * Now that we have dup'ed s_main->error_log to stderr_log 00440 * close it and set s_main->error_log to stderr_log. This avoids 00441 * this fd being inherited by the next piped logger who would 00442 * keep open the writing end of the pipe that this one uses 00443 * as stdin. This in turn would prevent the piped logger from 00444 * exiting. 00445 */ 00446 apr_file_close(s_main->error_log); 00447 s_main->error_log = stderr_log; 00448 } 00449 } 00450 /* note that stderr may still need to be replaced with something 00451 * because it points to the old error log, or back to the tty 00452 * of the submitter. 00453 * XXX: This is BS - /dev/null is non-portable 00454 */ 00455 if (replace_stderr && freopen("/dev/null", "w", stderr) == NULL) { 00456 ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main, 00457 "unable to replace stderr with /dev/null"); 00458 } 00459 00460 for (virt = s_main->next; virt; virt = virt->next) { 00461 if (virt->error_fname) { 00462 for (q=s_main; q != virt; q = q->next) { 00463 if (q->error_fname != NULL 00464 && strcmp(q->error_fname, virt->error_fname) == 0) { 00465 break; 00466 } 00467 } 00468 00469 if (q == virt) { 00470 if (open_error_log(virt, 0, p) != OK) { 00471 return DONE; 00472 } 00473 } 00474 else { 00475 virt->error_log = q->error_log; 00476 } 00477 } 00478 else { 00479 virt->error_log = s_main->error_log; 00480 } 00481 } 00482 return OK; 00483 }
|
|
|
Referenced by log_error_core(), and main(). |
|