This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sun Watch "Sun New topic
Author

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.addHandler(c1);
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
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3712
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sun's Logger to log message in App Server log (SystemOut.log in WAS)