Techiio-author
Started by Chris GillNov 5, 2021

Open
Can I skip/omit a log4j2 configuration File that doesn't exist to fall back to an existing one?

0 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 0 VIEWES SHARE

I am strolling log4j2 logging in a java utility with no longer the maximum flexibility in setup. We have a current log4j2.Xml configuration document within the classpath of our utility that exists within an executable jar. I can modify the jar but no longer what calls it or is outside of it (i don't control the surroundings). I would like to add an optional overriding log4j2 configuration document outside of the jar. While it exists it overrides log4j2.Xml, when it doesn't log4j2.Xml is used. So I introduced this belonging to a log4j2.Aspect. properties file:

log4j.configurationFile=../conf/log4j2-override.xml

When I create this optional document it works perfectly. After I don't create this report, log4j2 prints an error that the report can't be found and then fails to fall back to the present log4j2.Xml record in the classpath. It doesn't seem to matter if I upload the classpath-specific record to the configuration file assets. The configuration file is simply to be had because if I do away with the belongings it uses the configuration from the jar's classpath.

It appears log4j2 has an error looking for the file and prevents the automated configuration collection as opposed to persevering with. Is there besides for me to optionally override the default configuration XML record without requiring or not it's present outdoor the jar if I select now not to? I am hoping to specify this in the jar document rather than requiring how the jar is called to be changed based on the file's life.

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance