-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom access logger never logs requests with 4xx http codes #5979
Comments
I have an authentication decorator, which could block requests and return 4xx http code if authentication failed. I don't know if this is the issue? How do I log every requests regardless of its http codes? |
Hi, I was unable to reproduce missing 400 codes.
|
After further investigation, I found out it's not Armeria's issue. There is a potential NPE when writing access logs. I'll close this. Thanks @jrhee17 |
There is one thing I need to mention: the NPE Exception was not thrown from my |
That is correct. The customized logger shouldn't throw any exception.
The NPE raised because Armeria server doesn't call the |
The NPE was thrown from my |
We may add a warning log if armeria/core/src/main/java/com/linecorp/armeria/server/AbstractHttpResponseHandler.java Lines 232 to 234 in 9a29b39
|
Or, we can probably use |
Either way is fine to me if users can figure out the problem. |
I am not sure if my approach is officially recommended by Armeria. I have customized a log4j2 logger for |
I assumed that you're using the Armeria Spring Actuator integration module. If so, yeah, that's the recommended approach.
|
Yeah, I am using it. My application.yml:
It will be nice if I can use Because something like this is a little bit weird:
|
@rickyma, You can probably do this: final AccessLogWriter writer = AccessLogWriter.common();
serverBuilder.accessLogWriter(log -> {
if (!log.context().path().equals(HEALTH_CHECK_PATH)) {
writer.log(log);
}
}, false); |
Thanks. I'll have a try. Another thing is, why do you set |
armeria/kafka/src/main/java/com/linecorp/armeria/server/logging/kafka/KafkaAccessLogWriter.java Lines 102 to 104 in 5b384fb
|
I add a custom access log writer:
CustomAccessLogWriter:
This is log4j2.xml:
In
access.log
, I found out there are only requests with 2xx / 5xx codes. The 4xx requests are never logged inaccess.log
.What am I missing here?
The text was updated successfully, but these errors were encountered: