Ibolit Ibolit - 1 year ago 165
Java Question

Log4j2 - configuring

I am trying to adopt Log4j2 in my new project, but I get my logs in

, and the first one is always:
ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger
. It seems that I have done everything according to Log4j2 docs, but still.

Here is what I have actually done:

  1. added
    to my project

  2. created a
    file and put it in a location that is on the classpath (currently, in
    . In fact, I took a sample file from Log4J2 web-page.

  3. restarted tomcat.

I am using Tomcat 7, MacOS X 10.8, Java 7.

What am I missing?

Just in case, here is the log4j2.xml I am using:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn" name="MyApp" packages="">
<File name="MyFile" fileName="logs/app.log">
<pattern>%d %p %C{1.} [%t] %m%n</pattern>
<root level="trace">
<appender-ref ref="MyFile"/>

Answer Source

I had the same problem. After adding also log4j-core-2.0-beta3.jar to the classpath it worked.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download