There are 2 log4j.properties files in my classpath. I need both of them - One of them is required for a library that I am using and another is the one used by my code. When I run my jar file, it is able to read the properties used by the library, but it is not reading my own properties file. How can I make it read my log4j without having to use PropertytConfigurator in all my source files? Is there any way I can configure it so that it used both the properties files together?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
To answer your first question, you can point it to your own file by giving it a unique name and adding the following system property when you launch your application.
I don't think it is possible to use 2 different files without doing anything programatically.
Two
log4j.properties
files will surely create a mess (as you've experienced).I'd suggest removing the library's version (why is it a requirement?), and combining both
.properties
files into one.All logging goes into a single property file. Within that file you can differentiate between your own classes and the library's logging configuration.