logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ravindra" <ravin...@btpsoft.com>
Subject RE: multiple apps single log4j.xml
Date Mon, 23 Mar 2009 06:01:03 GMT
Thanks for the reply Jake,

	Let me explain clearly about my configuration. I have placed
log4j.xml file in Tomcat's conf folder and log4j.jar is in lib directory of
Tomcat. And I have another log4j.jar in each of the 3 applications in
webapps.In Tomcat's conf directory servers log4j.properties file is also
there.

	The 4 log files of 3 applications are getting generated but, data is

Logging into only root logger, others is empty. And Tomcat's server logging
is not working.

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Sunday, March 22, 2009 11:55 PM
To: Log4J Users List
Subject: Re: multiple apps single log4j.xml

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





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