I'm using Log4j - 2.22.1. version and wildfly- 31.0.1.Final Loggers are printing in local But, while deploying it on openshift the loggers are not printing after the ear is deployed and i checked the logs that printed before deployment and i found a error like this
ERROR [stderr] (MSC service thread 1-3) ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
this are the dependencies using
implementation 'org.apache.logging.log4j:log4j-core:2.22.1'
implementation 'org.apache.logging.log4j:log4j-api:2.22.1'
Tried Adding this Dependency to the lib but didn't worked
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.21.1'
Tried adding log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n"/>
</Console> <File name="File" fileName="logs/app.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n"/>
</File>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
<Logger name="org.jboss" level="info" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Logger>
</Loggers>
</Configuration>
and excluded wildfly logging subsystem in jboss-deployment but didn't worked
<exclude-subsystems>
<subsystem name="logging"/>
</exclude-subsystems>
Upgrade from log4j2 to slf4j-2.x fixed the issue