The spring data elasticsearch has the direct dependency dependency on the log4j2, and I didn't see any direct dependency on the logback . So I think use log4j2 as default logging framework is better : )

Comment From: stepio

As for me, while switching from log4j (old-school) I've compared both logback and log4j2 and found 1 mandatory case (for me), which is supported in log4j2, but not in logback:

        <Async name="ASYNC">
            <AppenderRef ref="MainToFile"/>
            <AppenderRef ref="ErrorToFile"/>
            <AppenderRef ref="FatalToConsole"/>
        </Async>

I did not find a way to wrap multiple appenders into a single asynchronous appender in logback.

Hi @hantsy

But you can still use slf4j backed with log4j2. Seamless integration is a feature of slf4j, which does not depend on logback. Not sure what is meant by "external logging analyst system", but in log4j2 you can configure the same logging patterns as you use in logback.

Comment From: stepio

@hantsy

I've just added another reason to make log4j2 a default logging implementation for spring-boot. I don't think that "use the same logging as in elastic search" is a really strong reason, but supported this issue as another log4j2 user.

In your comment above you talk about spring-framework, which is a bit irrelevant.

Also I checked your repo, here is logback config: https://github.com/hantsy/spring4-sandbox/blob/master/logging-logback/src/main/resources/logback.xml No solution for the example which I showed, no appender with nested appenders there.

Comment From: wilkinsona

Using Log4j2 instead of Logback should be straightforward. Exclude Logback and depend on Log4j2 instead. Thanks for the suggestion, but I haven't seen any arguments in this issue that justify the breaking change of switching to Log4j2 by default. We'll stick with Logback for now at least.

Comment From: rgoers

Although this issue is closed I am adding this information for users who stumble upon this issue.

Log4j 2.12.0 added support for utilizing Spring Cloud Config to host the Log4j configuration with dynamic reconfiguration and added support for Docker.

With the release of Log4j 2.13.0 Log4j has further integrated with Spring by providing a Spring Lookup so the Log4j configuration can access spring properties. In addition, some Log4j system properties can also be read from Spring's bootstrap.yml or application.yml files. 2.13.0 also provides a Kubernetes Lookup to allow Kubernetes attributes to be specified in the Log4j configuration as properties to include in the log events.

Log4j 2 will continue to try to improve its Spring integration as requested by users.

See Logging in the Cloud and Log4j Spring Cloud Config Client.