## org.jboss.logging
Class Log4jService

    java.lang.Object
      |
      +--org.jboss.logging.Log4jService

All Implemented Interfaces:
  Log4jServiceMBean, javax.management.MBeanRegistration

public class Log4jService
extends java.lang.Object
implements Log4jServiceMBean, javax.management.MBeanRegistration

This is a JMX MBean that provides three features: 1., It initalizes the log4j framework from the log4j properties format file specified by the ConfigurationPath attribute to that the log4j may be used by JBoss components.

Version:
  $Revision: 1.7.2.3 $
Author:
  Fulco Muriglio, Scott.Stark@jboss.org, David Jencks

Fields inherited from interface org.jboss.logging.Log4jServiceMBean
`OBJECT_NAME`

Constructor Summary
`Log4jService()`
`Log4jService(java.lang.String path)`
`Log4jService(java.lang.String path, int refreshPeriod)`

Method Summary
`java.lang.String` `getConfigurationPath()` Get the log4j.properties format config file path
`boolean` `getRefreshFlag()` Get the refresh flag.
`void` `postDeregister()`
`void` `postRegister(java.lang.Boolean b)`
`void` `preDeregister()`
`javax.management.ObjectName` `preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)`
`void` `setConfigurationPath(java.lang.String path)` Set the log4j.properties format config file path
`void` `setRefreshFlag(boolean flag)` Set the refresh flag.
`void` `start()` Configures the log4j framework using the current service properties and sets the service category to the log4j root Category.
`void` `stop()` Stops the log4j framework by calling the Category.shutdown() method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Log4jService

    public Log4jService()

### Log4jService

    public Log4jService(java.lang.String path)

### Log4jService

    public Log4jService(java.lang.String path,
                        int refreshPeriod)

  Parameters:
    `path,` - the path to the log4j.properties format file
    `refreshPeriod,` - the refreshPeriod in seconds to wait between each check.

Method Detail

### getConfigurationPath

    public java.lang.String getConfigurationPath()

  Get the log4j.properties format config file path
  Specified by:
    `getConfigurationPath` in interface `Log4jServiceMBean`

### setConfigurationPath

    public void setConfigurationPath(java.lang.String path)

  Set the log4j.properties format config file path
  Specified by:
    `setConfigurationPath` in interface `Log4jServiceMBean`

### getRefreshFlag

    public boolean getRefreshFlag()

  Get the refresh flag. This determines if the log4j.properties file is reloaded every refreshPeriod seconds or not.
  Specified by:
    `getRefreshFlag` in interface `Log4jServiceMBean`

### setRefreshFlag

    public void setRefreshFlag(boolean flag)

  Set the refresh flag. This determines if the log4j.properties file is reloaded every refreshPeriod seconds or not.
  Specified by:
    `setRefreshFlag` in interface `Log4jServiceMBean`

### start

    public void start()
               throws java.lang.Exception

  Configures the log4j framework using the current service properties and sets the service category to the log4j root Category. This method throws a FileNotFoundException exception if the current configurationPath cannot be located to avoid interaction problems between the log4j framework and the JBoss ConsoleLogging service.
  Specified by:
    `start` in interface `Log4jServiceMBean`

### stop

    public void stop()

  Stops the log4j framework by calling the Category.shutdown() method.
  Specified by:
    `stop` in interface `Log4jServiceMBean`
  See Also:
    `Category.shutdown()`

### preRegister

    public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                                   javax.management.ObjectName name)
                                            throws java.lang.Exception

  Specified by:
    `preRegister` in interface `javax.management.MBeanRegistration`

### postRegister

    public void postRegister(java.lang.Boolean b)

  Specified by:
    `postRegister` in interface `javax.management.MBeanRegistration`

### preDeregister

    public void preDeregister()

  Specified by:
    `preDeregister` in interface `javax.management.MBeanRegistration`

### postDeregister

    public void postDeregister()

  Specified by:
    `postDeregister` in interface `javax.management.MBeanRegistration`

Copyright © 2000 The JBoss Organization. All Rights Reserved.