|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.logging.Log4jService
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 | |
static boolean |
CATCH_SYSTEM_ERR
Default flag to enable/disable cacthing System.err. |
static boolean |
CATCH_SYSTEM_OUT
Default flag to enable/disable cacthing System.out. |
static String |
DEFAULT_URL
The default url for the configuration file. |
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.logging.Log4jServiceMBean |
OBJECT_NAME |
Fields inherited from interface org.jboss.system.ServiceMBean |
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
Log4jService()
Uses defaults. |
|
Log4jService(String url)
|
|
Log4jService(String url,
int refreshPeriod)
|
|
Log4jService(URL url)
|
|
Log4jService(URL url,
int refreshPeriod)
|
Method Summary | |
protected void |
createService()
|
boolean |
getCatchSystemErr()
Get the catch System.err flag. |
boolean |
getCatchSystemOut()
Get the catch System.out flag. |
URL |
getConfigurationURL()
Get the Log4j configuration URL. |
boolean |
getLog4jQuietMode()
Get the org.apache.log4j.helpers.LogLog.setQuietMode flag |
String |
getLoggerLevel(String name)
Gets the level of the logger of the give name. |
protected javax.management.ObjectName |
getObjectName(javax.management.MBeanServer server,
javax.management.ObjectName name)
|
int |
getRefreshPeriod()
Get the refresh period. |
void |
reconfigure()
Force the logging system to reconfigure. |
void |
reconfigure(String url)
Hack to reconfigure and change the URL. |
void |
setCatchSystemErr(boolean flag)
Set the catch System.err flag. |
void |
setCatchSystemOut(boolean flag)
Set the catch System.out flag. |
void |
setConfigurationURL(URL url)
Set the Log4j configuration URL. |
void |
setLog4jQuietMode(boolean flag)
Set the org.apache.log4j.helpers.LogLog.setQuietMode flag |
void |
setLoggerLevel(String name,
String levelName)
Sets the level for a logger of the give name. |
void |
setLoggerLevels(String list,
String levelName)
Sets the levels of each logger specified by the given comma seperated list of logger names. |
void |
setRefreshPeriod(int refreshPeriod)
Set the refresh period. |
protected void |
startService()
|
protected void |
stopService()
|
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
create, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.system.ServiceMBean |
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
create, destroy, start, stop |
Field Detail |
public static final String DEFAULT_URL
public static final boolean CATCH_SYSTEM_OUT
public static final boolean CATCH_SYSTEM_ERR
Constructor Detail |
public Log4jService() throws MalformedURLException
MalformedURLException
- Could not create URL from default (propbably
a problem with overridden properties).public Log4jService(URL url)
url
- The configuration URL.public Log4jService(String url) throws MalformedURLException
url
- The configuration URL.public Log4jService(String url, int refreshPeriod) throws MalformedURLException
url
- The configuration URL.refreshPeriod
- The refreshPeriod in seconds to wait between each check.public Log4jService(URL url, int refreshPeriod)
url
- The configuration URL.refreshPeriod
- The refreshPeriod in seconds to wait between each check.Method Detail |
public void setCatchSystemOut(boolean flag)
setCatchSystemOut
in interface Log4jServiceMBean
flag
- True to enable, false to disable.public boolean getCatchSystemOut()
getCatchSystemOut
in interface Log4jServiceMBean
public void setCatchSystemErr(boolean flag)
setCatchSystemErr
in interface Log4jServiceMBean
flag
- True to enable, false to disable.public boolean getCatchSystemErr()
getCatchSystemErr
in interface Log4jServiceMBean
public boolean getLog4jQuietMode()
getLog4jQuietMode
in interface Log4jServiceMBean
public void setLog4jQuietMode(boolean flag)
setLog4jQuietMode
in interface Log4jServiceMBean
public int getRefreshPeriod()
getRefreshPeriod
in interface Log4jServiceMBean
public void setRefreshPeriod(int refreshPeriod)
setRefreshPeriod
in interface Log4jServiceMBean
public URL getConfigurationURL()
getConfigurationURL
in interface Log4jServiceMBean
public void setConfigurationURL(URL url)
setConfigurationURL
in interface Log4jServiceMBean
public void setLoggerLevel(String name, String levelName)
Values are trimmed before used.
setLoggerLevel
in interface Log4jServiceMBean
name
- The name of the logger to change levellevelName
- The name of the level to change the logger to.public void setLoggerLevels(String list, String levelName)
setLoggerLevels
in interface Log4jServiceMBean
list
- A comma seperated list of logger names.levelName
- The name of the level to change the logger to.setLoggerLevel(java.lang.String, java.lang.String)
public String getLoggerLevel(String name)
getLoggerLevel
in interface Log4jServiceMBean
name
- The name of the logger to inspect.public void reconfigure() throws IOException
reconfigure
in interface Log4jServiceMBean
IOException
public void reconfigure(String url) throws IOException, MalformedURLException
reconfigure
in interface Log4jServiceMBean
url
- The new configuration url
IOException
MalformedURLException
protected javax.management.ObjectName getObjectName(javax.management.MBeanServer server, javax.management.ObjectName name) throws javax.management.MalformedObjectNameException
javax.management.MalformedObjectNameException
protected void createService() throws Exception
Exception
protected void startService() throws Exception
Exception
protected void stopService() throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |