My Wiki

July 5, 2006

I get “log4j:WARN No appenders could be found for logger” message

Filed under: Log4j — jaikiran @ 7:57 am

While using log4j in your application, sometimes you might encounter the following message:

log4j:WARN No appenders could be found for logger(somePackageName.someClassName).
log4j:WARN Please initialize the log4j system properly.

The reason why you see this message is that your log4j configuration file(i.e. log4j.xml or is NOT found in the classpath. Placing the log4j configuration file in the applications classpath should solve the issue. If you want to find out how log4j tries to configure itself, have a look at my earlier post :

Know how log4j tries to configure itself



  1. Thanks!! Works now!

    Comment by Robert — February 14, 2008 @ 4:07 pm

  2. Does it always need to be in the classpath? My Java app lets you specify ( as a CLI parameter ) the location of the XML formatted Log4j config file, which could be literally anywhere. If it had to be on the classpath, that would really eliminate the flexibility that I built into the application.

    Comment by John — June 3, 2008 @ 2:16 pm

    • Hi, I’d like to access file without putting it on my classpath. How can I achieve this. I am literaly stuck with fixing this problem

      Comment by Boipelo — June 2, 2011 @ 8:45 am

  3. This was helpful, thanks!

    Comment by Jon Schneider — September 4, 2008 @ 1:48 pm

  4. Thanks dude. That was really helpful.

    Comment by John Dondapati — November 4, 2008 @ 9:02 pm

  5. What if you are using log4j in multiple open source packages and your own code and only one of them is complaining?
    log4j:WARN No appenders could be found for logger (org.hibernate.mapping.RootClass).
    log4j:WARN Please initialize the log4j system properly.

    Comment by Dave — November 12, 2008 @ 4:48 pm

  6. Dave,
    This is probably because the Hibernate logger is not defined in your log4j.xml. (or which ever method you use to load your log4j configuration)

    Comment by Pramod — January 13, 2009 @ 6:23 pm

  7. put my log4j.xml and to my CLASSPATH, but it doesn’t work:

    Buildfile: build.xml
    log4j:WARN No appenders could be found for logger (
    log4j:WARN Please initialize the log4j system properly.

    …taskdef A class needed by class …class cannot be found : …class

    can you help me?

    Comment by student — January 22, 2009 @ 2:04 pm

  8. Use: DOMConfigurator.configure(“./log4j.xml”); or PropertyConfigurator.configure(“./”);
    Greetings from Lublin@Poland

    Comment by Mariusz — February 12, 2009 @ 8:31 am

  9. Mar 24, 2009 5:06:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:cards’ did not find a matching property.
    Mar 24, 2009 5:06:32 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\apache2triad\bin;C:\apache2triad\perl\bin;C:\apache2triad\php\bin;C:\apache2triad\mysql\bin;C:\apache2triad\opssl\bin;C:\apache2triad\python\bin;C:\apache2triad\pgsql\bin;C:\apache2triad\php\extensions;C:\PROGRA~1\SECUREFX;C:\mysql\bin;
    Mar 24, 2009 5:06:32 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    Mar 24, 2009 5:06:32 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 571 ms
    Mar 24, 2009 5:06:32 PM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    Mar 24, 2009 5:06:32 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
    Mar 24, 2009 5:06:33 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    Mar 24, 2009 5:06:33 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /
    Mar 24, 2009 5:06:33 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/31 config=null
    Mar 24, 2009 5:06:33 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 992 ms

    Comment by QA — March 24, 2009 @ 12:07 pm

  10. Sometimes, even placing and log4j.xml in the classpath doesn’t fix it.

    I finally got the darn thing to shut up when I added this to my initialization code:


    Comment by Alex — July 25, 2009 @ 4:25 pm

  11. Thanks, but it does not solve the problem

    Comment by Emily — September 14, 2009 @ 6:03 am

    • Did you get an answer on how to add the log4j.xml to your classpath?

      Comment by aschwin — November 19, 2009 @ 9:25 am

  12. Hey ,
    That was helpful. How to add the xml or the properties file to class path if I am using Eclipse IDE ?


    Comment by Tapas Adhikary — October 14, 2009 @ 11:11 am

  13. thx it helped me…

    Comment by dinesh chettri — October 23, 2009 @ 4:53 am

  14. thx it helped me….

    Comment by dinesh chettri — October 23, 2009 @ 4:53 am

  15. For what it is worth, to pickup the log4j properties file from a file, and not the classpath, the following arguments should be sent as arguments to your Java command:
    -Dlog4j.configuration=log4jfilename -Dconfig.location=file

    (The second argument is the important one, this tells it to look for it in a file, as opposed to if you switch it to “classpath” which will look for it in your classpath – ie. -Dconfig.location=classpath ).

    Good luck.

    Comment by Mike Wolfson — January 7, 2010 @ 8:56 pm

    • I found that -Dlog4j.configuration=log4jfilename -Dconfig.location=file

      did not work for me, but its close relative:


      did work for me (using URL format)

      Comment by Andrew McGregor — February 11, 2010 @ 3:02 pm

      • Thank you.

        Comment by Scott — November 4, 2010 @ 11:03 pm

      • -Dlog4j.configuration=file:///usr/zeus/

        thanks man.. u made my day…
        really helptull

        Comment by sanjay — March 21, 2011 @ 9:05 am

  16. Thanks, dude! You helped me a lot!

    Comment by alsantos — April 19, 2010 @ 10:21 pm

  17. in my case, the log4j configuration is log4j.xml
    just add in the source below in initialize process such as in main so log4j able to find the configuration


    Comment by indra — April 28, 2010 @ 7:54 am

  18. Andrew McGregor, u are my HERO dude!!

    Comment by Luane — June 2, 2010 @ 9:48 am

  19. Another way is set the enviroment property
    -Dlog4j.configuration=”file:conf/” and -Dlog4j.debug=true is usefull too.
    Note the prefix “file:”, it’s very important without doesn’t work.

    Comment by Morto Enterrado — June 16, 2010 @ 8:45 pm

  20. Thanks, it is very useful…

    Comment by madhusudan naik — June 24, 2010 @ 1:58 pm

  21. Thank you, Andrew McGregor; finest solution to this somehow stupid problem.

    Comment by Dacian — July 2, 2010 @ 8:40 am

  22. I guess, it will solve this problem if you fully qualify the class…

    for example,

    private static Logger log = Logger.getLogger(“com.fmr.fims.deconv.XrefCnvThread.class”);

    instead of just private static Logger log = Logger.getLogger(“XrefCnvThread.class”);

    Comment by hh — July 15, 2010 @ 6:52 pm

    • Ignore the quotes in getLogger

      Comment by hh — July 15, 2010 @ 6:55 pm

  23. thanks it works.

    Comment by guvenc — October 23, 2010 @ 10:23 am

  24. dd

    Comment by a — February 2, 2011 @ 1:04 pm

  25. it works, thanks a lot.

    1. The last line shows that the is not found in the classpath. You mention that you are using Eclipse. I guess you have not placed the (or log4j.xml) at the right place in the project. If you have project created in D:\MySampleApp folder, then place the (or log4j.xml) at the root of the project (i.e. directly in D:\MySampleApp…

    2. put your class definition into console appender in log4j.xml as

    Comment by guvenc — May 3, 2011 @ 2:16 am

  26. 2. put your class definition into console appender in log4j.xml as

    Comment by guvenc — May 3, 2011 @ 2:17 am

  27. Thanks for the posts. It solved the log4j issue.

    Comment by Asif Shahzad — December 12, 2011 @ 12:45 pm

  28. avoiding having a blank log4j.cfg file helped here

    Comment by Roger Deloy Pack — March 2, 2012 @ 4:34 pm

  29. Hi,
    I am facing issue with log4j as i have implemented log4j in my project and when i run this project from Eclipse its working as expected and logs are printed on my log file, but when i tried to run the same project from Command Prompt by ANT, noting is printed on the log file.
    here is my file

    #Application Logs
    log4j.logger.devpinoyLogger=DEBUG, dest1
    log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n


    and in my base class i have created the object.
    Logger APP_LOGS = Logger.getLogger(“devpinoyLogger”);

    can you please suggest me like what is problem with this while running from cmd..

    Thanks in Advance.

    Comment by pawan — March 20, 2012 @ 11:15 am

  30. Thankd Andrew McGregor! It works great!

    Comment by swetha — April 30, 2012 @ 6:43 pm

  31. I’m going to try and use Anrew McGregor’s solution, but what I am not sure what I should put as the file name. For example, I have a file at the root of my app’s folder, so should the path be -Dlog4j.configuration=”file:/” ?

    Comment by Nate — May 17, 2012 @ 12:36 pm

  32. thanks(:::

    Comment by Murali — September 10, 2012 @ 1:33 pm

  33. An explanation just so simple!!.. I can’t found the answer to this problem.. thanks!!!

    Comment by kike — April 13, 2013 @ 9:00 pm

  34. -Dlog4j.debug=true go for this

    Comment by azhar — May 5, 2013 @ 6:33 am

  35. Thanks for a marvelous posting! I definitely enjoyed reading it, you could be a great author.
    I will ensure that I bookmark your blog and will eventually come back sometime soon.
    I want to encourage yourself to continue your great posts, have a nice weekend!

    Comment by informacja bik — May 5, 2013 @ 8:52 pm

  36. Hello, i read your blog from time to time and i own a similar one
    and i was just curious if you get a lot of spam comments?
    If so how do you stop it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any assistance is very much appreciated.

    Comment by methadone addiction — June 14, 2013 @ 2:14 am

  37. My brother suggested I may like this blog. He used to be entirely right.
    This publish actually made my day. You can not believe simply how much time I had spent
    for this info! Thanks!

    Comment by oddluzanie - odd_u_enie — June 22, 2013 @ 4:32 pm

  38. Hi there! I know this is kind of off-topic but I had to ask.

    Does managing a well-established blog such as yours take a lot of work?
    I am completely new to blogging but I do write in my journal everyday.

    I’d like to start a blog so I can share my experience and feelings online. Please let me know if you have any ideas or tips for brand new aspiring bloggers. Appreciate it!

    Comment by Louisville AC Repair — July 24, 2013 @ 12:40 am

  39. @Guven… thanks alot ..

    Comment by LinuxBee — August 13, 2013 @ 12:37 pm

  40. It’s the best time to make some plans for the future and it’s time
    to be happy. I have read this post and if I could I desire to suggest you some
    interesting things or suggestions. Maybe you can write next articles referring to this article.
    I want to read even more things about it!

    Comment by helpful hints — May 3, 2014 @ 3:36 am

  41. I finally got what was happening in my case. It might also help those in Netbeans users facing the same problem coz i have lost a lot of hair for quite some months now. My application had just stopped logging to console so i couldnt debug since the errors were not being displayed.

    The answer “There are two log4j jar files in you libraries at different location.” was true. Initially i had expected to find 2 files with the name log4xxx.jar of course with different version numbers but no file like that at all was there. You see Netbeans comes prepackaged with Hibernate libraries and many other libraries of course. So when developing in hibernate applications in Netbeans you DON’T need to manually add your own Hibernate Jars unless of course you need a specific version etc, you can just add the Hibernate library to your application via that right click project – Properties – Libraries – Add Library button . This will add many hibernate Jars in the background/classpath when running and also on Compiling in the dist/lib folder BUT NOT in the lib of the application. In my case i had added both the Hibernate Library AND also copied the generated hibernate jars from dist/lib to lib. This had happened by mistake as i copied libraries from previous application to include in my new application for use there.

    So take home point, if in Netbeans, go to your lib folder, if you see jars like
    hibernate-commons-annotations-x.x.x.Final.jar, hibernate-core-x.x.x.Final.jar,hibernate-entitymanager-x.x.x.Final.jar, hibernate-jpa-2.0-api-x.x.x.Final.jar, hibernate-tools-x.x.x.CR1.jar
    Remove them and check if error resolves.

    Comment by ngonidan — August 6, 2014 @ 8:08 am

  42. I really like your writing style, great info, thank you for putting up cgbdeeadaeea

    Comment by Johnd453 — October 10, 2014 @ 9:30 pm

  43. One person posted they’d lost more than 130. Frequently engaging in those behaviors to a
    greater extent, or over a longer period of time than intended.
    But I can see now, that our sexual incompatibility bled over
    to affdct our overall lack of calm, sweet, intimate grounding as
    a couple, and ultimately, our lack of connection to our authentic Self.
    If he’s really into you now, then he would definitely be asking for your number, so don’t worry.
    People with an addiction cannot stop their behavior,
    evewn when faced with severe consequences.

    Comment by sex spa shelton ct — October 24, 2015 @ 10:53 am

  44. The reality is that has technology advances the ability of pirates to copy and share data becomes easier.
    Make Friends, Not Noise – As youu explore social marketing opportunities across
    the web, be sensitive to the rules and regulations posted on various websites.
    com (install the widget on your WordPress blog), and Blog – Catalog.
    To take advantage of this new method of building business you need to know
    what steps to perform. Jones Adamms is a freelance writer and a college student.

    Comment by ScaleSocial discount — November 4, 2015 @ 5:17 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: