|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.star.util.logging.Logger
A Logger object is used to log messages for a specific system or application component. Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as java.net or javax.swing.
Logger objects are obtained by a call to the getLogger factory method. This will either create a new Logger or return a suitable existing Logger.
Logging messages will be forwarded to registered Handler objects, which can forward the messages to a variety of destinations, including consoles, files, OS logs, etc.
On each logging call the Logger initially performs a cheap check of the request level (e.g. SEVERE or FINE) against a log level maintained by the logger. If the request level is lower than the log level, the logging call returns immediately.
The log level is is read from the properties in the logging configuration file, as described in the description of the LogManager class.
Formatting is the responsibility of the output Handler, which will typically call a Formatter/Layout.
Note that formatting need not occur synchronously. It may be delayed until a LogRecord is actually written to an external sink.
All methods on Logger are multi-thread safe.
Inner Class Summary | |
class |
Logger.LoggerPropertyChangeListener
|
Field Summary | |
protected Logger.LoggerPropertyChangeListener |
m_aListener
|
protected static java.util.Hashtable |
m_aLoggerHash
|
protected ILogger |
m_aWrapper
|
protected java.lang.String |
m_sName
|
Constructor Summary | |
protected |
Logger(ILogger aLogger)
|
Method Summary | |
void |
config(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a CONFIG message, specifying source class and method. |
protected static ILogger |
createWrapper(java.lang.String sName)
|
void |
fine(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a FINE message, specifying source class and method. |
void |
finer(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a FINER message, specifying source class and method. |
void |
finest(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a FINEST message, specifying source class and method. |
ILogger |
getConfiguredInstance()
|
static Logger |
getLogger(java.lang.String sName)
Find or create a logger for a named subsystem. |
void |
info(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log an INFO message, specifying source class and method. |
boolean |
isLoggable(Level level)
Check if a message of the given level would actually be logged by this logger. |
protected static ILogger |
loadClassLogger(java.lang.String sName,
java.lang.String sClass)
|
protected void |
reconfigure()
|
void |
severe(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a SEVERE message, specifying source class and method. |
void |
warning(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg)
Log a WARNING message, specifying source class and method. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static java.util.Hashtable m_aLoggerHash
protected ILogger m_aWrapper
protected java.lang.String m_sName
protected Logger.LoggerPropertyChangeListener m_aListener
Constructor Detail |
protected Logger(ILogger aLogger)
Method Detail |
public static Logger getLogger(java.lang.String sName)
If a new logger is created its log level will be configured based on the LogManager configuration and it will configured to send logging output to all global output Handlers.
name
- A name for the logger. This should
be a dot-separated name and should normally
be based on the package name or class name
of the subsystem, such as java.net
or javax.swingprotected static ILogger createWrapper(java.lang.String sName)
protected static ILogger loadClassLogger(java.lang.String sName, java.lang.String sClass)
protected void reconfigure()
public ILogger getConfiguredInstance()
public boolean isLoggable(Level level)
level
- a message logging levelpublic void severe(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the SEVERE message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void warning(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the WARNING message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void info(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void config(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the CONFIG message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void fine(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void finer(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)public void finest(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
sourceClass
- name of class that issued the logging requestsourceMethod
- name of method that issued the logging requestmsg
- The string message (or a key in the message catalog)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |