Dear all,I am trying to modify the code of mod_dumpit.c . I want to dump all request response to
separate file, then error log. For performance reason, I have opened file with APR_BUFFERED flag, while calling apr_file_open.The problem is, when i use buffered flag, and shuts down my httpd, the contents of the buffer is not getting transfered to file, even though i have used apr_file_open . So i decided to register a function, which flushes the file, using apr_file_flush
and register that function for signals, SIGHUP, SIGTERM and SIGUSR1. but my signal handler is not called, when we reload the httpd. So i have decided to call apr_pool_cleanup_register, and register apr_file_flush when pool is cleaned up. But unfortunately it didn't work. below is the code . can anybody please help. static void mercedumpio_register_hooks(apr_pool_t *p) { /* * We know that SSL is CONNECTION + 5 */ ap_register_output_filter("DUMPIO_OUT", mercedumpio_output_filter, NULL, AP_FTYPE_CONNECTION + 3) ; ap_register_input_filter("DUMPIO_IN", mercedumpio_input_filter, NULL, AP_FTYPE_CONNECTION + 3) ; ap_hook_pre_connection(mercedumpio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE); apr_signal(SIGHUP, sighandler); apr_signal(SIGTERM, sighandler); apr_signal(SIGUSR1, sighandler); //apr_signal(AP_SIG_GRACEFUL, sighandler); //apr_signal(AP_SIG_GRACEFUL_STOP, sighandler); char foo[100]; int x; x = getpid(); sprintf(foo, "/var/tmp/foo%d", x); apr_status_t rv;rv = apr_file_open(&fp, foo, APR_CREATE | APR_WRITE | APR_APPEND | APR_BUFFERED , APR_OS_DEFAULT, p);
apr_pool_cleanup_register(p,fp, apr_file_flush, apr_pool_cleanup_null); if (rv != APR_SUCCESS) { //ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, // "could not open transfer log file %s.", fname); // return NULL; } Warm Regards and thanks in advance, Prashant R Keshvani Merce Technologies. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx