0 Replies Latest reply on Sep 3, 2013 4:05 PM by Andy Iyer

    Jboss7 Set logger level programmatically

    Andy Iyer Newbie

      Hi,

       

      Can anyone please help as to how i can set the logger level programmatically.

       

      This is how the logger is setup in standalone.xml:

       

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

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

          <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"/>

        <rotate-size value="20M"/>

        <max-backup-index value="10"/>

        <append value="true"/>

          </size-rotating-file-handler>

          <size-rotating-file-handler name="ABCD" autoflush="true">

        <formatter>

           <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

        </formatter>

        <file relative-to="jboss.server.log.dir" path="abcd.log"/>

        <rotate-size value="20M"/>

        <max-backup-index value="10"/>

        <append value="true"/>

          </size-rotating-file-handler>

          <logger category="ABCD_LOG">

        <level name="DEBUG"/>

        <handlers>

           <handler name="ABCD"/>

        </handlers>

          </logger>

          <root-logger>

        <level name="ERROR"/>

        <handlers>

           <handler name="CONSOLE"/>

           <handler name="FILE"/>

        </handlers>

          </root-logger>

      </subsystem>

       

      And I want to set the logger level for handler=ABCD at runtime from my app programmatically. Any snipped of code or assistance is highly appreciated.