logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sireesha.vamar...@exeloncorp.com
Subject RE: Problem with logging separation between webapps and container
Date Wed, 05 Nov 2003 21:45:31 GMT
I moved commons-logging.properties and simpleLog.properties and if you have
a log4j.properites to /WEB-INF/Classes.

May be moving dtds /WEB-INF/dtds may help.  Not sure never worked with Resin
servlet container.

And in the web.xml define:
		<!-- log4j parameters -->
  		<init-param>
      	<param-name>log4j-priority</param-name>
	    <param-value>DEBUG</param-value>
 		</init-param>
    	<init-param>
      	<param-name>log4j-layout</param-name>
      	<param-value>%-5p [%M] %m%n</param-value>
    	</init-param>
		<!-- end log4j parameters -->



-----Original Message-----
From: Stephanie.St-Cyr@astrazeneca.com
[mailto:Stephanie.St-Cyr@astrazeneca.com]
Sent: Wednesday, November 05, 2003 3:19 PM
To: log4j-user@jakarta.apache.org
Subject: Problem with logging separation between webapps and container


I'm using Resin Servlet Container.  I have developed librairies(jar files)
that are shared by many web applications, I have put my libraries jar in the
global classpath of the servlet container.  In those librairies, I'm using
log4j as logging mechanism with an xml configuration file.  Everything was
working fine.

The problem I have is when I used log4j with Struts in a webapp.  There is a
conflict, only the logging from the webapp works.  I understand that this is
a ClassLoader issue as described in the lo4j documentation.

I don't want to configure my libraries logging in each webapp but having
this kind of logging configured at the server level.

To fix the problem, I tried implementing a custom repository selector (taken
from the sandbox by Jacob Kjome) in my webapp so that both hierarchies
worked at the same time without any conflicts.  Even though it's supposed to
fix the problem, the webapp logging overwrites the server appenders.  I have
this warning:

log4j:WARN No appenders could be found for logger (DbController.class).
log4j:WARN Please initialize the log4j system properly.
log4j: Finalizing appender named [CONSOLE].

Any ideas on how to make this work?

thank in advance,


Stephanie St-Cyr 
Software developer
AstraZeneca

here is my two xml configuration files:

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

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
                     debug="true">
                     
   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern" value="%t %d{hh:mm:ss} %c %M %p
line %L -%m%n"/>
        </layout>
   </appender>
    
   <root>
       <level value="DEBUG"/>
       <appender-ref ref="CONSOLE" />
   </root>
   
   <!-- database logger -->
   <logger name="com.codestudio.util.PoolSkimmerThread"  additivity="false">
     <level value="INFO" />
     <appender-ref ref="CONSOLE" />
   </logger>
   <logger name="com.azrdm.util.DbControler"  additivity="false">
     <level value="DEBUG" />
     <appender-ref ref="CONSOLE" />
   </logger>
   
</log4j:configuration>

and the webapp:

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

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
                     debug="true">
    <appender name="X" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern" value="%t %d{hh:mm:ss} %c %M %p
line %L -%m%n"/>
        </layout>
    </appender>
    <logger name="org.apache.commons.validator.ValidatorResources"
additivity="false">
        <level value="WARN"/>
        <appender-ref ref="X"/>
    </logger>
    <logger name="org.apache.struts.validator.ValidatorPlugIn"
additivity="false">
      <level value="WARN"/>
      <appender-ref ref="X"/>
    </logger>
    <logger name="org.apache.struts.util.PropertyMessageResources"
additivity="false">
      <level value="WARN"/>
      <appender-ref ref="X"/>
    </logger>
    
</log4j:configuration>

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


************************************************************************
This e-mail and any of its attachments may contain Exelon Corporation
proprietary information, which is privileged, confidential, or subject 
to copyright belonging to the Exelon Corporation family of Companies. 
This e-mail is intended solely for the use of the individual or entity 
to which it is addressed.  If you are not the intended recipient of this 
e-mail, you are hereby notified that any dissemination, distribution, 
copying, or action taken in relation to the contents of and attachments 
to this e-mail is strictly prohibited and may be unlawful.  If you have 
received this e-mail in error, please notify the sender immediately and 
permanently delete the original and any copy of this e-mail and any 
printout. Thank You.
************************************************************************


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


Mime
View raw message