How should logging levels work defined in logger.xml?

265 views
Skip to first unread message

Markku Nikkanen

unread,
Oct 18, 2012, 6:59:02 AM10/18/12
to play-fr...@googlegroups.com
Hello,

following tutorial lags of information. It does not explain well enough how does loggers and logger's logging levels behave.


What I would expect to happen with following configurations is to have ONLY following line to play.log.log file.

2012-10-18 13:13:50,164 - [ERROR] - from play in main 
play error

Why I make this conclusion is based on following code block. Play logger is set with logging level ERROR.

    <logger name="play" level="ERROR"/>

Only following line matches to above definition:

    Logger.of("play").error("play error");

This is how configurations are read:

java -Dlogger.file=logger.xml -cp "/Users/mnikkane/repos/xxx/target/staged/*" play.core.server.NettyServer

------------------------------------------------------------

Following logging are set to file which inherits GlobalSettings

public void onStart(Application app) {

  Logger.trace("global trace");  

  Logger.debug("global debug");

  Logger.info("global info");

  Logger.warn("global warn");

  Logger.error("global error");

 

  Logger.of("application").trace("application trace");  

  Logger.of("application").debug("application debug");

  Logger.of("application").info("application info");

  Logger.of("application").warn("application warn");

  Logger.of("application").error("application error");

 

  Logger.of("play").trace("play trace");  

  Logger.of("play").debug("play debug");

  Logger.of("play").info("play info");

  Logger.of("play").warn("play warn");

  Logger.of("play").error("play error");

------------------------------------------------------------

I have removed application level logger from following configurations to make it more readable, now:

<configuration>
    <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${application.home}/logs/play_log.log</file>
        <encoder>
            <pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>DEBUG</level>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${application.home}/logs/play_log.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
    </appender>

    <logger name="play" level="ERROR"/>

    <root level="WARN">
        <appender-ref ref="FILE_DEBUG"/>
    </root>
</configuration>

------------------------------------------------------------

Following Application.conf lines seems to have clear affect what logging levels are actually logged, but I would like to handle all this through logger.xml.

# Root logger:

#logger.root=INFO

# Logger used by the framework:

#logger.play=INFO

# Logger provided to your application:

#logger.application=WARN

------------------------------------------------------------

See how logs/play.log.log file contains lots of lines that should not be there( or should they)?

2012-10-18 13:13:50,164 - [DEBUG] - from application in main 
global debug

2012-10-18 13:13:50,164 - [INFO] - from application in main 
global info

2012-10-18 13:13:50,164 - [WARN] - from application in main 
global warn

2012-10-18 13:13:50,164 - [ERROR] - from application in main 
global error

2012-10-18 13:13:50,164 - [DEBUG] - from application in main 
application debug

2012-10-18 13:13:50,164 - [INFO] - from application in main 
application info

2012-10-18 13:13:50,164 - [WARN] - from application in main 
application warn

2012-10-18 13:13:50,164 - [ERROR] - from application in main 
application error

2012-10-18 13:13:50,164 - [INFO] - from play in main 
play info

2012-10-18 13:13:50,164 - [WARN] - from play in main 
play warn

2012-10-18 13:13:50,164 - [ERROR] - from play in main 
play error

Gadille Lionel

unread,
Oct 25, 2012, 10:53:08 AM10/25/12
to play-fr...@googlegroups.com

I have teh same issu
play see to hide the level  configuration

i have something like this
 
  <logger name="controllers" level="debug"/>
  <logger name="util" level="info"/>   
  <logger name="util.Ldap.ldapSearchExtract" level="info"/> 
  <logger name="play" level="info" />
  <logger name="application" level="info" />

if all level are in info i get only info trace
if i turn one class in debug
all are in debug


did you find somethings about that?


Markku Nikkanen

unread,
Oct 25, 2012, 12:30:57 PM10/25/12
to play-fr...@googlegroups.com
I did not found a solution to this issue. As far I remember there was some bug in Play Framework task list already. Hopefully they will fix it soon!




--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/IKnhUDjuKrgJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Reply all
Reply to author
Forward
0 new messages