1
    <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

Mohsin Khan
  • 90
  • 2
  • 11
  • Make sure the category matches the categories when you do a `Logger.getLogger()`. – James R. Perkins Aug 29 '15 at 20:42
  • I have the same category as of Logger.getLogger() – Mohsin Khan Sep 01 '15 at 18:04
  • I see no reason this shouldn't work. You should be seeing messages with the category `com.yourcompany` in the server.log, on the console and in your mcc_debug.log. – James R. Perkins Sep 01 '15 at 20:59
  • I can See the file is getting created but it is just nothing is getting logged in mcc_debug log file. Am I really missing something or is this a Bug with JBoss server – Mohsin Khan Sep 02 '15 at 13:30
  • It's not a bug because it works for me :) The only thing it could be is your loggers aren't logging anything or the category is different. One other possibility is that you have a log4j configuration file or a logging.properties file in your deployment which is overriding logging. – James R. Perkins Sep 02 '15 at 14:34
  • can you just paste your standalone.xml logging snippet just wanted to check if I am doing something wrong – Mohsin Khan Sep 02 '15 at 17:39
  • I don't have anything configured really, but I can tell you by looking at it that it's correct :) The issue has to be either you have a configuration file in your deployment or the logger category is incorrect. – James R. Perkins Sep 02 '15 at 20:12
  • Hi I have resolved the issue only thing is I am using aspectj logger which is getting appended by [stdout] which is the reason my loggers is not coming into mcc_debug log file – Mohsin Khan Sep 02 '15 at 20:23
  • 16:30:00,414 INFO [stdout] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-1) 2015-09-02 16:30:00,413 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-1] DEBUG com.abmt.utility.Loggers.AspectLoggers - Exiting --- : void com.abmt.mdc.service.MDCService.process() – Mohsin Khan Sep 02 '15 at 20:31

2 Answers2

1

Specify the level in your file-handler as such

    <periodic-rotating-file-handler name="MCCFILE" autoflush="true">
        <level name="INFO"/>
        <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>

This assuming that the package you specified in the logger exists and that the code actually logs INFO or higher. Debug messages will not appear for example with this setting.

Hope that helps

Phuthib
  • 1,326
  • 2
  • 13
  • 20
0

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.

Mohsin Khan
  • 90
  • 2
  • 11