permaculture playing cards*
The moose likes Other Open Source Projects and the fly likes log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester" Watch "log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester" New topic
Author

log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
I wonder what causes this error message:

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.

but when I do:
log.info(......)
I can see the output on the console, any idea?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
The message means that the log4j.properties file was not found. Printing logging output to the console (or rather System.out) is the fallback if the logging is not otherwise initialized.


Ping & DNS - my free Android networking tools app
Kamal Ahmed
Ranch Hand

Joined: Feb 15, 2005
Posts: 91
This indicates that if you look in your log4j properties file, the Logger is not assigned an appender, here is a sample log4j.properties that works, compare this with the one you have:

log4j.rootLogger=DEBUG, testAppender
log4j.appender.testAppender=com.webmethods.sc.logging.log4j.WmDailyFileAppender
log4j.appender.testAppender.file=log/test1.log
log4j.appender.testAppender.datePattern='.'yyyy-MM-dd_HH_mm
log4j.appender.testAppender.Append=false
log4j.appender.testAppender.layout=com.webmethods.sc.log4j.PatternLayout
log4j.appender.testAppender.layout.ConversionPattern=%m%n

#Prevent internal log4j DEBUG messages from polluting the output.
log4j.logger.org.apache.log4j.PropertyConfigurator=INFO
log4j.logger.org.apache.log4j.config.PropertySetter=INFO
log4j.logger.org.apache.log4j.FileAppender=INFO
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
ok....this is my log4j.properites file:

log4j.rootLogger=ERROR, stdout, runwayAppender
# SqlMap logging configuration...
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n


where exactly should I place it? (I'm still getting the warning)
thanks!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10068
    
163

You will have to place it in the classpath of the application which is using log4j's logger.


[My Blog] [JavaRanch Journal]
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
thanks Jaikiran,

I'm not sure what you meant by:

You will have to place it in the classpath of the application which is using log4j's logger.


I have a struts application, where should I place it? under the web-inf/src?

thanks for any advise
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10068
    
163

In an application that is deployed, you wont be having a WEB-INF/src folder. Instead you will be having a WEB-INF/classes folder. You can place the log4j.properties (or log4j.xml) in this WEB-INF/classes folder of your application.

Also, see if enabling log4j debug flag helps
rajareddy dodda
Greenhorn

Joined: Jun 25, 2008
Posts: 15
is the name of LOg4j.properties file is stanfdard. i tryed with the file name changed by config.properties it is giving me following error. please let me know the standard of the file name, is the name must be log4j.properties ?. thanks in advance.


no appender added.


Thanks
RajaReddy.
shyam sunder prasad
Ranch Hand

Joined: Mar 23, 2011
Posts: 62
i got same Waring in my application.then i placed log4j.xml or log4j.properties file in class path (/WEB-INF/classes/).

i.e , WEB-INF/classes/log4j.xml
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660

Sorry to awaken "dead" threads, however I have encountered a similar problem, and, I am still stuck. I'm using Eclipse 3.6.2.

log4j.properties.


This is placed where the source files (.java files) are located.


Jon
Anita Kulkarni
Greenhorn

Joined: Apr 29, 2011
Posts: 1
I just solved this issue by adding the appender. Seems like you already do have it. Try putting the log4j.prop in WEB-INF/classes dir or into WEB-INF itself.
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660

Anita Kulkarni wrote:I just solved this issue by adding the appender. Seems like you already do have it. Try putting the log4j.prop in WEB-INF/classes dir or into WEB-INF itself.


Thanks, it's a good tip, but I don't run Tomcat here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester