-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Cannot change log message via logging filter #27844
Comments
Hm, the |
Yes, it does seem like a odd configuration, but the only one that seem to work, before #27864 gets merged. I am using the above to change some logs level, and also some log parameters, for instance, in the code in the reproducer, I could replace the "test" string parameter with "test2" within the filter, and the log would print test2 fine. Looks like only the setMessage does not work properly. |
|
@geoand To be honest I did expect that outcome as I know I am abusing the filter at the moment. But I would still think it would be nice to have a way to change internal log messages I will explain my 2 use case, maybe it could be raised as an enhancement, without using filter, or maybe there's a way I just do now know, or maybe my case is just unrealistic and just wrong :) . 1- smallrye/smallrye-fault-tolerance#641 2-Using the rest-client reactive, it's a bit hard to log well the headers/body for request and response manualy. The simpler is to use I am really glad this works, maybe until it breaks though, but thats why I think changing the message, could be useful in some case. Thank you. |
Thanks for explaining the use case. I agree that it does seem useful at times, unfortunately |
Hi guys, I really don't want to eat up your time on this. I just want to give a bit more info in case anywone stumbles on the issue. I did look into jboss loggmanager sources, and it looks like modifying the logrecord, within the filter is actually supported, and the logmanager uses it itself in it's own provided JUL Filter like shown here so basically the only thing needed is to manually format the message then use setMessage and it all works. So I think the behaviour is not Thanks. |
Describe the bug
Apologies if this is not a quarkus issue. Sometimes it is hard to distinguish. I am trying to change an internal quarkus' log message via a logging filter. I can change the Log level no problem (oddly JUL uses WARNING and quarkus uses WARN not sure if it's normal), but the changing the message, breaks the formatting.
The JUL
LogRecord::setMessage
api states;Set the "raw" log message, before localization or formatting
. However when I try to update the raw message, formatting does not happen.Expected behavior
Just doing the following in the logging filter breaks the message;
record.setMessage(record.getMessage());
The reproducer just goes through the logging filter for the error log level, here's the output;
Actual behavior
Both messages should be the same
How to Reproduce?
Reproducer: https://github.com/manofthepeace/quarkus-loggingfilter-issue
Steps to reproduce;
1- mvn quarkus:dev
2-both logs will be printed at startup
Output of
uname -a
orver
Darwin Kernel Version 21.6.0
Output of
java -version
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1
GraalVM version (if different from Java)
n/a
Quarkus version or git rev
2.12
Build tool (ie. output of
mvnw --version
orgradlew --version
)maven 3.8.4
Additional information
Changing only the log parameters via
LogRecord::setParameters
does work as expectedThe text was updated successfully, but these errors were encountered: