flavio.donze
flavio.donze

Reputation: 8100

Using SLF4J, is it possible to act on errors/warnings?

I have a java OSGi server application and would like to abort the boot process if an error or warning happens/happened.

If some warnings should not abort the process I could set the logger to error:

<logger name="LOGGER"><level value="error"/></logger>

Maybe there is a listener or API to scan existing log entries?

I think I could implement my own appender but maybe there is an easier/cleaner way?

Upvotes: 2

Views: 628

Answers (1)

Andrew Lygin
Andrew Lygin

Reputation: 6197

Since you're using Logback, you can implement a TurboFilter that analyses all the log events and does whatever you want when a message of a particular level is emitted. You can find details in the docs on TurboFilters.

Upvotes: 1

Related Questions