开发者

Log4j works for one class and doesn't work for the other class

I am developing a Spring MVC 3.0.4 webapp and Logger factroy doesn'开发者_运维知识库t work for the Controller classes other than HomeController.java. I initilize the Logger factory like:

private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
private static final Logger logger = LoggerFactory.getLogger(RequestDataController.class);

and

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

is added for both classes

What configuration is missing?


It seems SLF4J is missconfigured. You use it for you own logging and that's a right choice! But Spring has JCL logging framework hardcoded. It's an abstarction layer that is typically configured with Log4J implementation. Please, visit this link where some JCL-to-SLF4J drop-in replacements described. If you want to leave both Log4J and SLF4j in your project than add proper logging preferences into log4j.properties or log4j.xml for core spring packages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜