commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chopra, Sumeet (Cognizant)" <CSum...@cal.cognizant.com>
Subject HI
Date Thu, 08 May 2003 16:14:12 GMT
HI,

I am using commons-logging and Log4J .
I am using them on WebLogic 8.1b.

I have kept the commons-logging.properties file
in /WEB-INF/classes with this text
************************************************************************************************
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
************************************************************************************************

and I have also placed LoggingConfigurationFile.xml for Log4J
which has the following contents.

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

  <log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/">

	<appender name="A1" class="org.apache.log4j.FileAppender">
            <param name="File"   value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/SimpleLog.log"
/>
            <param name="Append" value="true" />	    	
            <layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="%d{DATE} %-6r %-5p %30.30c %x - %m\n" />
            </layout>	    
	</appender>
	<appender name="A2" class="org.apache.log4j.FileAppender">
		<param name="File"   value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/AuditTrail.log"
/>
		<param name="Append" value="true" />	    	
	        <layout class="org.apache.log4j.PatternLayout">
		  <param name="ConversionPattern" value="%d{DATE} %-6r %-5p %30.30c %x - %m\n"/>
	        </layout>	    
	</appender>
	
	
	<category name="checkFree">
	    <priority value="debug" />
	    <appender-ref ref="A1" />
	</category>
	
	<category name="checkFree">
	    <priority value="debug" />
	    <appender-ref ref="A2" />
	</category>
	
	
	<root>
	    <!-- The following level element is not necessary since the -->
	    <!-- level of the root level is set to DEBUG by default.    -->
	    <level value ="INFO"/>
	    <appender-ref ref="A1" />
	    <appender-ref ref="A2" />
	</root>
  </log4j:configuration>
*******************************************************************************************************************************************

and I am calling log method from a class MyApp which is as :

*****************************************************************************************
package checkFree;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.*;


public class MyApp {

    private  static Log log = LogFactory.getLog(MyApp.class);;
    public void toPrint()
    {
       try
       {
		   //log = LogFactory.getLog("checkFree.MyApp");

		   log.fatal("This is  fatal mesage from MyApp");
	   }
	   catch(LogConfigurationException lce)
	   {
		   lce.printStackTrace();
	   }
     }
 }

*****************************************************************************************

toPrint() method is called from a JSP file after instaitating MyApp.

But I am getting this error.

##############################################

log4j:WARN No appenders could be found for logger (checkFree.MyApp).
log4j:WARN Please initialize the log4j system properly.

Can someone please tell me where I am going wrong ?


Thanks in advance.

Thanks and Regards,
Sumeet Chopra.



Mime
View raw message