Skip to Main Content

Java Programming

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 - eclipse versus stand alone app

807606May 23 2007 — edited May 23 2007
Hi Folks, I have a program that runs in eclipse and uses log4j to write to a
log file correctly. But when I run as a stand alone app outside of eclipse
(command line) the log file is not created. Instead logging is written to
the console. I suspect the log4j.xml is not found but it is in my
classpath. Any thoughts? Joe

The Code:
Log log = LogFactory.getLog( DocumentRequestor.class );
log.info("Start of Batch Cylce ");

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

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

<appender name="rollingFileOutput"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="AutomatedFileDelivery.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d - %m%n"/>
</layout>
</appender>

<root>
<priority value ="info" />
<appender-ref ref="rollingFileOutput"/>
</root>

</log4j:configuration>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2007
Added on May 23 2007
3 comments
222 views