如何在我的应用程序中使用 jboss-log4j.xml
可以使用 jboss-log4j.xml 作为我的应用程序的配置文件吗? 我只想让我的应用程序登录到与 Jboss 服务器(控制台和文件)相同的位置...
It is possible to use jboss-log4j.xml as configuration file for my application ?
I just want my application to log in the same place as Jboss server(console and file)...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想使用与 JBoss 相同的日志记录规则,那么您可以从应用程序引用现有的 jboss-log4j.xml 文件。否则,您可以将相关输出部分复制到特定于您的应用程序的单独文件中。我会推荐第二种方法。
If you want to use all the same logging rules as JBoss then you can reference your existing jboss-log4j.xml file from your app. Otherwise, you could just copy the relevant output sections into a separate file specific to your app. I would recommend the 2nd approach.
JBoss 对每个应用程序使用单个全局 log4j 配置。您的应用对 log4j 进行的任何调用都将通过
jboss-log4j.xml
中的配置进行路由。您应该随意修改该文件以适合您的应用程序 - 它决定哪些记录器使用哪些文件。默认情况下,您的应用程序日志将转到与 JBoss 本身日志相同的文件。
JBoss uses a single global log4j configuration for every application. Any calls your app makes to log4j will be routed via the config in
jboss-log4j.xml
. You should feel free to modify that file to suit your application(s) - it determines which loggers use which files.By default, your application(s) logs will will go to the same file(s) as JBoss itself logs to.