Grizzly Standalone Logging

一曲冷凌霜 提交于 2019-11-29 10:45:57

Grizzly uses JDK logging API. Not sure why it doesn't work for you, double check that java.util.logging.config.file property is getting properly resolved.

I've just had to solve the same problem. Here is my initialization code that convinces Grizzly HTTP server to display errors: http://source.apidesign.org/hg/bck2brwsr/rev/18ae4fbcfb87

Logger l = Logger.getLogger("org.glassfish.grizzly.http.server.HttpHandler");
l.setLevel(Level.FINE);
l.setUseParentHandlers(false);
ConsoleHandler ch = new ConsoleHandler();
ch.setLevel(Level.ALL);
l.addHandler(ch);

I am using Grizzly 2.3.3

Check if you can log something with level FINE in your application.

Logger LOG = Logger.getLogger(MyResource.class.getName());
LOG.log(Level.FINE, "a message")

Jersey is using JDK logging and to see its debug output (e.g. in the grizzly console) you have to get the logging configuration right. This configuration file worked for me:

handlers=java.util.logging.ConsoleHandler
.level=FINE
java.util.logging.ConsoleHandler.level=ALL
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!