0 Replies Latest reply on Aug 11, 2015 5:49 PM by Clovis Seragiotto

    logger level not set in per-deployment Logging

    Clovis Seragiotto Newbie

      Hello!

       

      I couldn't set the logger level for a specific logger with per-deployment logging; all loggers use the level set for the root logger. This is my file logging.properties (adapted from the file logging.properties in the directory configuration of my Wildflly distribution, 9.0.1)

       

      loggers=foo

       

      logger.level=INFO

      logger.handlers=CONSOLE

      logger.foo.level=ERROR

      logger.foo.useParentHandlers=true

       

      handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler

      handler.CONSOLE.level=DEBUG

      handler.CONSOLE.formatter=COLOR-PATTERN

      handler.CONSOLE.properties=autoFlush,target,enabled

      handler.CONSOLE.autoFlush=true

      handler.CONSOLE.target=SYSTEM_OUT

      handler.CONSOLE.enabled=true

      formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter

      formatter.COLOR-PATTERN.properties=pattern

      formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%E%n

       

      Then, when the following code is executed:

       

      System.out.println("--- logger names:");

      Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames();

      while (loggerNames.hasMoreElements()) {

        System.out.println(">" + loggerNames.nextElement());

      }

      System.out.println("About foo:");

      Logger logger = LogManager.getLogManager().getLogger("foo");

      System.out.println(logger);

      if (logger != null) {

          System.out.println("Level: " + logger.getLevel());

          System.out.println("Parent level: " + logger.getParent().getLevel());

          Handler[] handlers = logger.getParent().getHandlers();

          Arrays.stream(handlers).forEach(h -> System.out.println("Handler level: " + h.getLevel()));

      }


      The output is:


      23:33:41,864 INFO  [stdout] (default task-2) --- logger names:

      23:33:41,865 INFO  [stdout] (default task-2) >

      23:33:41,865 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataImpl

      23:33:41,865 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData

      23:33:41,865 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.aggregated.GroupConversionHelper

      23:33:41,866 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.aggregated.MetaDataBuilder

      23:33:41,866 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.aggregated.rule.MethodConfigurationRule

      23:33:41,866 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable

      23:33:41,866 INFO  [stdout] (default task-2) >org.hibernate.validator.internal.util.TypeHelper

      23:33:41,866 INFO  [stdout] (default task-2) >stderr

      23:33:41,866 INFO  [stdout] (default task-2) >stdout

      23:33:41,866 INFO  [stdout] (default task-2) About foo:

      23:33:41,867 INFO  [stdout] (default task-2) Logger 'foo' in context org.jboss.logmanager.LogContext@4209f158

      23:33:41,867 INFO  [stdout] (default task-2) Level: null

      23:33:41,867 INFO  [stdout] (default task-2) Parent level: INFO

      23:33:41,867 INFO  [stdout] (default task-2) Handler level: DEBUG

      23:33:41,867 INFO  [foo] (default task-2) information

       

      I expected the level for the logger foo to be ERROR. I also didn't expect that the message "information" were output. Is there something visibly wrong in the configuration, is this behavior a bug or a feature?

       

      Thanks

      Clóvis