org.jacorb.util
Class LogKitLoggerFactory
java.lang.Object
org.jacorb.util.LogKitLoggerFactory
- All Implemented Interfaces:
- LoggerFactory
- public class LogKitLoggerFactory
- extends java.lang.Object
- implements LoggerFactory
JacORB logger factory that creates named Avalon loggers with logkit
as the underlying log mechanism.
The semantics here is that any
names logger retrieved using the logkit naming conventions for
nested loggers will inherit its parent loggers log target e.g., a
logger retrieved for jacorb.naming
inherits the root logger's target (ie. System.err
, or
a file.
Log priorities for new loggers are also inherited from the parent
logger. If no parent logger is available the priority defaults to the
value of this factory's defaultPriority
field. The
priorities for loggers can be set via
configuration properties that have the same name as the requested
logger, plus a suffix of .log.verbosity
.
The priority for all loggers that do not have a specific .log.verbosity
prop defined will be set to the value of the jacorb.log.default.verbosity
property, if it's set. If not, the default is 0.
- Since:
- JacORB 2.0 beta 3
- Version:
- $Id: LogKitLoggerFactory.java,v 1.10 2004/01/30 09:31:09 nick.cross Exp $
- Author:
- Gerald Brose
Method Summary |
java.lang.String |
getLoggingBackendName()
|
org.apache.avalon.framework.logger.Logger |
getNamedLogger(java.lang.String name)
|
org.apache.avalon.framework.logger.Logger |
getNamedLogger(java.lang.String name,
org.apache.log.LogTarget target)
|
org.apache.avalon.framework.logger.Logger |
getNamedLogger(java.lang.String name,
java.lang.String logFileName,
long maxLogSize)
|
org.apache.avalon.framework.logger.Logger |
getNamedRootLogger(java.lang.String name)
|
int |
getPriorityForNamedLogger(java.lang.String name)
return the priority for a named logger. if no priority is
specified for the requested name the priority of the first
matching parent logger is returned.
|
static org.apache.log.Priority |
intToPriority(int priority)
intToPriority returns the priority level for a given integer. |
void |
setDefaultPriority(int priority)
set the default log priority applied to all loggers on creation,
if no specific log verbosity property exists for the logger. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LogKitLoggerFactory
public LogKitLoggerFactory()
setDefaultPriority
public void setDefaultPriority(int priority)
- set the default log priority applied to all loggers on creation,
if no specific log verbosity property exists for the logger.
getLoggingBackendName
public final java.lang.String getLoggingBackendName()
- Specified by:
getLoggingBackendName
in interface LoggerFactory
- Returns:
- the name of the actual, underlying logging mechanism,
here "logkit"
getNamedLogger
public org.apache.avalon.framework.logger.Logger getNamedLogger(java.lang.String name)
- Specified by:
getNamedLogger
in interface LoggerFactory
- Parameters:
name
- the name of the logger, which also functions
as a log category
- Returns:
- a Logger for a given name
getNamedRootLogger
public org.apache.avalon.framework.logger.Logger getNamedRootLogger(java.lang.String name)
- Specified by:
getNamedRootLogger
in interface LoggerFactory
- Parameters:
name
- - the name of the logger, which also functions
as a log category
- Returns:
- a root console logger for a logger name hierarchy
getNamedLogger
public org.apache.avalon.framework.logger.Logger getNamedLogger(java.lang.String name,
java.lang.String logFileName,
long maxLogSize)
throws java.io.IOException
- Specified by:
getNamedLogger
in interface LoggerFactory
- Parameters:
name
- - the name of the logger, which also functions
as a log categorylogFileName
- - the name of the file to log tomaxLogSize
- - maximum size of the log file. When this size is reached
the log file will be rotated and a new log file created. A value of 0
means the log file size is unlimited.
- Returns:
- the new logger.
- Throws:
java.io.IOException
getNamedLogger
public org.apache.avalon.framework.logger.Logger getNamedLogger(java.lang.String name,
org.apache.log.LogTarget target)
- Parameters:
name
- the name of the logger, which also functions
as a log category
- Returns:
- the logger
getPriorityForNamedLogger
public int getPriorityForNamedLogger(java.lang.String name)
- return the priority for a named logger. if no priority is
specified for the requested name the priority of the first
matching parent logger is returned.
If there's no parent logger the factory default is returned.
- Parameters:
name
- the name of a logger
- Returns:
- the priority for that logger
intToPriority
public static org.apache.log.Priority intToPriority(int priority)
intToPriority
returns the priority level for a given integer.
- Parameters:
priority
- an int
value
- Returns:
- an
org.apache.log.Priority
value