Using below logback.xml :
<Configuration status="INFO">
    <Appenders>
        <appender name="log1" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>log1.log</file>
            <append>true</append>
        </appender>
        <appender name="log2" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>log2.log</file>
            <append>true</append>
        </appender>
        <logger name="logger1" level="INFO" additivity="true">
            <appender-ref ref="log1"/>
        </logger>
        <logger name="logger2" level="INFO" additivity="true">
            <appender-ref ref="log2"/>
        </logger>
    </Appenders>
    <root level="info">
        <appender-ref ref="logger1"/>
        <appender-ref ref="logger2"/>
    </root>
</Configuration>
with dependencies :
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.2.10</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.32</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.32</version>
</dependency>
I'm attempting to log message to two different files using code :
Logger log1 = LoggerFactory.getLogger("logger1");
Logger log2 = LoggerFactory.getLogger("logger2");
log1.info("test1");
log2.info("test2");
But the files, log1.log and log2.log are not being created.
Here is the console output :
[as-akka.actor.default-dispatcher-3] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
[main] INFO logger1 - test1
[main] INFO logger2 - test2
I'm unsure why the message [as-akka.actor.default-dispatcher-3] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started is being printed, perhaps because as I'm using Akka in the project ?
Have I setup logback.xml correctly to enable logging to two separate log files ?
I have reviewed question Logback to log different messages to two files and it does not answer this question as the configuration differs in this question.