https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration
Here is my use case, I want output logs to ELK in production, so I add extra log4j2-kafka-appender.xml
beside log4j2.xml
.
I need merge two files without composite configuration supports, which will make configuration redundant.
logging:
config: classpath:log4j2.xml
---
spring:
config.activate.on-profile: prod
logging:
config: classpath:log4j2.xml,classpath:log4j2-kafka-appender.xml
Comment From: wilkinsona
Thanks for the suggestion. Supporting a comma-separated list and turning that into a CompositeConfiguration
looks pretty straightforward. One thing that I'm not completely sure about is having logging.config
(which is logging system agnostic) support a Log4j2-specific feature. I think it's ok as it's passed into the various logging systems as a string that they can then interpret as needed, but I'd like to see what the rest of the team thinks.
Comment From: snicoll
I am not keen to see such loose use of a property that's logging system agnostic. It's tricky because creating a specific property will create another set of issues.
Comment From: philwebb
We could support a logging.log4j2.config.override
property that could be a List
of additional configs. This mirrors the override
property discussed in the "Composite Configuration" section of the manual.
Comment From: GayathiriRuthraiyah
I will be working on this issue
Comment From: rgoers
I just saw this issue as I noticed the change in the latest source code.
I should point out that Log4j already provided support for this in its log4j-spring-boot module. In addition, the support that was implemented here doesn't support http(s) connections that require authentication which log4j-spring-boot does. I'd be more than happy to be able to remove log4j-spring-boot once Spring Boot provides the equivalent functionality.