Have you looked into using MDC? In your case each of your small applications just needs to put a MDC value (e.g. IP or hostname). The MDC value can be displayed via the "%X" option in PatternLayout.
Kaufman -----Original Message----- From: Robert Kausch [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 6:44 PM To: [email protected] Subject: Help using a SocketAppender and getting hostname / IP information I have a question regarding using the SocketAppender and a socket server (be it SimpleSocketServer, or some other implementation). In my environment, I have many different (smallish) Java applications, on separate machines, that all use Log4J, and I reconfigured them all to use a SocketAppender. That part's actually pretty easy. The difficult part that I'm running into is that when I'm processing the incoming log event object, I would like to add information about the system from which the log message was generated (such as the hostname, IP address, etc). Ideally, I'd like to extend the PatternFormat class to allow the formatting of these additional fields (instead of simply adding the hostname and IP when the message is received). I've messed around with extending the Logger class, the LoggingEvent class, and several others. My current (and highly undesirable) solution is to actually modify the log4j source so that when a Logger is retrieved, using the built-in java.net <http://java.net> classes, I can automatically grab the information from the host on which the message is being generated, and populate it into a LoggingEvent. Am I completely missing a standardized way of doing this? Any help is greatly appreciated! Thanks! Robert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
