You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jeff Drew <je...@tradingmetrics.com> on 2005/06/03 03:09:51 UTC

log4j logging draft

I'd appreciate some feedback on whether the following solution sounds good.  I read the log4j book to come up with this solution, but would like to know whether I'm heading for a disaster. 

PROBLEM: I want to add a little status panel to my desktop GUI. Some status messages would be generated locally while others would be transmitted from the server.  These are intended to be low priority, best effort indicators.

SOLUTION: 
Summary: Use log4j LoggingEvents as status messages.  Present LoggingEvents with XML Layout in a Swing JTable, possibly using the Chainsaw interface

1. In the desktop GUI, create  LoggingEvents using a logger and custom appender that:
    - Formats a LoggingEvent into XML, then adds it to a local LinkedList (allows me to maintain sequence and limit size)

for example:
    statusLogger.info("sample status message");   /* would result in a LoggingEvent with the text "sample status message" inserted LinkedList */


2. In the server, create LoggingEvents using the same logger and customer appender class, then transmit them to the desktop using Object Output Stream(been using that for years). The desktop would add the received LoggingEvents to the LinkedList described in #1.

3. Input those LinkedList members to Chainsaw for display

QUESTIONS TO log4j EXPERTS:
A. Is it appropriate to use LoggingEvent as a message as described above? If yes, should it be output from a customer appender? 
B. Would you recommend using the Chainsaw gui or is there some mini-Chainsaw commonly used?

Thanks!

Jeff