This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    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
 
jQuery in Action, 2nd edition
 
subject: Sun's Logger to log message in App Server log (SystemOut.log in WAS)