Shajitha Begum K
Shajitha Begum K

Reputation: 67

log4j2.xml is not getting called in Docker container

I am using java maven web application, i have added log4j2.xml file to the classpath in STS manually then the logging is working fine.

But i am deploying the war file to ECS docker container, there except ERROR logs which is default nothing is getting printed in the log console.

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout
                pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
        </Console>
    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="Console" />
        </Root>
    </Loggers>
</Configuration>

Any help would be appreciated!

Thanks.

Upvotes: 1

Views: 2269

Answers (1)

Shajitha Begum K
Shajitha Begum K

Reputation: 67

log4j2.xml should be under src/main/resources folder. Before i didn't have this folder instead i was using src/main/java.

I have added the below listing in pom file which resolved the issue.

<resources>
            <resource>
                <directory>src/main/java</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
</resources>

Upvotes: 2

Related Questions