나는 this 및 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));
}
}
덕분에 도움이되었습니다. 로그가 "꺼짐"으로 설정되었을 때 로그가 생성되었지만 "모두"로 설정되면 아무 것도 생성되지 않았 음을 알 수 없었습니다. 'FINE'을 시험해 본 것은 나에게는 일어나지 않았다. 특정 사용자가 특정 요청을 호출 할 때 로그하는 방법을 파악하려고합니다. 그러나 설명에 많은 감사를드립니다. @nullpointer – TheLearner
@ TheLearner 저는 이것이 현재 어디에 속해 있는지 잘 모르겠습니다. 그러나 이것은 관련된 라이브러리 중 하나에 예기치 않은 동작 (버그)으로 제기되어야합니다. – nullpointer
나는 그것이 가능한 빨리보고 할 것이다. – TheLearner