wulfgarpro
wulfgarpro

Reputation: 6934

Configure log4j log level using an external configuration file

Is it possible to configure the log4j log level using an external configuration file? Rather than have a user configure the log level in the log4j.properties file, I would like them to configure the log level using a project configuration file.

WulfgarPro

Upvotes: 1

Views: 1714

Answers (1)

somid3
somid3

Reputation: 680

That depends on your build/make tool. For example: in Maven I do just that. In Maven there is "filtering" feature that you can enable. Maven filtering will replace ${some_property} in all your resource files with whatever the value of "some_property" is in Maven.

That is how I change my Log4J properties if I am in dev or prod mode. Other than that, I dont know if Log4J itself has such a feature. I am sure the same is possible via Ant.

Upvotes: 2

Related Questions