java - Logback+Swing in small tool -
I need to hack a small device. It should read some files and convert them. Right now for my user who works in IDE, I would like to add a small UI which only shows log output.
Do you know about ready-to-use swingappers for logging in? Or something that redirects System.out to nothing more than a text field with a little UI and a "close" button?
PS: I'm not looking for a series or ara or Lilith. Please want to display the log message in the application, please.
You must write a custom appender such class:
public class MyConsoleAppender AppenderBase & lt; ILoggingEvent & gt; {Private Encoder & lt; ILoggingEvent & gt; Encoder = new echo encoder & lt; ILoggingEvent & gt; (); Private BitReon Output Stream Out = New Bytereanputstream (); Public MyConsoleAppender () {LoggerContext LC = (Logger CONTACTS) LoggerFactory.getILoggerFactory (); SetContext (LC); Start(); Lc.getLogger ("Route") addAppender (this). } @ Override Public Zero Starter () {try {encoder.init (out); } Grip (IOException E) {} Super. Start (); } @ Override Public Zero Attached (ILoggingEvent Event) {try {encoder.doEncode (event); Out.flush (); String line = out.Tratring (); // TODO: Add _ _ line_ in your JTextPane out.reset ()} Catch (IOE EXPRESS E) {}}}
You can change the echo encoder with a pattern timer encoder (See the Mozaging ConsoleApprerer Examples in the lockback example folder).
Encoder Write each event in a byte buffer, which you can remove a string and write it to your JTextPane or JTextArea, or whatever you want.
Comments
Post a Comment