javaloggingjboss7.x

How to configure jboss 7 to write logs to different folder


I'm using Jboss 7.1.1 and I have the following log definition:

<subsystem xmlns="urn:jboss:domain:logging:1.1">
        <console-handler name="CONSOLE">
            <level name="INFO"/>
            <formatter>
                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
            </formatter>
        </console-handler>
        <periodic-rotating-file-handler name="FILE">
            <formatter>
                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="server.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="true"/>
        </periodic-rotating-file-handler>
        <size-rotating-file-handler name="ACEII">
            <level name="DEBUG"/>
            <formatter>
                <pattern-formatter pattern="%z{utc}%d{dd/MM/yyyy HH:mm:ss,SSS} %-5p [%c] %s%E%n"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="ACEII.log"/>
            <rotate-size value="10M"/>
            <max-backup-index value="10"/>
            <append value="true"/>
        </size-rotating-file-handler>
        <logger category="ace2" use-parent-handlers="false">
            <level name="DEBUG"/>
            <handlers>
                <handler name="ACEII"/>
            </handlers>
        </logger>
        <logger category="com.arjuna">
            <level name="WARN"/>
        </logger>
        <logger category="org.apache.tomcat.util.modeler">
            <level name="WARN"/>
        </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>
    </subsystem>

I'd like the ACE log to be written to a different folder, so I tried putting different values in the relative-to attribute but nothing seems to work, any idea on how to do it?


Solution

  • Found the answer :)

    I'm using Java service wrapper to install Jboss as a windows service and that service has a configuration file located in a certain path, so I've noticed that if i remove the relative-to attribute it write the logs to the folder where the configuration file is located.

    All i had to do define it like this:

    <size-rotating-file-handler name="ACEII">
                <level name="DEBUG"/>
                <formatter>
                    <pattern-formatter pattern="%z{utc}%d{dd/MM/yyyy HH:mm:ss,SSS} %-5p [%c] %s%E%n"/>
                </formatter>
                **<file path="../Log/ACEII.log"/>**
                <rotate-size value="10M"/>
                <max-backup-index value="10"/>
                <append value="true"/>
            </size-rotating-file-handler>
    

    And that did the trick for me.