How can I create a Log4j 2 application related to jTextPane?

I'm currently trying to Log4j 2access JTextPane. It should act as STDERR or STDOUT in the Netbeans IDE console (including text style - color).

I know that I need to create an application and associate it with JTextPane, but I do not know how to do it with Log4j 2.

Do you have any suggestions?

I appreciate your help, Marty

+5
source share
1 answer

I did this for a magazine (plain text only). The main things you need to do:

  • Deploy your own Appender to receive log events. Log4j 2 provides AbstractAppender, which will give you basic functions.
  • Layout ( Document, JTextPane.
  • Document JTextPane.

:

  • , , JTextArea.
  • , Document. , X%, Document.remove, .
  • , , , , /. 3 . , , Document.insertString , .

. Log4j 2, . , " " Java , Swing. , .

+2
source

All Articles