Hi ,

In my application the log4j.xml file is not getting initialized. The application does not throw any exception or warning , but it does not show the log messages also.

I had checked it by keeping my log4j.xml in both src folder and then in WEB-INF/classes and WEB-INF also.I have also added it in classpath.

The struts application is in sun java application server and I am using netbeans.

Following is web.xml entry

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>log4j-init-file</param-name>
<param-value>/log4j.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>


Following is the log4j entry

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<!-- ================================= -->
<!-- Preserve trace messages in a local file -->
<!-- ================================= -->
<!-- A size based rolling appender -->
<appender name="trace" class="org.apache.log4j.FileAppender">
<param name="file" value="C:/CustomerPortal/trace.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{ISO8601}] %-5p %c %m %n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="TRACE"/>
<param name="LevelMax" value="DEBUG"/>
</filter>
</appender>
<!-- ================================= -->
<!-- Preserve error messages in a local file -->
<!-- ================================= -->
<appender name="error" class="org.apache.log4j.FileAppender">
<param name="file" value="C:/CustomerPortal/error.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{ISO8601}] %-5p %c %m %n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="FATAL"/>
</filter>
</appender>
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="File" value="C:/CustomerPortal/log.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n"/>
</layout>
</appender>
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="com.ntltelewest.cp.util">
<priority value="MY_TRACE" class="com.ntltelewest.cp.util.Appender" />
<appender-ref ref="FILE"/>

</category> <!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<level value="all" />
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="error"/>
<appender-ref ref="trace"/>
</root>
</log4j:configuration>


Plaese suggest what might have gone wrong and how can I make it work .

Thanks in advance..