logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Beth Hechanova" <bhechan...@imsconsultants.com>
Subject log two different messages to two different files
Date Tue, 11 Dec 2007 02:10:00 GMT


I have the concept of a long error message and a short error message in
my application.  Long error messages get written to one file, and the
short messages get written to a different file.  Ideally in my
application everywhere that needs to log an error message can simply
call Logger.getLogger(this.getClass().getName()).error(longMessage,
shortMessage) and the configuration of log4j will send the longMessage
and shortMessage to the appropriate file.


I have two different appenders configured for writing to the two
different files in the appropriate format.  But I don't know how to get
the long error message written only to one of the log files, and the
short error message only written to a different log file.


Is there a way to configure the properties file to accomplish this?  

Or would I need to extend the behavior in log4j itself?  If so, where
would be the place to extend the behavior?




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message