Thursday, January 29, 2015

JBoss7.1.1 Logging Runtime Change | JBoss AS 7.1.1 - Logging Configuration and Change at Runtime

Console Handler


Open standalone.xml and search for"<subsystem xmlns="urn:jboss:domain:logging:1.1".
For Console type handler, add the following:
<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>
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Periodic Rotating File Handler


Configure periodic rotating file handler in this way:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
  <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>
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Size Rotating File Handler


Configure file rotating file handler in this way:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
  <size-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"/>
    <append value="true"/>
    <!-- size of a log file -->
    <rotate-size value="20M"/>
    <!-- no of log files to keep -->
    <max-backup-index value="50"/>
  </size-rotating-file-handl
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Change At Runtime


All these can be done at runtime without restarting JBoss. Check out the image below as a reference.






Create a Successful Online Store at Bigcommerce! Try it Free Now!

No comments:

Post a Comment