Skip to content
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

This use of Logger.debug(...) might be used to include CRLF characters into log messages. #195

Closed
AoifeWhy2 opened this issue Aug 30, 2023 · 1 comment

Comments

@AoifeWhy2
Copy link

My project using logback as log manager. When I use findbugs to test my project, I got this warning: 'This use of Logger.debug(...) might be used to include CRLF characters into log messages.'
And findbugs give me some suggestions to avoid this warning

I choose second suggestion, I changed my logback configration file. But it did not work. Waning still there, I just wonder why?

The second suggestion findbugs gives me:

You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack
<pattern>%-5level - %replace(%msg){"[\r\n]"},"}%n</pattern>

logback.yml I changed before:

    console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) [%cyan(%logger{32})] : %msg"

After I changed:

    console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) [%cyan(%logger{32})] : %replace(%msg){\"[\r|\n]\",\"#\"}%n"
@allentiak
Copy link

allentiak commented Oct 9, 2023

@AoifeWhy2 Please read #161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants