users@glassfish.java.net

Re: Writing to the log file

From: <glassfish_at_javadesktop.org>
Date: Tue, 16 Dec 2008 09:06:09 PST

On the GUI, under the Application Server, there's a logging tab. There you can set the log levels for the internal GF components.

If you want to have your own applications write to the log, you can simply use java.util.logging.

So:

[code]

import java.util.logging.Logger;

private Logger log = Logger.getLogger(YourClass.class.getName());

log.info("My log message.");
[/code]

By default, only WARNING and SEVERE are written to the log. If you want a different log level, you can go to the Logging panel, and at the bottom are Properties.

There you can add:

com.your.package.YourClass and INFO in the second box.

Then your logs will show in the log file and the log viewer.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=321949