Using log4j2 2.1 over slf4j 1.7.7 in Eclipse RCP
Stephan Druskat <stephan.druskat <at> uni-jena.de>
2014-11-24 09:58:30 GMT
I'm developing an Eclipse RCP based on Eclipse 3.7.2 (Indigo).
I'd like to use log4j2 (2.1) over slf4j 1.7.7, but I'm having trouble
getting it to work. I have done the following to add log4j2 and slf4j to
- I've built a p2 repo including slf4j.api_1.7.7.jar,
- I've consumed this p2 repo in my target platform + added it to the
parent POM of my project.
- I've added all 4 plugins to my Eclipse plugin project as dependencies
- I've created a file log4j2.xml in the project root in my Eclipse
plugin. Content below.
- I've added a private static final Logger logger =
LoggerFactory.getLogger(MyClass.class) field to MyClass
- In MyClass, I've called logger.error("Hi from logger").
However, when I run my application, I'm getting an error message: ERROR
StatusLogger Log4j2 could not find a logging implementation. Please add
log4j-core to the classpath. Using SimpleLogger to log to the console...