I have a Swing-based application without a console that logs all messages to text files through slf4j with logback underneath.
Whenever a message is logged, I'd also like to add it to a JTextArea
for the end user to see on the screen.
These messages should be formatted the sameway as the log files for consistency.
Does slf4j/logback have API that lets you add a listener for log messages so that I can copy them to JTextArea
?
Logback Appenders are listeners for log messages. Just implement a custom appender that will log
in a JTextArea
.
You can then create, configure and add appenders to loggers programmatically, or using an external config file (logback.xml
)
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