How to set a microservice with a custom Log4j file

Question

How do I set a route built as a microservice to use a different log4j file with a Rolling File Appender?

 

Solution

You can call a new new_log4j.xml file, such as the example attached to this article, using the --logging.config parameter.

 

java -jar microroutetest_0_1.jar --logging.config=/path-to/new_log4j.xml

 

For more information about the Appenders that you can use, check the Apache Logging Services Log4j 2.x page:

https://logging.apache.org/log4j/2.x/manual/appenders.html

Version history
Revision #:
4 of 4
Last update:
‎11-06-2019 06:34 PM
Updated by:
 
Contributors