Skip to content
Advertisement

Log4j2 how to overwrite path in configuration log4j2.xml?

I have to save the logs to the path taken from the database. I know the logs start earlier. For this, in xml I have a path configuration, but I want the path to be overwritten after downloading data from the database.

JavaScript

Log4j2.xml

JavaScript

Advertisement

Answer

Take a look at Programmatic Configuration

My suggestion would have no Log4j2.xml logging, just add a new one for your app logs. Something like:

JavaScript
Advertisement