logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gallagher, Ron" <RG7...@att.com>
Subject RE: Unable to call doRender. Am I missing anything?
Date Fri, 01 Jun 2007 15:15:10 GMT
Naider --

The purpose of Renderers is to generate a String representation of an
Object. Since a String is already a String, there's no need to do any
additional rendering.

The getRenderedMessage method in the LoggingEvent is what is responsible
for calling any defined renderers.  This method has an explicit check
for situations where the object that's about be rendered is an instance
of String.  In that case, the Object to render is simply cast into a
String and used as-is.


Ron Gallagher, AT&T Mobility


-----Original Message-----
From: Naider Chen [mailto:naider2@yahoo.com] 
Sent: Thursday, May 31, 2007 5:26 PM
To: Log4J Users List
Subject: Unable to call doRender. Am I missing anything?

I'm trying to intercept the logging message to filter
some keyword before forwarding to the destination.  I
tested it in a windows environment using RAD6 

I add the new <renderer> tag entry to log4j.xml and
put both log4j.dtd and log4j.xml in the
WEB-INF/classes folder but after I re-compile and
bounce the server the doRender method was never get
called.  

Am I missing snything?  Please help.  Thanks.

<renderer renderedClass="java.lang.String"
renderingClass="test.log4j.LogCatcher"/>

I create a new class test.log4j.LogCatcher as follows:

package test.log4j;
import org.apache.log4j.*;
import org.apache.log4j.spi.*;
import org.apache.log4j.or.ObjectRenderer;

public class LogCatcher implements ObjectRenderer {

	public String doRender(Object arg0) {
		String st = arg0.toString();
		System.out.println("LogCatcher doRender **********
log string catched = *" + st + "*");
		return st;
	}
}

ALWAYS THERE FOR YOU!!!
Naider Chen
EMAIL ME ANYTIME!!!!




       
________________________________________________________________________
____________
Choose the right car based on your needs.  Check out Yahoo! Autos new
Car Finder tool.
http://autos.yahoo.com/carfinder/

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