jQuery in Action, 3rd edition
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
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: 3740
    
  10

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Sun's Logger to log message in App Server log (SystemOut.log in WAS)
 
jQuery in Action, 3rd edition