I have a play-application that uses logback. Some of the messages logged by one of the libraries are very large and fills my log with unnecessary statements.
What I want to do is log all messages but limit them on a certain size (e.q. 300 characters). Is there any way to do this?
The format modifiers in the link did the trick. To truncate the message you can do it using %.-n
where n
is the maximum length:
<encoder>
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} %-5level %logger{36} - %.-512msg%n</pattern>
</encoder>
This modifier will truncate messages larger than 512 characters and put no padding on the left.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With