|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.util.logging.LogService
public class LogService
The log service which is used to monitor i3-log.conf.
To initialize it, invoke init(java.lang.String, java.lang.Class)
. Note: Log
could work
without LogService
.
Design consideration: the configure and configureAndWatch methods could be declared as static, but we don't. Reason: easilier to extend (also the performance gained by the static method is neglectable comparing its complexity).
Implementation Note: LogService cannot be a component (because ComponentManager depedns on iDom, which depends on log). Thus, we use Singleton instead.
Nested Class Summary | |
---|---|
class |
LogService.WatchdogCallback
|
Field Summary | |
---|---|
protected java.lang.String |
_root
The name of the root logger that this logging service is monitoring. |
Constructor Summary | |
---|---|
LogService(java.lang.String root)
Constructor. |
Method Summary | |
---|---|
void |
configure(java.io.File file)
Configures based the properties stored in a file. |
void |
configure(java.util.Properties props)
Configures based the properties. |
void |
configure(java.lang.String filename)
Configures based the properties stored in a file. |
FileWatchdog |
configureAndWatch(java.io.File file,
long delay)
Periodically checks whether a file is modified, and configures based the properties stored in the file, if any modifications. |
static LogService |
init(java.lang.String rootnm,
java.lang.Class cls)
Initializes the logging service. |
static boolean |
isInited(java.lang.String rootnm)
Returns whether the logging service is started, i.e., whether init(java.lang.String, java.lang.Class) is invoked. |
void |
stop()
Stops the service. |
static void |
stop(java.lang.String rootnm)
Stops the logging service |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String _root
Constructor Detail |
---|
public LogService(java.lang.String root)
init(java.lang.String, java.lang.Class)
to
start the service.
Method Detail |
---|
public static final boolean isInited(java.lang.String rootnm)
init(java.lang.String, java.lang.Class)
is invoked.
public static final LogService init(java.lang.String rootnm, java.lang.Class cls)
Note: it also enables the hierarchy support of loggers by
calling Log.setHierarchy(boolean)
with true.
rootnm
- the name of the root logger. The logging service
registered handlers at the specified logger.cls
- the implementation to start. If null, LogService
is used.public static final void stop(java.lang.String rootnm)
public void stop()
public final void configure(java.util.Properties props)
The key is a logger name and the value is the level. A special level, INHERIT or NULL, to denote resetting the level to be the same as the logger's parent.
props
- the propertiespublic final void configure(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
The key is a logger name and the value is the level.
file
- the file
java.io.FileNotFoundException
java.io.IOException
public final void configure(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
The key is a logger name and the value is the level.
filename
- the filename
java.io.FileNotFoundException
java.io.IOException
public final FileWatchdog configureAndWatch(java.io.File file, long delay)
The key is a logger name and the value is the level.
file
- the filedelay
- the delay in milliseconds to wait between each check.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |