I’ve looked high and low and there is nothing but vague references and comments, most of them stale.
I have an EAR with two EJB modules and a WAR module. The log4j and slf4j jars are in the EAR’s /lib folder. Each module has a log4j2.xml/.dtd pair in the META-INF folder, except the WAR where it is in WEB-INF/classes. The WAR project also has log4j-web.jar in its /lib folder. Deploying on Wildfly 21. The loggers defined in the WAR’s log4j2.xml file are created because the files are created. The ones from the EJB modules are not. I even went to the point of creating a @Startup/@Singleton class in each of the EJB modules that does this: ConfigurationBuilder<BuiltConfiguration> configBuilder = ConfigurationBuilderFactory.newConfigurationBuilder(); InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/log4j2.xml"); ConfigurationSource configurationSource = new ConfigurationSource(inputStream); configBuilder.setConfigurationSource(configurationSource); loggerContext = Configurator.initialize(configBuilder.build()); loggerContext.initialize(); loggerContext.start(); I can step through the code and it all works. The XML file is read just fine (can send the stream to a string and it is correct). No exception is thrown (from either of the other two modules); but the files are not being opened and nothing written. Each of the 3 xml files have the same at the top, but only the WAR instance is recognized: <properties> <!-- when using file logger --> <property name="maxDays">90</property> <property name="maxFileSize">20 MB</property> <property name="logBaseDir">/logs/app_name</property> <property name="patternStr">%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %l - %msg%n</property> </properties> <Appenders> <Console name="STDOUT" target="SYSTEM_OUT" > <PatternLayout pattern="${patternStr}" /> </Console> <RollingFile name=“APP_NAME_DB" fileName="${logBaseDir}/${hostName}_app_name_db.log" filePattern="${logBaseDir}/rotated/${hostName}_app_name_db.%d{yyyy-MM-dd}-%i.log.gz" > <PatternLayout pattern="${patternStr}" /> <Policies> <OnStartupTriggeringPolicy /> <SizeBasedTriggeringPolicy size="${maxFileSize}" /> <TimeBasedTriggeringPolicy /> </Policies> <DefaultRolloverStrategy max="${maxDays}" /> </RollingFile>