JBOSS 8 Wildfly配置,配置默认日志格式?

时间:2014-05-22 13:11:21

标签: logging jboss wildfly-8

我想知道Wildfly是否可以在其配置文件中设置默认日志记录格式?

1 个答案:

答案 0 :(得分:0)

在standalone.xml / domain.xml中,您可以查找日志记录子系统。它看起来像这样:

        <subsystem xmlns="urn:jboss:domain:logging:2.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="com.arjuna">
            <level name="WARN"/>
        </logger>
        <logger category="org.apache.tomcat.util.modeler">
            <level name="WARN"/>
        </logger>
        <logger category="org.jboss.as.config">
            <level name="DEBUG"/>
        </logger>
        <logger category="sun.rmi">
            <level name="WARN"/>
        </logger>
        <logger category="jacorb">
            <level name="WARN"/>
        </logger>
        <logger category="jacorb.config">
            <level name="ERROR"/>
        </logger>
        <root-logger>
            <level name="INFO"/>
            <handlers>
                <handler name="CONSOLE"/>
                <handler name="FILE"/>
            </handlers>
        </root-logger>
        <formatter name="PATTERN">
            <pattern-formatter pattern="%d %-5p [%t] [%c.%M] %m%n"/>
        </formatter>
        <formatter name="COLOR-PATTERN">
            <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
        </formatter>

您可以根据需要编辑底部的模式以格式化日志。