7 Replies Latest reply on May 7, 2012 12:08 PM by jamezp

    DEBUG level loggers not picking up ERRORs?

    nickarls

      I have a logger category like

       

       

                  <logger category="com.acme" use-parent-handlers="false">

                      <level name="DEBUG"/>

                      <handlers>

                          <handler name="LOGFILE"/>

                      </handlers>

                  </logger>

       

       

      and the LOGFILE is a normal DEBUG-leveled periodic-rotating-file-handler. For some strange reason, the DEBUG/INFO leveled stuff turns up fine but when I do a jboss-logging ERROR/FATAL, it ends up in the CONSOLE (from the root logger). I thought it would also go the same route since the classname matches the category. Any theories? Tried with 7.1.0 and 7.1.1...

        • 1. Re: DEBUG level loggers not picking up ERRORs?
          jaikiran

          Your post is missing the logger/category configuration(s). Also can you post the log statement in your code?

          • 2. Re: DEBUG level loggers not picking up ERRORs?
            nickarls
                        <root-logger>
                            <level name="INFO"/>
                            <handlers>
                                <handler name="CONSOLE"/>
                            </handlers>
                        </root-logger>
            
            

             

             

                        <logger category="com.acme" use-parent-handlers="false">
                            <level name="DEBUG"/>
                            <handlers>
                                <handler name="APPLOG"/>
                            </handlers>
                        </logger>
            
            

             

             

                        <periodic-rotating-file-handler name="APPLOG">
                            <formatter>
                                <pattern-formatter pattern="%d{HH:mm:ss} %X{sid}/%X{ip}:%X{user}@%X{inst} %-5p %s%E%n"/>
                            </formatter>
                            <file relative-to="jboss.server.log.dir" path="app.log"/>
                            <suffix value=".yyyy-MM-dd"/>
                            <append value="true"/>
                        </periodic-rotating-file-handler>
            
            

             

            (also tried a "level" element in the applogger

             

             

            private static final Logger logger = Logger.getLogger(UtilServlet.class);
            
            catch (Exception e) {
              logger.fatal("oops", e);
            }
            
            • 3. Re: DEBUG level loggers not picking up ERRORs?
              jaikiran

              Assuming UtilServlet belongs to the com.acme package, then I expect the FATAL log message to be logged to app.log when that exception occurs. If that isn't happening then it appears to be a bug. Is this reproducible against latest nightly build? And you aren't having any application specific logging configuration files within your application, are you?

              1 of 1 people found this helpful
              • 4. Re: DEBUG level loggers not picking up ERRORs?
                nickarls

                Umm, nevermind - it appears that the exception escape from a constructor and was wrapped, no longer matching the category...

                • 5. Re: DEBUG level loggers not picking up ERRORs?
                  jamezp

                  The exception shouldn't be used when determining the logging category. The logger category should be coming from your Logger.getLogger(UtilServlet.class). What logging framework/facade are you using?

                  • 6. Re: DEBUG level loggers not picking up ERRORs?
                    jaikiran

                    James Perkins wrote:

                     

                    The exception shouldn't be used when determining the logging category. The logger category should be coming from your Logger.getLogger(UtilServlet.class). What logging framework/facade are you using?

                    I think what Nicklas meant was that the catch block in that constructor wasn't executed and instead the exception was caught and logged some place else by a different logger/category.

                    • 7. Re: DEBUG level loggers not picking up ERRORs?
                      jamezp

                      Ah, that makes more sense then :-)