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 Pierrick Brihaye <pi...@free.fr> on 2005/10/01 18:51:28 UTC

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