Suppose I have two Spring-Boot applications called config and eureka.
config is made up of:
config
/src/main
/java
/com.example
Demo.java
/resources
application.properties
eureka is made up of:
eureka
/src/main
/java
/com.example
Demo.java
/resources
application.properties
I have a log4j.properties files
log4j.rootLogger=INFO, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{yyyy:MM:dd HH:mm:ss.SSS}] - %p [%t] --- %c : %m%n
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=log.out
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%d{yyyy:MM:dd HH:mm:ss.SSS}] - %p [%t] --- %c : %m%n
One way to log both config and eureka is by keeping a copy of this properties file in resources folder of both applications and giving a common path for the log file in both. I have tried this and this works correctly.
I want to do something different. I want to maintain a single log4j.properties file instead of two for both applications. My question is what is the proper way to do this? How?