As per the documentation, Log4j2 supports creating a composite configuration by passing a list of configuration files in the configurationFile variable:
log4j2.configurationFile: log4j2-local.yaml,log4j2-base.yaml
Spring, on the other end, takes variable logging.config:
logging.config: classpath:log4j2-local.yaml
I'm looking for a way of making log4j2's composite configuration work in Spring Boot, but I haven't succeeded yet. I was not able to find documentation on the subject also.
I have tried the following things so far, to no avail:
- Passing a list of files in logging.config
- Setting the list in log4j2.configurationFile variable within application.yaml
- Setting the list in log4j2.configurationFile variable within a log4j2.component.properties file in the resources folder.
- Passing the list in the LOG4J_CONFIGURATION_FILE environmental variable from the Java command.
Reply in How to use Log4J2 composite configuration with Spring Boot does not work for me. Not sure if that's because they are using XML configuration instead of yaml, but it doesn't.
Can someone give me a pointer? Which is the proper way of doing this in Spring Boot? Or, at least, one way it would work. Thanks in advance.