#if APR_HAVE_UNISTD_H
#include <unistd.h>
#endif
+#if APR_HAVE_PROCESS_H
+#include <process.h> /* for getpid() on Win32 */
+#endif
#include "ap_config.h"
#include "httpd.h"
return pl->write_fd;
}
-/* clear_handle_list() is called when plog is cleared; at that
- * point we need to forget about our old list of pipe read
- * handles. We let the plog cleanups close the actual pipes.
- */
-static apr_status_t clear_handle_list(void *v)
-{
- read_handles = NULL;
- return APR_SUCCESS;
-}
-
/* remember to close this handle in the child process
*
* On Win32 this makes zero sense, because we don't
* between log phases, so we don't mind losing stderr's
* read_handle a little bit early.
*/
- apr_pool_cleanup_register(p, NULL, clear_handle_list,
+ apr_pool_cleanup_register(p, &read_handles, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
/* HERE we need a stdout log that outlives plog.
return len;
}
+static int log_server_name(const ap_errorlog_info *info, const char *arg,
+ char *buf, int buflen)
+{
+ if (info->r)
+ return cpystrn(buf, ap_get_server_name((request_rec *)info->r), buflen);
+
+ return 0;
+}
+
+static int log_virtual_host(const ap_errorlog_info *info, const char *arg,
+ char *buf, int buflen)
+{
+ if (info->s)
+ return cpystrn(buf, info->s->server_hostname, buflen);
+
+ return 0;
+}
+
+
static int log_table_entry(const apr_table_t *table, const char *name,
char *buf, int buflen)
{
ap_register_errorlog_handler(p, "P", log_pid, 0);
ap_register_errorlog_handler(p, "t", log_ctime, 0);
ap_register_errorlog_handler(p, "T", log_tid, 0);
+ ap_register_errorlog_handler(p, "v", log_virtual_host, 0);
+ ap_register_errorlog_handler(p, "V", log_server_name, 0);
}
/*
else if (skipping) {
continue;
}
- else if (item->min_loglevel > info->level) {
+ else if ((int)item->min_loglevel > info->level) {
len = field_start;
skipping = 1;
}
}
}
- sconf = ap_get_module_config(s->module_config, &core_module);
- if (c && !c->log_id) {
- add_log_id(c, NULL);
- if (sconf->error_log_conn && sconf->error_log_conn->nelts > 0)
- log_conn_info = 1;
- }
- if (r) {
- if (r->main)
- rmain = r->main;
- else
- rmain = r;
-
- if (!rmain->log_id) {
- /* XXX: do we need separate log ids for subrequests? */
- if (sconf->error_log_req && sconf->error_log_req->nelts > 0)
- log_req_info = 1;
- /*
- * XXX: potential optimization: only create log id if %L is
- * XXX: actually used
- */
- add_log_id(c, rmain);
+ /* the faked server_rec from mod_cgid does not have s->module_config */
+ if (s->module_config) {
+ sconf = ap_get_module_config(s->module_config, &core_module);
+ if (c && !c->log_id) {
+ add_log_id(c, NULL);
+ if (sconf->error_log_conn && sconf->error_log_conn->nelts > 0)
+ log_conn_info = 1;
+ }
+ if (r) {
+ if (r->main)
+ rmain = r->main;
+ else
+ rmain = r;
+
+ if (!rmain->log_id) {
+ /* XXX: do we need separate log ids for subrequests? */
+ if (sconf->error_log_req && sconf->error_log_req->nelts > 0)
+ log_req_info = 1;
+ /*
+ * XXX: potential optimization: only create log id if %L is
+ * XXX: actually used
+ */
+ add_log_id(c, rmain);
+ }
}
}
}
info.s = s;
info.c = c;
- info.file = file;
- info.line = line;
- info.status = status;
+ info.file = NULL;
+ info.line = 0;
+ info.status = 0;
info.using_syslog = (logf == NULL);
info.startup = ((level & APLOG_STARTUP) == APLOG_STARTUP);
}
else {
/* the actual error message */
- info.r = r;
- info.rmain = rmain;
- info.level = level_and_mask;
+ info.r = r;
+ info.rmain = rmain;
+ info.level = level_and_mask;
info.module_index = module_index;
+ info.file = file;
+ info.line = line;
+ info.status = status;
log_format = sconf ? sconf->error_log_format : NULL;
done = 1;
}