Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Log4j: Logging Errors(No appenders could be found for logger)

843804Dec 3 2004 — edited Oct 17 2008
hi,

i used logging in my java application. i placed log4j.jar and log4j.xml file paths
given in classpath.

i am getting 2 warning Messages. Those are as follows
Log4j:WARN. No appenders could be found for logger (Myclass.class)
Log4j:WARN. Use Log4j System Properly.

Here is what i done
log4j.xml is external configuration file. I specified Appender and layout
information in this.

Here is log4j.xml content...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="appender" class="org.apache.log4j.FileAppender">
<param name="File" value="C:\LOG\log.txt"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>

<root>
<priority value ="INFO"/>
<appender-ref ref="appender"/>
</root>

</log4j:configuration>

I specified appender and layout in log4j.xml file and placed log4j.xml file in
classpath.

How can i solve this problem?. Please help me.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2008
Added on Dec 3 2004
21 comments
2,444 views