How do I resolve this Log4J import error (relating to Classpath too)?

冷暖自知 提交于 2019-12-05 11:44:40

I think you need both the API and the Core jars in your classpath. Follow these instructions for build and install and these for configuration. On the configuration page, the import line you're asking about is import org.apache.logging.log4j.Logger;, so the Logger class will be pulled from the API jar.

Log4j 2 needs two jars (as opposed to Log4j 1.x which needed one) because of the:

API Separation

The API for Log4j is separate from the implementation making it clear for application developers which classes and methods they can use while ensuring forward compatibility. This allows the Log4j team to improve the implementation safely and in a compatible manner.

By the way, log4j 2.0 beta5 has some new features that you may be interested in, like Async Loggers, JSP tag library and JMX support.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!