は私がとthisを見て、私のrun(Configuration configuration, Environment environment)
方法でこのラインDropwizardジャージーのロギング要求/応答がERRORとして表示されますが、なぜですか?
environment.jersey().register(new LoggingFeature(Logger
.getLogger(LoggingFeature.class.getName()), Level.OFF,
LoggingFeature.Verbosity.PAYLOAD_TEXT, null));
追加した
私だけLevel
がOFF
に設定され、すべての私の要求/応答メッセージがある場合、ログにものを取得していますERRORとして記録されますが、なぜERRORですか?
ERROR [11:17:41.603] [dw-31 - GET /helloworld] o.g.j.l.LoggingFeature - 1
* Server has received a request on thread dw-31 - GET /helloworld
1 > GET http://localhost:8080/helloworld
1 > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
1 > Accept-Encoding: gzip, deflate, sdch, br
1 > Accept-Language: en-US,en;q=0.8
1 > Cache-Control: max-age=0
1 > Connection: keep-alive
1 > Cookie: openid_provider=openid; _ga=GA1.1.1009619719.1483436711
1 > Host: localhost:8080
1 > Upgrade-Insecure-Requests: 1
1 > User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
ERROR [11:17:41.615] [dw-31 - GET /helloworld] o.g.j.l.LoggingFeature - 1 * Server responded with a response on thread dw-31 - GET /helloworld
1 < 200
マイリソースクラス:
@Path("/helloworld")
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldResource {
public HelloWorldResource() { }
@GET
public Response helloWorld(){
System.out.println("Hello World");
return Response.ok().build();
}
}
私の主なアプリケーションクラス:
ここは、ログの一例である
public class ApiApplication extends Application<ApiConfiguration>{
public static void main(String[] args) throws Exception{
new ApiApplication().run(args);
}
@Override
public void initialize(Bootstrap<ApiConfiguration> bootstrap) {
// nothing to do yet
}
@Override
public void run(ApiConfiguration apiConfiguration, Environment environment) throws Exception {
final TemplateHealthCheck healthCheck =
new TemplateHealthCheck(apiConfiguration.getTemplate());
environment.healthChecks().register("template", healthCheck);
final HelloWorldResource helloWorldResource = new HelloWorldResource();
final JerseyEnvironment jerseyEnvironment = environment.jersey();
jerseyEnvironment.register(helloWorldResource);
jerseyEnvironment.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.OFF, LoggingFeature.Verbosity.PAYLOAD_ANY, Integer.MAX_VALUE));
}
}
ありがとうございました。私の頭には「OFF」に設定するとログが生成され、「ALL」に設定すると何も生成されませんでした。 「FINE」を試してみるのは私には起こりませんでした。特定のリクエストが特定のユーザーから呼び出されたときにログを取る方法を理解しようとしています。しかし、説明のためにたくさんありがとう@nullpointer – TheLearner
@ TheLearner私はこれが現在どこに属しているかわからない。しかし、これは関係するライブラリのいずれかに予期しない動作(バグ)として発生するはずです。 – nullpointer
私はそれをできるだけ早く報告する – TheLearner