Save This Page
Home » JBoss-5.1.0 » org » jboss » logging » [javadoc | source]
org.jboss.logging
public class: Log4jService [javadoc | source]
java.lang.Object
   org.jboss.mx.util.JBossNotificationBroadcasterSupport
      org.jboss.system.ServiceMBeanSupport
         org.jboss.logging.Log4jService

All Implemented Interfaces:
    Log4jServiceMBean, KernelControllerContextAware, ServiceMBean, MBeanRegistration, NotificationEmitter

Initializes the Log4j logging framework. Supports XML and standard configuration file formats. Defaults to using 'log4j.xml' read from a system resource.

Sets up a ThrowableListener to adapt unhandled throwables to a logger.

Installs LoggerStream adapters for System.out and System.err to catch and redirect calls to Log4j.

Field Summary
public static final  String DEFAULT_URL    The default url for the configuration file. Reads the value from the system property org.jboss.logging.Log4jService.configURL or if that is not set defaults to resource:log4j.xml
public static final  boolean CATCH_SYSTEM_OUT    Default flag to enable/disable cacthing System.out. Reads the value from the system property org.jboss.logging.Log4jService.catchSystemOut or if not set defaults to true
public static final  boolean CATCH_SYSTEM_ERR    Default flag to enable/disable cacthing System.err. Reads the value from the system property org.jboss.logging.Log4jService.catchSystemErr or if not set defaults to true
public static final  String DEFAULT_JBOSS_SERVER_LOG_THRESHOLD    Default value for system property #JBOSS_SERVER_LOG_THRESHOLD_PROPERTY if it is not otherwise configured. 
Fields inherited from org.jboss.system.ServiceMBeanSupport:
SERVICE_CONTROLLER_SIG,  log,  server,  serviceName
Constructor:
 public Log4jService() throws MalformedURLException 
    Uses defaults.
    Throws:
    MalformedURLException - Could not create URL from default (propbably a problem with overridden properties).
    jmx:managed-constructor:
 public Log4jService(URL url) 
    Parameters:
    url - The configuration URL.
    jmx:managed-constructor:
 public Log4jService(String url) throws MalformedURLException 
    Parameters:
    url - The configuration URL.
    jmx:managed-constructor:
 public Log4jService(String url,
    int refreshPeriod) throws MalformedURLException 
    Parameters:
    url - The configuration URL.
    refreshPeriod - The refreshPeriod in seconds to wait between each check.
    jmx:managed-constructor:
 public Log4jService(URL url,
    int refreshPeriod) 
    Parameters:
    url - The configuration URL.
    refreshPeriod - The refreshPeriod in seconds to wait between each check.
    jmx:managed-constructor:
Method from org.jboss.logging.Log4jService Summary:
createService,   emitReconfigureNotification,   getCatchSystemErr,   getCatchSystemOut,   getConfigurationURL,   getDefaultJBossServerLogThreshold,   getLog4jQuietMode,   getLoggerLevel,   getObjectName,   getRefreshPeriod,   reconfigure,   reconfigure,   setCatchSystemErr,   setCatchSystemOut,   setConfigurationURL,   setDefaultJBossServerLogThreshold,   setLog4jQuietMode,   setLoggerLevel,   setLoggerLevels,   setRefreshPeriod,   startService,   stopService
Methods from org.jboss.system.ServiceMBeanSupport:
create,   createService,   destroy,   destroyService,   getDeploymentInfo,   getLog,   getName,   getNextNotificationSequenceNumber,   getObjectName,   getServer,   getServiceName,   getState,   getStateString,   jbossInternalCreate,   jbossInternalDescription,   jbossInternalDestroy,   jbossInternalLifecycle,   jbossInternalStart,   jbossInternalStop,   pojoChange,   pojoCreate,   pojoDestroy,   pojoStart,   pojoStop,   postDeregister,   postRegister,   preDeregister,   preRegister,   setKernelControllerContext,   start,   startService,   stop,   stopService,   unsetKernelControllerContext
Methods from org.jboss.mx.util.JBossNotificationBroadcasterSupport:
addNotificationListener,   getNotificationInfo,   handleNotification,   nextNotificationSequenceNumber,   removeNotificationListener,   removeNotificationListener,   sendNotification
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.logging.Log4jService Detail:
 protected  void createService() throws Exception 
 protected  void emitReconfigureNotification() 
 public boolean getCatchSystemErr() 
    Get the catch System.err flag.
 public boolean getCatchSystemOut() 
    Get the catch System.out flag.
 public URL getConfigurationURL() 
    Get the Log4j configuration URL.
 public String getDefaultJBossServerLogThreshold() 
    {@inheritDoc}
 public boolean getLog4jQuietMode() 
    Get the org.apache.log4j.helpers.LogLog.setQuietMode flag
 public String getLoggerLevel(String name) 
    Gets the level of the logger of the give name.
 protected ObjectName getObjectName(MBeanServer server,
    ObjectName name) throws MalformedObjectNameException 
 public int getRefreshPeriod() 
    Get the refresh period.
 public  void reconfigure() throws IOException 
    Force the logging system to reconfigure.
 public  void reconfigure(String url) throws IOException, MalformedURLException 
    Hack to reconfigure and change the URL. This is needed until we have a JMX HTML Adapter that can use PropertyEditor to coerce.
 public  void setCatchSystemErr(boolean flag) 
    Set the catch System.err flag.
 public  void setCatchSystemOut(boolean flag) 
    Set the catch System.out flag.
 public  void setConfigurationURL(URL url) 
    Set the Log4j configuration URL.
 public  void setDefaultJBossServerLogThreshold(String level) 
    {@inheritDoc}
 public  void setLog4jQuietMode(boolean flag) 
    Set the org.apache.log4j.helpers.LogLog.setQuietMode flag
 public  void setLoggerLevel(String name,
    String levelName) 
    Sets the level for a logger of the give name.

    Values are trimmed before used.

 public  void setLoggerLevels(String list,
    String levelName) 
    Sets the levels of each logger specified by the given comma seperated list of logger names.
 public  void setRefreshPeriod(int refreshPeriod) 
    Set the refresh period.
 protected  void startService() throws Exception 
 protected  void stopService() throws Exception