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