users@glassfish.java.net

Re: Server log

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Thu, 07 May 2009 18:24:55 +0200

glassfish_at_javadesktop.org wrote:
> Thanks - I was hoping to fix up the console log since that is what is displayed in Eclipse while we are working in the IDE I take it there is no way to get the log4j messages to the console otherwise? These are not sysout println statements - there are all log4j messages. I take it because of the way MyEclipse is running glassfish they are being flushed to sysout?

Yes, these messages are the result of the ConsoleAppender writing your
log-messages to the System.out stream. See the API here:
http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/ConsoleAppender.html

The best way to deal with this is to have different log4j.properties
files for different environments (development, testing stages,
production). Logging is very time consuming so the file probably has to
be changed to a lower log level anyway.

Another possibility would be a log viewer plugin for Eclipse that kind
of works like "tail -f" on Unix-systems. I think I have read about it
somewhere some time ago. I myself am no Eclipse user so don't nail me if
this info proves to be wrong ;-)

Anyways, should this plugin exist, you could simply attach to the file
that log4j logs to. So there would no longer be any need for a
ConsoleAppender.


--
Wolfram