3 Replies Latest reply: May 23, 2007 1:33 PM by 807606 RSS

    log4j - eclipse versus stand alone app

    807606
      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>