Methods Summary |
---|
public void | addLifecycleListener(org.apache.catalina.LifecycleListener listener)Add a lifecycle event listener to this component.
lifecycle.addLifecycleListener(listener);
|
public void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a property change listener to this component.
support.addPropertyChangeListener(listener);
|
public javax.management.ObjectName | createObjectName()
log("createObjectName with "+container);
// register
try {
StandardEngine engine=null;
String suffix="";
if( container instanceof StandardEngine ) {
engine=(StandardEngine)container;
} else if( container instanceof StandardHost ) {
engine=(StandardEngine)container.getParent();
suffix=",host=" + container.getName();
} else if( container instanceof StandardContext ) {
String path = ((StandardContext)container).getPath();
// add "/" to avoid MalformedObjectName Exception
if (path.equals("")) {
path = "/";
}
engine=(StandardEngine)container.getParent().getParent();
suffix= ",path=" + path + ",host=" +
container.getParent().getName();
} else {
log.error("Unknown container " + container );
}
if( engine != null ) {
oname=new ObjectName(engine.getDomain()+ ":type=Logger" + suffix);
} else {
log.error("Null engine !! " + container);
}
} catch (Throwable e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
return oname;
|
public void | destroy()
|
public org.apache.catalina.LifecycleListener[] | findLifecycleListeners()Get the lifecycle listeners associated with this lifecycle. If this
Lifecycle has no listeners registered, a zero-length array is returned.
return lifecycle.findLifecycleListeners();
|
public org.apache.catalina.Container | getContainer()Return the Container with which this Logger has been associated.
// ------------------------------------------------------------- Properties
return (container);
|
public javax.management.ObjectName | getController()
return controller;
|
public int | getDebug()Return the debugging detail level for this component.
return (this.debug);
|
public java.lang.String | getDomain()
return domain;
|
public java.lang.String | getInfo()Return descriptive information about this Logger implementation and
the corresponding version number, in the format
<description>/<version> .
return (info);
|
public javax.management.ObjectName | getObjectName()
return oname;
|
public int | getVerbosity()Return the verbosity level of this logger. Messages logged with a
higher verbosity than this level will be silently ignored.
return (this.verbosity);
|
public void | init()
|
public void | log(java.lang.String msg)Writes the specified message to a servlet log file, usually an event
log. The name and type of the servlet log is specific to the
servlet container. This message will be logged unconditionally.
log.debug(msg);
|
public void | log(java.lang.Exception exception, java.lang.String msg)Writes the specified exception, and message, to a servlet log file.
The implementation of this method should call
log(msg, exception) instead. This method is deprecated
in the ServletContext interface, but not deprecated here to avoid
many useless compiler warnings. This message will be logged
unconditionally.
log(msg, exception);
|
public void | log(java.lang.String msg, java.lang.Throwable throwable)Writes an explanatory message and a stack trace for a given
Throwable exception to the servlet log file. The name
and type of the servlet log file is specific to the servlet container,
usually an event log. This message will be logged unconditionally.
CharArrayWriter buf = new CharArrayWriter();
PrintWriter writer = new PrintWriter(buf);
writer.println(msg);
throwable.printStackTrace(writer);
Throwable rootCause = null;
if (throwable instanceof LifecycleException)
rootCause = ((LifecycleException) throwable).getThrowable();
else if (throwable instanceof ServletException)
rootCause = ((ServletException) throwable).getRootCause();
if (rootCause != null) {
writer.println("----- Root Cause -----");
rootCause.printStackTrace(writer);
}
log(buf.toString());
|
public void | log(java.lang.String message, int verbosity)Writes the specified message to the servlet log file, usually an event
log, if the logger is set to a verbosity level equal to or higher than
the specified value for this message.
if (this.verbosity >= verbosity)
log(message);
|
public void | log(java.lang.String message, java.lang.Throwable throwable, int verbosity)Writes the specified message and exception to the servlet log file,
usually an event log, if the logger is set to a verbosity level equal
to or higher than the specified value for this message.
if (this.verbosity >= verbosity)
log(message, throwable);
|
public void | postDeregister()
|
public void | postRegister(java.lang.Boolean registrationDone)
|
public void | preDeregister()
|
public javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
oname=name;
mserver=server;
// FIXME null pointer exception
if (name == null) {
return null;
}
domain=name.getDomain();
host=name.getKeyProperty("host");
path=name.getKeyProperty("path");
log("preRegister with "+name);
if( container== null ) {
// Register with the parent
try {
ObjectName cname=null;
if( host == null ) {
// global
cname=new ObjectName(domain +":type=Engine");
} else if( path==null ) {
cname=new ObjectName(domain +
":type=Host,host=" + host);
} else {
cname=new ObjectName(domain +":j2eeType=WebModule,name=//" +
host + "/" + path);
}
log.debug("Register with " + cname);
mserver.invoke(cname, "setLogger", new Object[] {this},
new String[] {"org.apache.catalina.Logger"});
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
}
return name;
|
public void | removeLifecycleListener(org.apache.catalina.LifecycleListener listener)Remove a lifecycle event listener from this component.
lifecycle.removeLifecycleListener(listener);
|
public void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a property change listener from this component.
support.removePropertyChangeListener(listener);
|
public void | setContainer(org.apache.catalina.Container container)Set the Container with which this Logger has been associated.
Container oldContainer = this.container;
this.container = container;
support.firePropertyChange("container", oldContainer, this.container);
|
public void | setController(javax.management.ObjectName controller)
this.controller = controller;
|
public void | setDebug(int debug)Set the debugging detail level for this component.
this.debug = debug;
|
public void | setVerbosity(int verbosity)Set the verbosity level of this logger. Messages logged with a
higher verbosity than this level will be silently ignored.
this.verbosity = verbosity;
|
public void | setVerbosityLevel(java.lang.String verbosity)Set the verbosity level of this logger. Messages logged with a
higher verbosity than this level will be silently ignored.
if ("FATAL".equalsIgnoreCase(verbosity))
this.verbosity = FATAL;
else if ("ERROR".equalsIgnoreCase(verbosity))
this.verbosity = ERROR;
else if ("WARNING".equalsIgnoreCase(verbosity))
this.verbosity = WARNING;
else if ("INFORMATION".equalsIgnoreCase(verbosity))
this.verbosity = INFORMATION;
else if ("DEBUG".equalsIgnoreCase(verbosity))
this.verbosity = DEBUG;
|
public void | start()Prepare for the beginning of active use of the public methods of this
component. This method should be called after configure() ,
and before any of the public methods of the component are utilized.
// register this logger
if ( getObjectName()==null ) {
ObjectName oname = createObjectName();
try {
Registry.getRegistry().registerComponent(this, oname, null);
if (log.isDebugEnabled()) {
log.debug("Registering logger " + oname);
}
} catch( Exception ex ) {
log.error( "Can't register logger " + oname, ex);
}
}
|
public void | stop()Gracefully terminate the active use of the public methods of this
component. This method should be the last one called on a given
instance of this component.
// unregister this logger
if ( getObjectName()!=null ) {
ObjectName oname = createObjectName();
try {
Registry.getRegistry().unregisterComponent(oname);
if (log.isDebugEnabled()) {
log.debug("Unregistering logger " + oname);
}
} catch( Exception ex ) {
log.error( "Can't unregister logger " + oname, ex);
}
}
|