From: William A. Rowe Jr Date: Thu, 17 Jan 2002 20:15:12 +0000 (+0000) Subject: Allow the user to get detailed debugging information without a full X-Git-Tag: 2.0.31~172 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5a68267b1ee13f6a05035e79f9a06faeed3a459;p=apache Allow the user to get detailed debugging information without a full recompile [absolutely necessary on Win32 and other platforms that really don't support administrator-compilation.] -e level follows the LogLevel options. The only question, should -e override the compiled-in default for the creation of the server_rec? No strong feeling either way, here. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92891 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_log.h b/include/http_log.h index 2e53b85fc3..03b44cffee 100644 --- a/include/http_log.h +++ b/include/http_log.h @@ -111,6 +111,8 @@ extern "C" { #define DEFAULT_LOGLEVEL APLOG_WARNING #endif +extern int AP_DECLARE_DATA ap_default_loglevel; + #define APLOG_MARK __FILE__,__LINE__ /** diff --git a/include/http_main.h b/include/http_main.h index 102265c9d2..a6308e0e79 100644 --- a/include/http_main.h +++ b/include/http_main.h @@ -63,7 +63,7 @@ * in apr_getopt() format. Use this for default'ing args that the MPM * can safely ignore and pass on from its rewrite_args() handler. */ -#define AP_SERVER_BASEARGS "C:c:D:d:f:vVlLth?X" +#define AP_SERVER_BASEARGS "C:c:D:d:e:f:vVlLth?X" #ifdef __cplusplus extern "C" { diff --git a/server/log.c b/server/log.c index 521322e104..d74cb95ae0 100644 --- a/server/log.c +++ b/server/log.c @@ -100,6 +100,8 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(error_log) ) +int AP_DECLARE_DATA ap_default_loglevel = DEFAULT_LOGLEVEL; + #ifdef HAVE_SYSLOG static const TRANS facilities[] = { @@ -358,7 +360,7 @@ static void log_error_core(const char *file, int line, int level, * notice */ if ((level_and_mask != APLOG_NOTICE) && - (level_and_mask > DEFAULT_LOGLEVEL)) { + (level_and_mask > ap_default_loglevel)) { return; } logf = stderr_log; diff --git a/server/main.c b/server/main.c index a024ea229d..f9478f0577 100644 --- a/server/main.c +++ b/server/main.c @@ -278,6 +278,7 @@ static void usage(process_rec *process) ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -i : install an Apache service"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -u : uninstall an Apache service"); #endif + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -e level : show startup errors of level (see LogLevel)"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -v : show version number"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -V : show compile settings"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)"); @@ -357,6 +358,35 @@ int main(int argc, const char * const argv[]) new = (char **)apr_array_push(ap_server_config_defines); *new = apr_pstrdup(pcommands, optarg); break; + case 'e': + if (strcasecmp(optarg, "emerg") == 0) { + ap_default_loglevel = APLOG_EMERG; + } + else if (strcasecmp(optarg, "alert") == 0) { + ap_default_loglevel = APLOG_ALERT; + } + else if (strcasecmp(optarg, "crit") == 0) { + ap_default_loglevel = APLOG_CRIT; + } + else if (strcasecmp(optarg, "error") == 0) { + ap_default_loglevel = APLOG_ERR; + } + else if (strcasecmp(optarg, "warning") == 0) { + ap_default_loglevel = APLOG_WARNING; + } + else if (strcasecmp(optarg, "notice") == 0) { + ap_default_loglevel = APLOG_NOTICE; + } + else if (strcasecmp(optarg, "info") == 0) { + ap_default_loglevel = APLOG_INFO; + } + else if (strcasecmp(optarg, "debug") == 0) { + ap_default_loglevel = APLOG_DEBUG; + } + else { + usage(process); + } + break; case 'X': new = (char **)apr_array_push(ap_server_config_defines); *new = "DEBUG";