can not get grizzly logging to work, nothing writt

2019-06-26 22:17发布

问题:

I have a simple Java/Spring program using a standard log4j.properties file to control logging, which is working fine. When we added Grizzly via:

GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig)

things work (i.e. the server in fact serves...but I get no log output.

I have an explicit entry in log4j.properties for "org.glassfish.grizzly".

I've gone so far as to debug into Grizzly's ExtendedLogger class and can see that its getting close to logging but then doesn't.

回答1:

Turns out Grizzly uses its own logging based on java.util.logging rather than than log4j or slf4j which means you need a separate logging configuration file. A good description of using that is at: http://www.javapractices.com/topic/TopicAction.do?Id=143