WildFly Logging Subsystem Configuration: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 84: Line 84:
</pre>
</pre>


<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
{{Warn|periodic-rotating-file-handler rotates the logs on a time interval basis, but only if there is activity in the logs. If configured to rotate on a daily basis ("d" present in the suffix pattern), but the instance is left to idle, the logs won't rotate simply because the logs are not written.}}
:periodic-rotating-file-handler rotates the logs on a time interval basis, but only if there is activity in the logs. If configured to rotate on a daily basis ("d" present in the suffix pattern), but the instance is left to idle, the logs won't rotate simply because the logs are not written.<br>
 
</blockquote>
<pre>
 
              <periodic-size-rotating-file-handler name="FILE" autoflush="true" rotate-on-boot="true">
                    <formatter>
                        <named-formatter name="PATTERN"/>
                    </formatter>
                    <file relative-to="jboss.server.log.dir" path="server.log"/>
                    <rotate-size value="500M"/>
                    <max-backup-index value="50"/>
                    <suffix value=".yyyy-MM-dd"/>
                    <append value="true"/>
                </periodic-size-rotating-file-handler>
 
</pre>


=Size File Handler Configuration=
=Size File Handler Configuration=

Revision as of 12:11, 9 June 2017

Internal

Relevance

  • EAP 6.4

Overview

<subsystem xmlns="urn:jboss:domain:logging:1.5">

    <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="FILE"/>
         </handlers>
      </root-logger>
      <formatter name="PATTERN">
         <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
      </formatter>
</subsystem>

<root-logger>

Note that the level has to be explicitly specified in <root-logger> to limit logging, in this case INFO. If <level name="INFO"/> is missing, the default is "ALL", so TRACE logging will be generated in the handlers that are not explicitly limited, such as the file handler.

WildFly Logging Subsystem Configuration

WildFly Logging Subsystem CLI Configuration

Periodic Rotating File Handler Configuration

The rotation period is inferred based on the "suffix" value. The "suffix" is a string that can be parsed with java.text.SimpleDateFormat. The rotation period is the shortest identified amongst the following:

  • yearly if the suffix string contains "y".
  • monthly if the suffix string contains "M".
  • weekly if the suffix contains "w" or "W".
  • daily if the suffix contains "D", "d" "F" or "E"
  • half day if the suffix contains "a", "H", "k" or "K"
  • hourly if the suffix contains "h"
  • every minute if the suffix contains "m"

Seconds and milliseconds are not supported.

<periodic-rotating-file-handler name="TEST" autoflush="true">
    <level name="ALL"/>
    <file relative-to="jboss.server.log.dir" path="test.log"/>
    <suffix value=".yyyy-MM-dd"/>
    <append value="true"/>
</periodic-rotating-file-handler>

periodic-rotating-file-handler rotates the logs on a time interval basis, but only if there is activity in the logs. If configured to rotate on a daily basis ("d" present in the suffix pattern), but the instance is left to idle, the logs won't rotate simply because the logs are not written.


               <periodic-size-rotating-file-handler name="FILE" autoflush="true" rotate-on-boot="true">
                    <formatter>
                        <named-formatter name="PATTERN"/>
                    </formatter>
                    <file relative-to="jboss.server.log.dir" path="server.log"/>
                    <rotate-size value="500M"/>
                    <max-backup-index value="50"/>
                    <suffix value=".yyyy-MM-dd"/>
                    <append value="true"/>
                </periodic-size-rotating-file-handler>

Size File Handler Configuration