I would like to know if it is possible to write the logs to another target if the message that we want to write begins with certain words, a prefix.
I can't do it at the class level right now, that's why I'm checking if it's possible to get what I want in an easier way than modifying the code
Yes, this is possible.
It could be configured like this:
<logger name="*" writeTo="target-only-if-message-has-prefix">
<filters defaultAction='Ignore'>
<when condition="starts-with('${message}', 'MyPrefix')" action="Log" />
</filters>
</logger>
See
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