jboss EAP 7中单机配置的双日志输出

问题描述 投票:0回答:1

我们最近已从Jboss EAP 5.1升级到Jboss EAP 7.2。启动我们的应用程序后,我们可以看到每个操作在日志文件server.log中记录了两次。但是,日志输出在控制台输出中是正常的。

2020-05-04 04:41:57,181 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10190
2020-05-04 04:41:57,181 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10190
2020-05-04 04:41:57,181 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 87177ms - Started 2482 of 2655 services (425 services are lazy, passive or on-demand)
2020-05-04 04:41:57,181 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 87177ms - Started 2482 of 2655 services (425 services are lazy, passive or on-demand)

2020-05-04 03:51:26,345 INFO  [nucleusNamespace.atg.dynamo.servlet.dafpipeline.ProfileRequestServlet] (default task-1) [sid : LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl ][pid : 53590070 ][cpoid : 610080 ]This user session is LOGGEDIN
2020-05-04 03:51:26,345 INFO  [nucleusNamespace.atg.dynamo.servlet.dafpipeline.ProfileRequestServlet] (default task-1) [sid : LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl ][pid : 53590070 ][cpoid : 610080 ]This user session is LOGGEDIN
2020-05-04 03:51:26,580 INFO  [nucleusNamespace.delixl.sol.log.LogService] (default task-1) {6022}  [LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl|(null)] 20200504-035126359 43.229.89.35 LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl 53590070 /webshop/catalog/json/profileMarkerJson.jsp 221 200
2020-05-04 03:51:26,580 INFO  [nucleusNamespace.delixl.sol.log.LogService] (default task-1) {6022}  [LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl|(null)] 20200504-035126359 43.229.89.35 LhGndXwn4RWowaUagJIhFZZ5QBLJSGPGgy6V16Pl 53590070 /webshop/catalog/json/profileMarkerJson.jsp 221 200

日志记录配置为默认配置,我们尚未更改。以下是standalone.xml文件中的默认日志配置;

        <subsystem xmlns="urn:jboss:domain:logging:6.0">
            <console-handler name="CONSOLE">
                <level name="INFO"/>
                <formatter>
                    <named-formatter name="COLOR-PATTERN"/>
                </formatter>
            </console-handler>
            <periodic-rotating-file-handler name="FILE" autoflush="true">
                <formatter>
                    <named-formatter name="PATTERN"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>
            </periodic-rotating-file-handler>
            <logger category="io.undertow.request">
                <level name="ERROR"/>
            </logger>
            <logger category="com.arjuna">
                <level name="WARN"/>
            </logger>
            <logger category="org.jboss.as.config">
                <level name="DEBUG"/>
            </logger>
            <logger category="sun.rmi">
                <level name="WARN"/>
            </logger>
            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="FILE"/>
                    <handler name="CONSOLE"/>
                </handlers>
            </root-logger>
            <formatter name="PATTERN">
                <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
            </formatter>
            <formatter name="COLOR-PATTERN">
                <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
            </formatter>
        </subsystem>

列表项

更新

当我更改日志模式以匹配旧的Jboss时,存在双日志,但是,在那些双行之一中,该模式是不同的。

日志模式:

            <formatter name="PATTERN">
                <pattern-formatter pattern="%d %-5p [%c] [%X{sid}] [pid:%X{pid}] [oid:%X{cpoid}] %m%n"/>
            </formatter>

更改日志模式后的日志输出:

2020-05-04 11:13:37,931 INFO  [org.jboss.as.server] [] [pid:] [oid:] WFLYSRV0212: Resuming server
2020-05-04 11:13:37,931 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
2020-05-04 11:13:37,933 INFO  [org.jboss.as] [] [pid:] [oid:] WFLYSRV0060: Http management interface listening on http://127.0.0.1:10190/management
2020-05-04 11:13:37,933 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:10190/management
2020-05-04 11:13:37,934 INFO  [org.jboss.as] [] [pid:] [oid:] WFLYSRV0051: Admin console listening on http://127.0.0.1:10190
2020-05-04 11:13:37,934 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10190
2020-05-04 11:13:37,934 INFO  [org.jboss.as] [] [pid:] [oid:] WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 116096ms - Started 2482 of 2655 services (425 services are lazy, passive or on-demand)
2020-05-04 11:13:37,934 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 116096ms - Started 2482 of 2655 services (425 services are lazy, passive or on-demand)

如前面在控制台(stdout)中所述,没有重复,但是显示的日志模式是我更改的模式。

请帮助我解决server.log中的双重记录问题

logging log4j wildfly jboss-eap-7
1个回答
0
投票

我已经解决了问题,这是由于代码库中的log4j与JBoss之间存在冲突。在Jboss中禁用以下log4j配置可以解决此问题:

$JBOSS_HOME/modules/system/layers/base/org/apache/log4j/main/module.xml中设置export =“ false”

<module name="org.jboss.log4j.logmanager" export="false"/>
© www.soinside.com 2019 - 2024. All rights reserved.