|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.util.ref.Log
com.prosyst.util.ref.ManagedLog
public class ManagedLog
This class represents managed Log utility and should be used when the logging mechanism must be configurable.
| Field Summary | |
|---|---|
static int |
DEBUG_ALL
Static constant for DEBUG_ALL level. |
static java.lang.String |
DEBUG_ALL_PROP
Static constant for DEBUG_ALL property in the CM configuration. |
protected com.prosyst.util.hash.HashIntObjNS |
mapping
The mapping between the Log levels and their configuration property names. |
protected int |
mask
The integer mask which will be used for different Log levels. |
protected ManagedService |
parentMS
Optional Managed Service which updated(Dictionary) method will be invoked when the ConfigAdmin calls updated(Dictionary) method of this Managed Service. |
protected java.lang.String |
pid
The PID of the Managed Service which will be registered. |
static int |
PRINT_ON_CONSOLE
Static constant for PRINT_ON_CONSOLE. |
static java.lang.String |
PRINT_ON_CONSOLE_PROP
Static constant for DEBUG_ALL property in the CM configuration. |
protected org.osgi.framework.ServiceRegistration |
serviceReg
The service registration of this Managed Service. |
| Fields inherited from class com.prosyst.util.ref.Log |
|---|
autoPrintOnConsole, bc, debug, printOnConsole, securityUtil |
| Constructor Summary | |
|---|---|
ManagedLog(org.osgi.framework.BundleContext bc,
com.prosyst.util.hash.HashIntObjNS mapping,
java.lang.String pid,
ManagedService parentMS)
Creates new Managed Log utility instance |
|
ManagedLog(java.lang.String baseName,
boolean synch,
org.osgi.framework.BundleContext bc,
com.prosyst.util.hash.HashIntObjNS mapping,
java.lang.String pid,
ManagedService parentMS)
|
|
| Method Summary | |
|---|---|
void |
close()
Releases the Log's resources: ungets LogService, removes the ServiceListener from the framework and nulls references. |
boolean |
getDebug()
Checks whether the debug level is switched on or not. |
protected java.lang.String |
getDisplayName(int level)
This method should return the display name of the specified Log level according to the mapping hashtable. |
boolean |
getLevel(int level)
Checks whether the specified Log level is switched on or not. |
boolean |
getPrintOnConsole()
Gets the flag, which enables printing log messages on the console. |
protected boolean |
hasErrors()
|
void |
logDebug(java.lang.String header,
int level,
java.lang.String message,
java.lang.Throwable e)
Logs a debug message according to the specified header, level and message and check whether the log level i switched on. |
void |
logError(java.lang.String header,
int level,
java.lang.String message,
java.lang.Throwable e)
Logs an error message according to the specified header, level and message. |
void |
logInfo(java.lang.String header,
int level,
java.lang.String message)
Logs an info message according to the specified header, level and message. |
void |
setDebug(boolean value)
enable/diasable loging of debug info |
void |
setPrintOnConsole(boolean value)
enable/diasable print on console |
void |
updated(java.util.Dictionary props)
Implementation of ManagedService.updated(Dictionary)
method. |
protected void |
updateMappings(java.util.Dictionary props)
|
| Methods inherited from class com.prosyst.util.ref.Log |
|---|
addingService, debug, debug, debug, debug, debug, dispatchPrivileged, error, error, fault, fault, finalize, info, info, isAutoPrintOnConsole, isLogErrorLevel, modifiedService, removedService, security, setAutoPrintOnConsole, setMaps, trace, trace, trigger, warning, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEBUG_ALL
public static final java.lang.String DEBUG_ALL_PROP
public static final int PRINT_ON_CONSOLE
public static final java.lang.String PRINT_ON_CONSOLE_PROP
protected com.prosyst.util.hash.HashIntObjNS mapping
protected java.lang.String pid
protected ManagedService parentMS
protected int mask
protected org.osgi.framework.ServiceRegistration serviceReg
| Constructor Detail |
|---|
public ManagedLog(org.osgi.framework.BundleContext bc,
com.prosyst.util.hash.HashIntObjNS mapping,
java.lang.String pid,
ManagedService parentMS)
bc - The Bundle Context object of themapping - pid - parentMS -
public ManagedLog(java.lang.String baseName,
boolean synch,
org.osgi.framework.BundleContext bc,
com.prosyst.util.hash.HashIntObjNS mapping,
java.lang.String pid,
ManagedService parentMS)
| Method Detail |
|---|
protected boolean hasErrors()
public boolean getDebug()
getDebug in interface LogInterfacegetDebug in class Logpublic void setDebug(boolean value)
setDebug in interface LogInterfacesetDebug in class Logvalue - boolean if true enables loging of debug info else disables itpublic boolean getPrintOnConsole()
getPrintOnConsole in interface LogInterfacegetPrintOnConsole in class Logpublic void setPrintOnConsole(boolean value)
setPrintOnConsole in interface LogInterfacesetPrintOnConsole in class Logvalue - boolean if true enables print on console else disables itpublic boolean getLevel(int level)
level - the Log level which must be checked.
public void updated(java.util.Dictionary props)
throws ConfigurationException
ManagedService.updated(Dictionary)
method. This method is responsible for the
updated in interface ManagedServiceprops -
ConfigurationExceptionprotected void updateMappings(java.util.Dictionary props)
public void logInfo(java.lang.String header,
int level,
java.lang.String message)
header - the header of the log message.level - the level of the log message.message - the text of the message.
public void logDebug(java.lang.String header,
int level,
java.lang.String message,
java.lang.Throwable e)
header - the header of the log message.level - the level of the log message.message - the text of the message.e - optional throwable object.
public void logError(java.lang.String header,
int level,
java.lang.String message,
java.lang.Throwable e)
header - the header of the log message.level - the level of the log message.message - the text of the message.e - optional throwable object.protected java.lang.String getDisplayName(int level)
level - the Log level which display name must be returned.
public void close()
close in interface LogInterfaceclose in class Log
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||