Re: java.util.logger
On Sep 27, 6:44 pm, markspace <nos...@nowhere.com> wrote:
On 9/27/2010 6:14 AM, gwoodho...@gmail.com wrote:
For instance, a package named uk.co.graeme.display.DisplayPage is
using 1catalina.org.apache.juli.FileHandler, I have no idea why.
I was going to say the same thing as Daniel. It looks like someone jus=
t
copied the configuration file from the link I sent you verbatim.
Possibly lazy or didn't understand or just forgot to go back and change i=
t.
Hi Mark, Daniel, All
Hopefully you can help me some more with this. I'm still absolutely
clueless. I must be missing something really obvious.
This is my logging.properties file:
-----------
handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler,
4admin.org.apache.juli.FileHandler, 5host-
manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
..handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = D:\\opt\\logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = D:\\opt\\logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = D:\\opt\\logs
3manager.org.apache.juli.FileHandler.prefix = manager.
4admin.org.apache.juli.FileHandler.level = FINE
4admin.org.apache.juli.FileHandler.directory = D:\\opt\\logs
4admin.org.apache.juli.FileHandler.prefix = admin.
5host-manager.org.apache.juli.FileHandler.level = FINE
5host-manager.org.apache.juli.FileHandler.directory = D:\\opt\\logs
5host-manager.org.apache.juli.FileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level =
INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers
= 2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
manager].handlers = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
admin].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
admin].handlers = 4admin.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-
manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-
manager].handlers = 5host-manager.org.apache.juli.FileHandler
--------------------
As you can see, this is pretty much the entire log file as default.
Tomcat is set to use this file with the argument:
-Djava.util.logging.config.file=D:\opt\tomcat\conf\logging.properties
Now, i've re-looked through the documentation and i still have no
understanding whatsoever of why a certain class is logging through one
handler and not another. For instance, this is a class file (Stripped
of company specific names etc):
package uk.co.graeme.layout.element.register;
....
public class RegistrationEmail {
...
private static Logger LOG =
Logger.getLogger(RegistrationEmail.class.getName());
private String evaluate(VelocityEngine ve, VelocityContext
context, String template) {
StringWriter writer = new StringWriter();
try {
ve.evaluate(context, writer, null, template);
} catch (Exception e) {
LOG.log(Level.WARNING, "Unable to merge body of
confirmation email", e);
return template;
}
return writer.toString();
}
...
}
Now, i have no idea where that log is going to end up. I'm actually
assuming it will end up in the catalina.out file controlled by the
1catalina handler, thats only because thats where 90% of our logs go
(and because this class is reached through the path /register which
isn't /manager, /admin/ etc etc.
Hopefully someone can please explain to me, how is it using that
handler rather than any other handler (And given we have no /manager, /
admin portions of the sites, that 10% of the logs go to localhost.out)
Please help because this has been bugging me for months without
actually figuring out whats happeneing.
Graeme Woodhouse