Hello,

I'm using Log4J combined with Apache commons.logging in my application and 
want to capture everything that is written to System.out to a SWING text 
area component. This means the "flow" would be as follows.

Somewhere in the code there are usual logging statements:

logger.info("foo");

Via commons.logging those statements will be forwarded to a Log4J 
org.apache.log4j.ConsoleAppender which in turn has its target set to 
System.out (so far this is all configured properly an works nice).

Then, the SWING application re-assigns System.out print stream by invoking 
System.setOut(myPrintStream) - "myPrintStream" does nothing more than to 
append to an JTextArea. The result is that nothing will be printed to 
"myPrintStream" by the logging statements.

It seems to me that the re-assignment System.setOut(..) happens just too 
late after Log4J has
configured everything already, i.e., it still writes to the "old" print 
stream that was assigned before. If I'm right then there would be no 
solution to achieve what I want to achieve. Does anybody konws of another 
way to achieve this.

Many thanks,
Thorsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to