Redirecting SLF4J log to TextArea in JavaFX

前端 未结 2 615
孤街浪徒
孤街浪徒 2021-02-10 04:10

I would like to show errors logged by SLF4J in TextArea in JavaFX. What I have so far is an appender in logback-test.xml:

<         


        
2条回答
  •  情书的邮戳
    2021-02-10 05:11

    You could configure Logback to write to System.out and System.err.

    Configure those streams (setOut, setErr) in your application to write to the textarea.

    This solution should work with any SLF4J binding without code changes.

    Basically you would implement a read-only JavaFX console.

    Also have a look at the following answer: https://stackoverflow.com/a/9219837/506855

提交回复
热议问题