简体   繁体   中英

Multiple log4j.xml in a jar files

I am developing a client api where I have a specific requirement to log the client api specific log messages to a separate file and it is pretty straight forward: I created an appender and associated the appender with logger which is specific to my package.

Now the question is:

What happens if the client application has its own log4j.xml? How will my appender and logger work in that environment ?

The log4j initialization process only handles one configuration file - thus this file should contain all logging configuration that should be active. You probably have to define a specific configuration for the client application that contains your and the client applications logging configuration.

The client application has to be configured to use this file for the initialization. This is done by setting the log4j.configuration system property as described in the log4j manual (suppose that you are using log4j 1).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM