eclipse-ee4j / eclipse-ee4j/jersey
LoggingFeature not logging correctly based on configuration on constructor
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Running dropwizard 1.0.5 with jersey 2.23.2\. In my application when I register my LoggingFeature in the jersey environment as shown below:
```
**ApiApplication.java**@Override
public void run(ApiConfiguration apiConfiguration, Environment environment) throws Exception {
final HelloWorldResource helloWorldResource = new HelloWorldResource();
final JerseyEnvironment jerseyEnvironment = environment.jersey();
jerseyEnvironment.register(helloWorldResource);
jerseyEnvironment.getResourceConfig().register(MyCustomRequestFilter.class);
jerseyEnvironment.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.ALL, LoggingFeature.Verbosity.PAYLOAD_TEXT, Integer.MAX_VALUE));
}
```
No logs are produced at all but if I register it as below:
```
**ApiApplication.java**jerseyEnvironment.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.OFF, LoggingFeature.Verbosity.PAYLOAD_ANY, Integer.MAX_VALUE));
```
I am getting the follwoing logs produced:
```
ERROR [2017-03-30 08:14:15,580] org.glassfish.jersey.logging.LoggingFeature: 1 * Server has received a request on thread dw-46 - GET /helloworld
1 > GET http://localhost:8080/helloworld 1 > Accept: */*
1 > Accept-Encoding: gzip, deflate
1 > Cache-Control: no-cache
1 > Connection: keep-alive
1 > Host: localhost:8080
1 > Postman-Token: 2f882fdc-f7cc-46ca-9dcc-e456e64d962d
1 > User-Agent: PostmanRuntime/3.0.11-hotfix.2
Hello and welcome to the logging!
Hello World
ERROR [2017-03-30 08:14:15,591] org.glassfish.jersey.logging.LoggingFeature: 1 * Server responded with a response on thread dw-46 - GET /helloworld
1 < 200
```
Now should it not be the other way around, that when I set Level.ALL then I should get logs, and when Level.OFF i set then no logs should be produced? And another thing is that the requests/responses are logged as [ERROR].
#### Affected Versions
[2.23.2]
Contributor guide
Assessment
This issue has not been assessed yet.