logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: multiple apps single log4j.xml
Date Sun, 22 Mar 2009 18:25:04 GMT
On 3/22/2009 5:39 AM, ravindra wrote:
> Hi Everybody,
> 
>  
> 
> I am trying to configure log4j for multiple applications using a single
> log4j.xml.I placed log4j.xml in Tomcat's conf directory and placed a
> log4j.jar in
> 
> Tomcat's lib directory. It is creating the log files, but it is not writing
> to it.
> 

I'm surprised that the log files are being created unless you rigged Tomcat's
startup scripts to include Tomcat's "conf" directory in the classpath.  Log4j has
no way of knowing where log4j.xml is unless it is in a directory (or root of a jar
file) that is in the classpath... or you performed manual configuration.  Are you
sure you haven't deployed another copy of log4j.xml along with one of your jar files?

Jake

>  
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> 
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
> 
>  
> 
>   <!-- ===================================================================
> -->
> 
>   <!--  Appenders
> -->
> 
>   <!-- ===================================================================
> --> 
> 
>   
> 
>    <appender name="APP1" class="org.apache.log4j.RollingFileAppender">
> 
>     <param name="File"
> 
>            value="C:/dtu/logs/APP1.log" />
> 
>     <param name="Append" value="true" />
> 
>     <param name="MaxFileSize" value="10MB" />
> 
>     <param name="MaxBackupIndex" value="10" />
> 
>     <param name="Threshold" value="ALL" />
> 
>  
> 
>     <layout class="org.apache.log4j.PatternLayout">
> 
>             <param name="ConversionPattern" value="%d %-5p [%C{1}.%M:%L]
> %m%n" />
> 
>     </layout>          
> 
>   </appender>
> 
>   
> 
>   <appender name="APP2" class="org.apache.log4j.RollingFileAppender">
> 
>     <param name="File"   value="C:/dtu/logs/APP2.log" />
> 
>     <param name="Append" value="true" />
> 
>     <param name="MaxFileSize" value="10MB" />
> 
>     <param name="MaxBackupIndex" value="10" />
> 
>     <param name="Threshold" value="ALL"/>
> 
>     
> 
>     <layout class="org.apache.log4j.PatternLayout">
> 
>     <param name="ConversionPattern" value="%d %-5p [%t] [%C{1}.%M:%L] %m%n"
> />
> 
>     </layout>
> 
>  
> 
>   </appender>
> 
>   
> 
>   <appender name="APP3" class="org.apache.log4j.RollingFileAppender">
> 
>     <param name="File"   value="C:/dtu/logs/APP3.log" />
> 
>     <param name="Append" value="true" />
> 
>     <param name="MaxFileSize" value="10MB" />
> 
>     <param name="MaxBackupIndex" value="10" />
> 
>     <param name="Threshold" value="ALL"/>
> 
>     
> 
>     <layout class="org.apache.log4j.PatternLayout">
> 
>     <param name="ConversionPattern" value="%d %-5p [%t] [%C{1}.%M:%L] %m%n"
> />
> 
>     </layout>
> 
>  
> 
>   </appender>
> 
>   
> 
>   <appender name="APP4" class="org.apache.log4j.RollingFileAppender">
> 
>     <param name="File"   value="C:/dtu/logs/APP4.log" />
> 
>     <param name="Append" value="true" />
> 
>     <param name="MaxFileSize" value="10MB" />
> 
>     <param name="MaxBackupIndex" value="10" />
> 
>     <param name="Threshold" value="ALL"/>
> 
>     <layout class="org.apache.log4j.PatternLayout">
> 
>     <param name="ConversionPattern" value="%d %-5p [%t] [%C{1}.%M:%L] %m%n"
> />
> 
>     </layout>
> 
>  
> 
>   </appender>
> 
>   
> 
>   
> 
>   <!-- ===================================================================
> -->
> 
>   <!--  Loggers
> -->
> 
>   <!-- ===================================================================
> -->
> 
>  
> 
>   <logger name="com.dtu">
> 
>     <level value="DEBUG"/>
> 
>              <appender-ref ref="APP1"/>
> 
>   </logger>
> 
>  
> 
>    <logger name="com.sms">
> 
>     <level value="DEBUG"/>
> 
>             <appender-ref ref="APP4"/>
> 
>   </logger>
> 
>   
> 
>   
> 
>   <logger name="com.vtu.gsm">
> 
>     <level value="DEBUG"/>
> 
>             <appender-ref ref="APP3"/>
> 
>   </logger>
> 
>  
> 
>    <logger name="com.vtu.gps">
> 
>     <level value="DEBUG"/>
> 
>             <appender-ref ref="APP4"/>
> 
>   </logger>
> 
>   
> 
>   <root>
> 
>     <level value="DEBUG"/>
> 
>     <appender-ref ref="APP1"/>
> 
>   </root>
> 
>   
> 
>   
> 
> </log4j:configuration>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message