You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Seema Alevoor <Se...@Sun.COM> on 2003/02/05 12:00:24 UTC
Query regarding the logging in Apache Web Server
Hi,
In my module, I'm trying to log a message at the debug level. Bit it is not getting logged, in spite of setting the LogLevel to debug within httpd.conf file.
The message that I was trying to log does not have server_rec pointer. Instead, this
parameter is passed as NULL.
e.g.,
ap_log_error(APLOG_MARK, APLOGDEBUG|APLOG_NOERRORNO, NULL, "some message");
If I pass the actual server_rec pointer, it logs the message at the debug level. I'm using 1.3.27 version.
I have looked at the apache sources and the logic used for logging is as follows:
-----------------------------
static void log_error_core(const char *file, int line, int level,
const server_rec *s, const request_rec *r,
const char *fmt, va_list args)
{
char errstr[MAX_STRING_LEN];
size_t len;
int save_errno = errno;
FILE *logf;
if (s == NULL) {
/*
* If we are doing stderr logging (startup), don't log messages that are
* above the default server log level unless it is a startup/shutdown
* notice
*/
if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL))
return;
logf = stderr;
}
else if (s->error_log) {
-----------------------------
Since the default log level is APLOG_WARN, debug level messages would never get logged if server_rec is NULL.
Is there a way to change the default level(from my module) ? Am I missing any other configuration which would log the debug messages ?
Thanks in advance,
Seema.