|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.larsan.urd.service.log.Service
Urd log service. This service is very simple and uses a print writer to print log messages to a flat file.
The service requires a folder to write logs to. This folder should be specified in an initiation parameter called dir:
<param name="dir" value="c:\\norna\\logs" >
The log can be filtered on log message types and levels. The following levels are accepted:
LOWEST LOWER LOW NEUTRAL HIGH HIGHER HIGHESTLevels are set with the init parameter 'logLevel' and indicates the lowest severity level to let through. For example:
<param name="logLevel" value="LOW" >
Indicates that only log records of severity 'LOW' or higher are logged. ('LOWEST' and 'LOWER' are discared). A special token '*' logs all levels, which is default.
The accepted records types are given using a coma separated list as values to a 'logTypes' parameter. For example:
<param name="logTypes" value="ERROR, DEBUG" >
Indicates that only records of type 'ERROR' and 'DEBUG' is logged. A special token '*' logs all types, which is default.
The log file can roll over on file size and/or time. Time formats in the initiation file are used like this: 'amounttoken' where token might be one of the following:
ms = milliseconds
s = seconds
m = minutes
h = hours
d = days
So a rollover time of '7d' would rollover once a week. The same
format ('amounttoken') goes for size as well, where the
tokens are:
b = bytes
kb = kilobyte
m = megabyte
g = gigabyte
None of the tokens - size or time - are case sensitive.
The parameter names for the rollover are 'maxFileSize' and 'maxFileAge'. And ordinary log configiration would be:
<param name="maxFileSize" value="1M" > <param name="maxFileAge" value="7d" >
Which would indicate that the log file should be max 1 meg in size or max one week old before triggering a rollover and a new file.
The max size parameter handles float values, so '1.5M' would be one and a half megabyte.
| Constructor Summary | |
Service()
|
|
| Method Summary | |
void |
destroy()
Destroy this service. |
ServiceHandle |
getServiceHandle()
Get a reference to the ServiceHandle interface for this service. |
SoftwareInfo |
getServiceInfo()
Get service information. |
void |
init(InitParameters param)
Initialize module. |
void |
setStatusCallback(StatusCallback callback)
Set the status callback this service should use to signal status changes to the framework. |
void |
start()
Start execution of this service. |
void |
stop()
End execution. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Service()
| Method Detail |
public void setStatusCallback(StatusCallback callback)
Serviceready.
setStatusCallback in interface Servicecallback - Status callback handlepublic SoftwareInfo getServiceInfo()
ServiceServiceHandle interface.
getServiceInfo in interface Servicepublic ServiceHandle getServiceHandle()
ServiceServiceHandle interface for this service. The service handle
is the public contract used by other services. This method is guarrantied by the framework
never to be called unless the service returns its status as being ready.
getServiceHandle in interface Serviceready
public void init(InitParameters param)
throws UnavailableException
Initializable
init in interface Initializableparam - Initialization parameters
UnavailableException - If initialization failedpublic void destroy()
Initializable
destroy in interface Initializablepublic void start()
StartableLOADED / INITIALIZED or STOPPED status. This method indicates that the framework is ready
to run the service. As a concequence of this call a server should proceed to READY status.
start in interface Startablepublic void stop()
StartableShutdownListener interface to
signal to the framework that it wishes to be informed about future stop events in advance.
This method is guarrantied to be followed by either a call to Startable.start(),
unload or Initializable.destroy().
stop in interface Startable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||