loggingjbossjboss-eap-6jboss-logging

How to create application specific log files in JBOSS eap 6.4


    <subsystem xmlns="urn:jboss:domain:logging:1.5">
        <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>
        <periodic-rotating-file-handler name="MCCFILE" autoflush="true">
            <formatter>
                <named-formatter name="PATTERN"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="mcc_debug.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="true"/>
        </periodic-rotating-file-handler>
        <logger category="com.yourcompany">
            <level name="INFO"/>
            <handlers>
                <handler name="MCCFILE"/>
            </handlers>
        </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{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>

I have above snippet from standalon.xml where I have created the app specific log file but nothing is getting return in the mcc_debug log file. We are using JBOSS EAP 6.4 I had made periodic-rotating-file-handler added for my mmc_debug log file. However debug lof file is empty nothing coming yp in debug file


Solution

  • This is resolved we just need to do in the rolling file appender section of log4j files ${sys:jboss.server.log.dir} and this will resolve the issue of creating application specific log files.