0

suppose we have some jars with properties files with the same key/values.

configA.jar: log4j.A.properties

configB.jar: log4j.B.properties

The problem: Spring mixes values from the both properties files. So, how to exclude log4j.A.properties from the context and process only log4j.B.properties?

UPDATE (added some stuff): there is a maven build which produces two jars mentioned above. Here in webapp (applicationContext.xml) following setup:

<util:properties id="propertyConfigurer" location="classpath:common.properties,classpath*:edrive.properties,classpath*:job.properties,classpath*:log4j.B.properties"/>

After the startup Spring mixes both jars and takes random (or the last one) jar and it's log4j.properties. But we need only the log4j.B.properties. How to do that?

Green Root
  • 644
  • 2
  • 10
  • 28
  • why Spring would consider `log4j.A.properties` or `log4j.B.properties` as property placeholder ? Please give more context to understand what you do. – davidxxx Dec 21 '20 at 22:43
  • I've updated initial post, thanks. – Green Root Dec 22 '20 at 10:02
  • https://stackoverflow.com/q/4113697/6309111 Does this answer your question ? – Dev-vruper Dec 22 '20 at 10:56
  • Unfortunately, no. This answer ideally fits the scenario with single-module maven structure. In my case those two jars with configs build before the actual build is started, so, there is no possibility to exclude both properties files during the final assembly. – Green Root Dec 22 '20 at 12:59

2 Answers2

0

try adding the config file to be used in your properties file

logging.config=log4j.B.properties
vishnu g
  • 99
  • 4
0

I resolved the issue by myself. I've upgraded logging facility to Log4j2 with following configuration:

log4j2.component.properties in classpath:

log4j.configurationFile=classpath:log4j2.web.xml

That's it.

Green Root
  • 644
  • 2
  • 10
  • 28