You're right - the new LoggingEvent constructors (part of log4j 1.3) will 
facilitate changing the logging message - log4j 1.2.x can't modify the logging 
event message without registering a renderer (can't help you with that one, 
I've never done it).

You could still use a filter with log4j 1.2.x to get what you need, by using 
MDC.put in the filter.  PropertyFilter is an example filter that provides this 
functionality (but for log4j 1.3):

http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/filter/PropertyFilter.java?rev=1.1&view=markup

Scott


-----Original Message-----
From:   Schuweiler, Joel J. [mailto:[EMAIL PROTECTED]
Sent:   Wed 6/22/2005 1:08 PM
To:     'Log4J Users List'
Cc:     
Subject:        RE: Log4j.properties questions with ConversionPattern and 
Appender
Well this was indeed an interesting idea however there are absolutely no set 
methods for the type LoggingEvent. I'm interested in how this filter was ever 
used. 

-----Original Message-----
From: Scott Deboy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 22, 2005 2:26 PM
To: Log4J Users List
Subject: RE: Log4j.properties questions with ConversionPattern and Appender

SocketAppender doesn't use a layout - it sends a serialized logging event.

You can write your own filter to modify the renderedMessage.

I've included a link to the new MapFilter to show how it modifies the rendered 
message of an event if one of the keys in the map is 'message':

http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/filter/MapFilter.java?rev=1.1&view=markup

(To use filters, you need to use an xml config file, not a properties file).

Scott

-----Original Message-----
From:   Schuweiler, Joel J. [mailto:[EMAIL PROTECTED]
Sent:   Wed 6/22/2005 8:30 AM
To:     '[email protected]'
Cc:     
Subject:        Log4j.properties questions with ConversionPattern and Appender
Below is my log4j.properties file

log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.net.SocketAppender
log4j.appender.dest1.RemoteHost=logsrv02
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=[Joels project] - %-4r [%t] %-5p 
%c %x - %m%n

First of all it seems as if I can't get the socket appender to actually 
connect. I do use a fqdn but I have removed it from this paste. 

My second issue is regarding my conversion pattern or perhaps a better way to 
do what I am trying for. I am looking for an easy way to handle logging from 
multiple applications all sending data back to a server socket. I am looking 
for an easy way for people to send their project name so the file can quickly 
be split up into appropriate log files for each project.

thanks

Joel Schuweiler
Middleware
[EMAIL PROTECTED]
Tel: 8-7900





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to