This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes Java in General and the fly likes Sun's Logger to log message in App Server log (SystemOut.log in WAS) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sun Watch "Sun New topic

Sun's Logger to log message in App Server log (SystemOut.log in WAS)

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
How can I log messages in Application Server log (e.g., log message in SystemOut.log in WebSphere App Server) using Logging classes from Sun?

I am using code below:

import java.util.logging.*;

private static ConsoleHandler c1 = new ConsoleHandler();
logger.log(Level.WARNING, "Exception thrown while connecting to LDAP.", e);

ConsoleHandler only logs message in console, not in application log.

What do I need to do to log message in log file of app server?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740

A few thoughts...

- I was under the impression anything that went to the console also goes to one of the log files such as System.out or System.err. I believe there was a bug in a 6.0 version of WAS where log files and console messages became out of sync, so I'd check your patch version. WAS6 requires a lot of patches.

- Use Log4J. It's better and more configurable, although this has nthing to do with your question.

- I believe there's multiple settings in the admin console that can control logging features. Search the admin console for a sub-group "Logging", I don't recall that exact name but it should be part of a server instance.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: Sun's Logger to log message in App Server log (SystemOut.log in WAS)