]> granicus.if.org Git - apache/commitdiff
Allow the user to get detailed debugging information without a full
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 17 Jan 2002 20:15:12 +0000 (20:15 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 17 Jan 2002 20:15:12 +0000 (20:15 +0000)
  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

include/http_log.h
include/http_main.h
server/log.c
server/main.c

index 2e53b85fc3cb5b3740ea06e43d13f415b9c44cf7..03b44cffee222eddef675dc4b1fb6ecad6dd6884 100644 (file)
@@ -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__
 
 /**
index 102265c9d2eb5c664e94df227c07a5117921d2f2..a6308e0e79ef7c1b456fc8e874c91db270ee9642 100644 (file)
@@ -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" {
index 521322e104ebf04941425631fb9ef760624c34a8..d74cb95ae02ac6ac213d102f6573a30c768f354f 100644 (file)
@@ -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;
index a024ea229da99857ed2a694e3e9d128e16b24fce..f9478f0577c23ea29361a521004e69d96abb57fa 100644 (file)
@@ -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";