Log4j2 and Wildfly 26

429 views
Skip to first unread message

Michael Garcia

unread,
May 5, 2024, 10:14:36 AM5/5/24
to WildFly
Hi,

I can't seem to get Wildfly 26 to use my log4j2 context factory.  I see this message w/some debug turned on.

2024_05_04 19:04:14,547 ERROR [stderr] (MSC service thread 1-1) WARN StatusLogger Multiple logging implementations found:
2024_05_04 19:04:14,549 ERROR [stderr] (MSC service thread 1-1) Factory: org.apache.logging.log4j.core.impl.Log4jContextFactory, Weighting: 10
2024_05_04 19:04:14,558 ERROR [stderr] (MSC service thread 1-1) Factory: org.jboss.logmanager.log4j.JBossLoggerContextFactory, Weighting: 500
2024_05_04 19:04:14,593 ERROR [stderr] (MSC service thread 1-1) Using factory: org.jboss.logmanager.log4j.JBossLoggerContextFactory

I'm assuming this is why my log4j2 configuration isn't loaded the log file created.  It's using the JBossLoggerContextFactory.  How would I tell Wildfly to use the Apache log4j factory?  I can't find where I would do that or at least change the Weighting.

Thanks,
-Mike

James Perkins

unread,
May 6, 2024, 11:40:28 PM5/6/24
to WildFly
If you want to use log4j-core as the log manager instead of using the WildFly logging subsystem, see https://docs.wildfly.org/26/Admin_Guide.html#how-do-i-log4j2.

Michael Garcia

unread,
May 11, 2024, 1:07:24 PM5/11/24
to WildFly
Thanks, that definitely helped get the correct factory.  Now I get 'Invalid URI file://E:/<pathToDeploy>/jboss/autodeploy/DefaultWebApp/log4j/log4j2.xml'  I'm setting this as a command line parameter using 
-Dlog4j.configurationFile=file://E:/<pathToDeploy>/jboss/autodeploy/DefaultWebApp/log4j/log4j2.xml

James Perkins

unread,
May 13, 2024, 11:16:55 AM5/13/24
to WildFly
Is that file part of an exploded deployment or just a simple directory with configuration files? I'm just wondering if the file exists at the time of log4j initializing.

Other than that, I'm not too sure what the issue could be. One guess, as I'm not a Windows expert, should the path be something like "file:/E:/<pathToDeploy>/jboss/autodeploy/DefaultWebApp/log4j/log4j2.xm"? Note I'm getting this idea from https://learn.microsoft.com/en-us/windows/win32/search/url-formatting-requirements#url-formats-in-use.

Reply all
Reply to author
Forward
0 new messages