Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: No logging (or System.out) when I activate virtual hosts

Vacuum Joe

2007-01-16

Replies:

I found a partial solution (requires Java 6):

I wrote my own class:

class MyLogger {

 public static void log(String message) {
    if(System.console() != null) System.console().printf("consoleLogger: %s\n", message);
 }
}

This has the unique advantage of working, unlike System.out.

It still has the disadvantage that I can't see unchecked exceptions. It is workable, though, because I can put in a series of points:

MyLogger.log("I'm at step 12");
// do something
MyLogger.log("I'm at step 13");


and if it never gets to step 13, I know to put a try { } catch { } block in there and then I can print the exception to console.

But this is all crazy. There must be some more modern way of achieving this: sending log messages (either to console or a file) and logging exceptions (either to a file or console). Is some system of "dump all exceptions to the console" possible in Tomcat?







____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.