users@glassfish.java.net

Re: glassfish and logging

From: Kristian Rink <kawazu_at_zimmer428.net>
Date: Thu, 04 Sep 2008 11:33:56 +0200

Hi there;

glassfish_at_javadesktop.org schrieb:
[...]
> I am looking for something similar: I'd like to set up different log
> files for different web applications within the server. I think this
> should not be a big deal: I can do it within Tomcat, so I see no reason
> why I could not use Tocat's logger system.

You are likely to use log4j or something like this in tomcat, aren't you?
This way, configuring per-application log files along with an application
itself seems way more straightforward than it is while using the JDK logging
glassfish is using. From that point of view, you are of course free to use
log4j or something similar for your applications to do the logging. But:


> The point is that I tried to change the Log Handler in the Glassfish
> dashboard and I get an error message.

What exactly did you try? Increase / change log levels? Adding custom loggers?

Point being: Talking about the glassfish administration console, you get a
lot more feature than tomcat possibly offers (online log browser, the
ability to set log levels for packages and classes without messing with
configuration files, log rotation, syslog integration and all that stuff) so
while using glassfish logging, you can leave most of the logging
configuration out of your application.

Drawback of this, of course: You have to go with the way glassfish does its
logging, namely use the JDK logger (or some facade on top of it, like slf4j
or commons-logging) rather than log4j. While using plain log4j, trying to
configure this using the web ui is likely to fail because basically the UI
doesn't know about your application-specific log4j configurations. So far, I
consider this the price to pay for using the "additional comfort" provided
by glassfish logging (I spent quite some time searching, in example, for a
tomcat based online administration console to allow log file viewing...).
Asides that, you might want to have a look at [1] which seems a workaround
to use glassfish with log4j, but so far I never really tried. ;)

Cheers & good luck,
Kristian

[1]http://weblogs.java.net/blog/schaefa/archive/2007/08/to_the_hell_wit_1.html


-- 
Kristian Rink
cell    :  +49 176 2447 2771
business: http://www.planconnect.de
personal: http://pictorial.zimmer428.net
"we command the system. calling all recievers.
we are noisy people for a better living".
(covenant - "monochrome")