2 Replies Latest reply on Apr 27, 2016 5:24 AM by negora

    Logging profiles: exceptions thrown in an EAR module aren't being logged. Why?

    negora

      Hello:

       

      I'm using Wildfly 10 in Ubuntu 14.04. I've created a logging profile in the "standalone.xml" configuration file. I've done this so that the logging messages generated by my EAR module, or by any library used in it, are written to a file separate from "server.log". I've been able to play with the INFO and DEBUG levels, and it has worked fine.

       

      However, I've a problem with the messages of the ERROR level, specially those that are generated when an exception occurs. They are always written to "server.log", no matter how I configure my logging profile. The level of the root logger in my profile is set to INFO, so the messages in the ERROR level should be written. But they aren't. Is it the expected behaviour? Is it a bug? Am I doing something wrong?

       

      My logging profile looks this way:

       

      <logging-profile name="my-application">
              <periodic-rotating-file-handler name="FILE" autoflush="true">
                  <formatter>
                      <named-formatter name="PATTERN"/>
                  </formatter>
                  <file relative-to="jboss.server.log.dir" path="my-application.log"/>
                  <suffix value=".yyyy-MM-dd"/>
                  <append value="true"/>
              </periodic-rotating-file-handler>
              <root-logger>
                  <level name="INFO"/>
                  <handlers>
                      <handler name="FILE"/>
                  </handlers>
              </root-logger>
              <formatter name="PATTERN">
                      <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p (%t) [%c] %s%e%n"/>
              </formatter>
      </logging-profile>
      
      
      
      

       

      It doesn't matter whether the exception is thrown in the EJB module or the WEB module. All the ERROR messages "escape" from my profile.

       

      Thank you.

        • 1. Re: Logging profiles: exceptions thrown in an EAR module aren't being logged. Why?
          jamezp

          More than likely the exceptions are being logged by a server component which won't use the logging profile. Do you have an example stack trace you'd expect to see in your logging profile you could post here?

           

          --

          James R. Perkins

          • 2. Re: Logging profiles: exceptions thrown in an EAR module aren't being logged. Why?
            negora

            Hello James:

             

            That's one of the possibilities that I considered. I'm talking about exceptions that aren't handled in my EAR module, but in an upper level, by the container. They're unhandled exceptions in practice. So I guess that that behaviour is the right one. Thanks for confirming it .

             

            I think that I'll use an application such as "multitail" so that I can have both log files in view. That was my main concern, really. Having 2 files to track was a pain, because while I develop, I like to have as many things in view as possible.

             

            Salutes.