登录常见工件 [英] Logging in common artifact

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

问题描述

我正在创建一个通用工件,可以将其导入公司中的不同项目中.我的代码中有一些调试日志记录语句(log4j).

I am creating a common artifact that can be imported into different projects in my company. I have some debug logging statements (log4j) in my code.

我的问题是我是否应该在jar中包含log4j dtd和xml,以及我需要在xml中进行哪些设置?我希望仅在父项目启用了调试级别的情况下显示调试消息,并且这些消息应放入该项目中配置的日志文件中.

My question is whether I should include a log4j dtd and xml in my jar, and what setting I need to have in the xml? I want the debug messages to be displayed only if the parent project enabled debug level, and the messages should go into the log file configured in that project.

谢谢.

推荐答案

我会使用 Simple Logging Facade这样的包装器Java 或我的工件中的公用日志记录,然后让集成商决定使用哪种日志记录工具以及如何配置.

I'd use a wrapper like Simple Logging Facade for Java or Commons Logging in my artifact and let the integrator decide which logging tool to use and how to configure it.

这篇关于登录常见工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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