如何从Swing应用程序中的Logback链接日志? [英] How link log from Logback in Swing application?

查看:119
本文介绍了如何从Swing应用程序中的Logback链接日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须向应用程序添加一个面板,此面板将记录应用程序的错误。
我创建了一个扩展AppenderBase的类,我已经配置了xml文件来使用这个类。

I have to add a panel to an application, this panel will log the errors of the application. I have create a class wich extends AppenderBase and i have configure the xml file to use this class.

因此当我在应用程序中记录某些内容时,appender他被叫了。

So when i log somehting in the application, the appender he's called.

但目前我不知道如何将我的appender链接到我的面板。

But at the moment i don't know how to link my appender to my panel.

你能指导我吗?

推荐答案

为此,你必须写自定义 Appender ,请参阅:logback.qos.ch/manual/appenders.html。
然后你需要使用一个组件,如JTextArea来显示 log
然后你必须为你的自定义Appender 和你的<$ c之间的关系写一个程序化配置logback $ C>摇摆成分。请参阅:logback.qos.ch/manual/joran.html

For this you have to write your custom Appender, for this see :logback.qos.ch/manual/appenders.html. Then you need to using a component such as JTextArea for showing log in it. Then you have to write a Programmatic Configuration logback for relation between your custom Appender and your Swing-Component. see :logback.qos.ch/manual/joran.html

这篇关于如何从Swing应用程序中的Logback链接日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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