1 Reply Latest reply on Dec 7, 2001 6:39 PM by marc.fleury

    JBossMX logging

    simone

      It will be useful to have the JMX Agent log its activity, and to have the possibility to redirect this logging to custom logging facilities (such as log4j or other legacy logging systems). This way the jbossmx stuff may be self contained and independent from other packages, but still flexible.
      I defined a Logger class with a stripped down interface WRT log4j's Category: only void info(Object)-type methods, a overridable log(int priority, Object message, Throwable t), and a isEnabledFor(int priority).
      Logger instances are asked to a Log class, that is a singleton based on prototypes.
      When you call the static Log.redirectTo(myLogger), then from then on, the Log class returns logger that are built with reflection from the prototype you passed (that extends Logger and overrides its log(int,Object,Throwable) method). Calling Log.redirectTo(null) resets the Log class to return plain Logger classes.
      From here, creating an MBean that is jmx-notified of logging activity of the Agent when it is registered is simple, and other MBeans can register with a filter to send email if a logging with error priority is made, for example.

        • 1. Re: JBossMX logging
          marc.fleury

          sweeeet, I really want the logging in JBoss in general to be set once and for all, there is some effort to make log4j-core part of the basic JBoss boot package (the whole 80k of it) so having the jbossmx use that will be good.

          Put it in... put it in, well you know what I mean