Logging in common artifact

2019-08-12 00:14发布

问题:

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.

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.

Thanks.

回答1:

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.



标签: java log4j