How to use logback in a PlayFramework project
Because of dependencies on a project I am working on developing a web application using the Play!Framework, I have to configure logback to prevent it from flooding my output with DEBUG messages. But as log4j is the default开发者_开发百科 log library used by the Play!Framework, I don't really know how to make it consider a logback.xml configuration file.
The best would be to make the Play!Framework completely use logback/Slf4j instead of log4j. How could I do this ?
At the moment play1 use log4j or juli (I'm not sure if juli works, but the code exists). There is feature-request, but unfortunately you can't use logback correctly if you have a single Logger.class. In this case %F and all other uppercase chars from PatternLayout which is discussed here.
Update: After some information from Ceki, I have now the knowledge how it can fixed in a clean way. So the feature-request can implemented in a clean way.
An idea could be to let log4j write to logback, if it will possible. Furthermore I'm thinking about creating a patch which solve this issue. So I don't want to start until this is fixed and I get some signals from the core-team that they accept any re-factoring at such a central class.
To make a long story short: At the moment it's impossible without hacking the framework. However I don't understand your problem. What do you want to do that log4j can't? Perhaps you could explain your root cause in another question.
精彩评论