Log4J Swing Appender [英] Log4J Swing Appender

查看:174
本文介绍了Log4J Swing Appender的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将log4j内容附加到Swing组件(JTextArea或类似的)。有没有一种常用的方法呢?

解决方案

我没有引入外部库,而是编辑了log4j.properties文件包括以下内容:

  log4j.rootCategory = DEBUG,app 
log4j.appender.app = path.to。 class.extending.WriterAppender

然后我使用观察者模式将数据发布到我的GUI的JTextArea中。 / p>

I need to append log4j content to a Swing component (JTextArea or similar). Is there a common way to do this?

解决方案

Instead of introducing an external library, I ended up editing the log4j.properties file to include the following:

log4j.rootCategory=DEBUG, app
log4j.appender.app=path.to.class.extending.WriterAppender

Then I employed an observer pattern to post the data into my GUI's JTextArea.

这篇关于Log4J Swing Appender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆