[
https://issues.apache.org/jira/browse/LOG4J2-3611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17613052#comment-17613052
]
Ralph Goers commented on LOG4J2-3611:
-------------------------------------
If I understand correctly, you have two LoggerContexts, one for JBoss logging
and one for the application. If you have two LoggerContexts with the same
configuration you are pretty much guaranteed to have a mess as you effectively
have two logging subsystems and neither will know what the other is doing. If
you are running in an app server with only one application and you want all
logs combined then you should not use the default ClassLoaderContextSelector.
See https://logging.apache.org/log4j/2.x/manual/logsep.html. You probably want
to use the BasicContextSelector in that case. However, if you have multiple
applications and want each separate then you simply cannot include the app
server logs with the application logs.
> Log4j2 Writing to the rolled file
> ---------------------------------
>
> Key: LOG4J2-3611
> URL: https://issues.apache.org/jira/browse/LOG4J2-3611
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Configuration, Web/Servlet
> Affects Versions: 2.17.2
> Reporter: Xin Lin
> Priority: Major
>
> I am migrating log4j 1 to log4j2 in a jboss application.
> I added log4j-api & log4j-core & log4j-1.2-api dependencies, I have added
> log4j2.xml and setup proper system config, and then application good to
> start.
> This issue happens when the rolling action triggerred. When the rolled file
> created, I see that some logs written in the new log file, but some logged in
> the rolled file.
> I turned on the TRACE mode, and can see some logs show that Log4j2
> RollingFileManager execute the FileRenameAction. So we have two files
> (app.log & app.log.2022-09-27).
> But some log events went to app.log, some went to app.log.2022-09-27.
> According to the log format, I think the new logs in rolled file is written
> by Log4j2, the log content is like following:
> 05:01:23,150 INFO [stdout] (Log4j2-AsyncAppenderEventDispatcher-2-ASYNC)
> 05:01:23,136 ERROR [xxx.xxx] xxxxxxxxxxxxxxxxxxxx
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)