logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Deboy" <sde...@comotivsystems.com>
Subject RE: Sending logs to a LogPanel
Date Sun, 02 Oct 2005 04:17:16 GMT
It would be great to see someone else use LogPanel, but it's pretty tied to the other pieces
of Chainsaw, which would make it difficult to use in a different app.  If you're interested
in refactoring the code, we gladly accept patches.

You can avoid the use of a socket by using listmodelappender or listappender (both in org.apache.log4j.varia).
 Add the appender programmatically to the logger hierarchy, create the necessary renderer
and you're on your way.

Scott


-----Original Message-----
From: news on behalf of Pierrick Brihaye
Sent: Sat 10/1/2005 9:51 AM
To: log4j-user@logging.apache.org
Subject:  Sending logs to a LogPanel
 
Hi,

Excuse me for this probably basic question, but I can't any valuable 
information, probably because of the API changes.

I have a Swing-based application with this method :

private static void initLog4J() {
   final Properties props = new Properties();
   props.setProperty("log4j.rootCategory", "DEBUG, CONSOLE");
   props.setProperty("log4j.appender.CONSOLE", 
"org.apache.log4j.ConsoleAppender"); 
props.setProperty("log4j.appender.CONSOLE.layout","org.apache.log4j.PatternLayout") 
;
   PropertyConfigurator.configure(props);
}

When debugging, this outputs the logs on my Eclipse console. Fine.

Now, I'd like to redirect these logs to my application's GUI.

As a try, I've evaluated Chainsaw, which is beautifully designed ;-)

private static void initLog4J() {
   final Properties props = new Properties();
   props.setProperty("log4j.rootCategory", "DEBUG, chainsaw");
   props.setProperty("log4j.appender.chainsaw", 
"org.apache.log4j.net.SocketAppender");
   props.setProperty("log4j.appender.chainsaw.RemoteHost", "localhost");
   props.setProperty("log4j.appender.chainsaw.Port","4445");
   props.setProperty("org.apache.log4j.spi.location","true");
   PropertyConfigurator.configure(props);
}

No problem. It's exactly what I want.

Now, I'd like to have a chainsaw-like GUI in my app.

Unfortunately, in version 1.2.13, MyTableModel is package protected so 
that I can't se it without rewriting it.

Thus, I've switched to version 1.3-alpha6 where there is a nicely 
designed LogPanel.

Now, the question is : how to send the logs to my LogPanel instance ?

Cheers,

p.b.


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