7 Replies Latest reply on Mar 27, 2018 12:54 PM by jamezp

    use-parent-handlers="false" does not work

    kaspatoo

      Hi,

       

      I hope I am doing wrong and can say what it is.

       

      I have a problem with logging, that although i defined use-parent-handers="false" every log is also printed in the root logger (=console).

       

      This ist form my standalone.xml:

      edit2: web-forum crashed my codes, pasted again:

      <profile>
              <subsystem xmlns="urn:jboss:domain:logging:3.0">
                  <console-handler name="CONSOLE">
                      <level name="TRACE"/>
                      <formatter>
                          <named-formatter name="COLOR-PATTERN"/>
                      </formatter>
                  </console-handler>
                  <periodic-rotating-file-handler name="FILE" autoflush="true">
                      <formatter>
                          <named-formatter name="PATTERN"/>
                      </formatter>
                      <file relative-to="jboss.server.log.dir" path="server.log"/>
                      <suffix value=".yyyy-MM-dd"/>
                      <append value="true"/>
                  </periodic-rotating-file-handler>
                  <periodic-rotating-file-handler name="TEST" autoflush="true">
                      <formatter>
                          <named-formatter name="PATTERN"/>
                      </formatter>
                      <file relative-to="jboss.server.log.dir" path="test.log"/>
                      <suffix value=".yyyy-MM-dd"/>
                      <append value="true"/>
                  </periodic-rotating-file-handler>
                  <logger category="org.jboss.modules" use-parent-handlers="false">
                      <level name="TRACE"/>
                      <handlers>
                          <handler name="TEST"/>
                      </handlers>
                  </logger>
                  <root-logger>
                      <level name="INFO"/>
                      <handlers>
                          <handler name="CONSOLE"/>
                          <handler name="FILE"/>
                      </handlers>
                  </root-logger>
                  <formatter name="PATTERN">
                      <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
                  </formatter>
                  <formatter name="COLOR-PATTERN">
                      <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
                  </formatter>
              </subsystem>
      

      After adding this logger:

      <logger category="org.jboss.modules" use-parent-handlers="false">
                      <level name="TRACE"/>
                      <handlers>
                          <handler name="TEST"/>
                      </handlers>
                  </logger>
      

       

      every trace is also printed to console.

      After removing this logger again, console prints as expected.

       

      As far as I understand this would be normal behaviour if I did not defined use-parent-handlers="false" but I did and I do not understand why it is not working.

       

      edit:

      I also do not understand why root-logger is logging it at all, because its level is set to INFO and log outputs in console are of TRACE. This should not happen I think.

      edit3: nvm, since use-parent-handlers="false" does not work, its pushing then up to root-logger, while log-level TRACE is used and because it was defined previuosly, the level of the root-logger in this case is ignored.

       

      If you need further information, feel free to ask.

       

      Thanks in advance.

        • 1. Re: use-parent-handlers="false" does not work
          kaspatoo

          even when I delete the console appender and the refeerence in the root-logger to console such that theres no console appender at all

          a console pops up and logs every trace.

           

          Is there some kind of ghost-console-appender being always there logging everything despite the configuration in standalone.xml?

          When removing TRACE from standalone.xml the logging of those traces stops, so I am pretty sure that the standalone.xml is basically correct and working.

          • 2. Re: use-parent-handlers="false" does not work
            jamezp

            The use-parent-handlers attribute should definitely be working. Using the following CLI commands on WildFly 12 I saw only trace log messages in the test.log and no org.jboss.modules on the console or in the server.log.

             

            /subsystem=logging/periodic-rotating-file-handler=TEST:add(named-formatter=PATTERN, suffix=".yyyy-MM-dd", append=true, autoflush=true, file={relative-to=jboss.server.log.dir, path=test.log})
            /subsystem=logging/logger=org.jboss.modules:add(use-parent-handlers=false, handlers=[TEST], level=TRACE)
            

             

            Which version of WildFly are you using? It really should work in all versions.

             

            --

            James R. Perkins

            • 3. Re: use-parent-handlers="false" does not work
              kaspatoo

              its wildfly10

              • 4. Re: use-parent-handlers="false" does not work
                kaspatoo

                sry I was wrong. it is Jboss EAP 7.

                So I am on wrong forum. I created a new post at

                jboss eap 7 - use-parent-handlers="false" does not work - Stack Overflow

                 

                So I think this one is going to be closed.

                Thanks anyways.

                • 5. Re: use-parent-handlers="false" does not work
                  jamezp

                  The same is true for JBoss EAP 7. It should definitely be working on all versions of JBoss EAP 6+, JBoss AS 7+ and WildFly.

                   

                  --

                  James R. Perkins

                  • 6. Re: use-parent-handlers="false" does not work
                    kaspatoo

                    ok, would be nice but the configuration in standalone.xml I posted does not work.

                    • 7. Re: use-parent-handlers="false" does not work
                      jamezp

                      Have you tried executing the CLI commands instead? That works for me in JBoss EAP 7. While the XML looks correct to me there could be some residual logging configuration coming from the logging.properties file. This is why it's generally best to use a management operation (CLI, JMX, web console, etc) to configure logging. Both logging and modules are configured very early before the logging subsystem is even processed. So if the logging.properties is out of sink with the logging subsystem that could explain some weirdness that you seen.

                       

                      --

                      James R. Perkins