-
1. Re: Why is System.out going to a file appender?
peterj Oct 11, 2010 6:03 PM (in response to forumer)JBoss AS captures output to stdout and sterr and redirects it to Log4J as INFO and ERROR log messages, respectively. One reason why this is done is because Java EE applications are not supposed to be writing to the file system.
I'm not sure how, or if, this has changed in AS 6.
-
2. Re: Why is System.out going to a file appender?
forumer Oct 11, 2010 7:30 PM (in response to peterj)For completeness, which appenders are stdout and stderr redirected to as INFO and ERROR?
Thanks!
-
3. Re: Why is System.out going to a file appender?
peterj Oct 11, 2010 8:08 PM (in response to forumer)The simple answer: all of them.
The detailed answer: in Log4J there are two gatekeepers. First, the category settings (the first gatekeeper) determine whether or not a message is to be logged. If the decision is to log the message, then that logged message is sent to every appender (the second gatekeeper) which will then decide if it should output that log message. In both cases, the log level is used as the deciding factor. Text written to stdout and stderr bypasses the first gateway (the assumption is that the text is to be logged), and is handed to each appender. Thus, there is no such thing as "redirecting to an appender", all appenders get equal access to all messages to be logged. This is a fairly simple system, but there are a lot of implications, especially in terms of performance.