Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-434

Cannot log error message in directive parsing code of httpd module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Critical Critical
    • None
    • JWS 3.0.0 GA
    • httpd

      When trying to log an error in a custom httpd module, that error message is lost when logging in directive parsing code. I can see the error being written out through strace, but the error is not written to a log file:

      Here is a sample module:

      #include <httpd.h>
      #include <http_config.h>
      #include <http_log.h>
      
      const char * intoTheVoid(cmd_parms *parms, void *config, const char *args)
      {
          void * pass = NULL;
          apr_pool_userdata_get( & pass, "key", parms->server->process->pool );
      
          ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, NULL, APLOGNO(11111), "Test: foobar");
      
          if (NULL == pass) {
            apr_pool_userdata_set((void *) 0x1, "key", NULL, parms->server->process->pool);
          } else {
            return "A second pass error.";
          }
      
          return NULL;
      }
      
      static const command_rec itv_directives[] =
      {
          AP_INIT_NO_ARGS( "IntoTheVoid",
      		      intoTheVoid,
      		      NULL, ACCESS_CONF | RSRC_CONF,
      		      "intothevoid description" ),
          { NULL }
      };
      
      
      AP_DECLARE_MODULE( intothevoid ) =
      {
          STANDARD20_MODULE_STUFF,
          NULL,
          NULL,
          NULL,
          NULL,
          itv_directives,
          NULL
      };
      
      # strace -Tttvfs 1024 -o strace.out ./apachectl start
      # grep -C4 "A second pass error" strace.out 
      2646  11:17:17.584054 gettimeofday({1461251837, 584060}, NULL) = 0 <0.000004>
      2646  11:17:17.584122 gettimeofday({1461251837, 584128}, NULL) = 0 <0.000004>
      2646  11:17:17.584146 write(2, "[Thu Apr 21 11:17:17.584128 2016] [intothevoid:warn] [pid 2646] AH11111: \n", 74) = 74 <0.000004>
      2646  11:17:17.584162 write(2, "AH00526: Syntax error on line 841 of /opt/jws-3.0/httpd/conf/httpd.conf:\n", 73) = 73 <0.000003>
      2646  11:17:17.584176 write(2, "A second pass error.\n", 21) = 21 <0.000003>
      2646  11:17:17.584195 select(0, NULL, NULL, NULL, {0, 10000}) = 0 (Timeout) <0.010187>
      2646  11:17:17.594439 close(7)          = 0 <0.000023>
      2646  11:17:17.594821 munmap(0x7f123fefa000, 2105456) = 0 <0.000022>
      2646  11:17:17.594895 munmap(0x7f12400fd000, 2134176) = 0 <0.000014>
      

            gzaronik@redhat.com George Zaronikas
            rhn-support-rbost Robert Bost
            Jan Onderka Jan Onderka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: