org.norther.tammi.core.logger
Interface Logger

All Superinterfaces:
CacheClient<String,String>, Configurable, ConfigurableFactory<Log>, Localizer, ObjectFactory<Log>, Refreshable, ResourceMap
All Known Subinterfaces:
ThreadedLogger
All Known Implementing Classes:
AbstractLogger, AbstractThreadedLogger, JDK4Logger, Log4JLogger

public interface Logger
extends ConfigurableFactory<Log>, ResourceMap

An interface to loggers.

Version:
$Id: Logger.java,v 1.24 2009/09/28 15:08:45 cvsimp Exp $
Author:
Ilkka Priha

Field Summary
 
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer
ANY_NAME
 
Method Summary
 void addAppender(Object log, Object appender)
          Adds a new appender for the specified logger.
 void addFilter(String className)
          Adds an exception filter.
 void clearAppenders(Object log)
          Clears appenders of the specified logger.
 void clearFilters()
          Clears all exception filters.
 void flush()
          Flushes queued log entries.
 boolean getAdditivity(Object log)
          Gets the additivity of the specified logger.
 String[] getAppenderNames(Object log)
          Gets appender names of the specified logger.
 int getBufferSize()
          Gets the log buffer size.
 String[] getFilters()
          Gets exception filters.
 Log.Level getLevel()
          Gets the root level.
 Log.Level getLevel(Object log)
          Gets the level of the specified logger.
 String getLocalizedMessage(Object msg)
          Gets a localized message for the default locale.
 String getLocalizedMessage(Object msg, Locale locale)
          Gets a localized message for the specified locale.
 String getLogClassName()
          Gets the log implementation class name.
 LogEntry.Encoding getLogEntryEncoding()
          Gets the log entry encoding.
 String getLoggerClassName()
          Gets the logger implementation class name.
 String getLoggerName(Log.Level level)
          Gets the logger name for the specified level.
 int getPollingInterval()
          Gets the interval of polling new enries for logging.
 String getTimeZoneId()
          Gets the default time zone.
 boolean isDefaultLogFactory()
          Checks whether a default log factory.
 boolean isLogEnabled(Log.Level level)
          Checks the specified level.
 boolean isLogEnabled(Object log, Log.Level level)
          Checks the specified level and logger.
 boolean isStackTrace()
          Gets the stack trace flag for all categories called through this logger instance.
 boolean isStaticTrace()
          Gets the trace flag for the static trace methods.
 boolean isSystemErrLogged()
          Checks if system err is to be logged by this logger.
 boolean isSystemOutLogged()
          Checks if system out is to be logged by this logger.
 void log(Log.Level level, long time, String msg, Object arg)
          Logs a message with a specific level, date and argument.
 void log(Log.Level level, long time, String msg, Object arg, Throwable cause)
          Logs a message with a specific level, date, argument and reason.
 void log(Log.Level level, Object msg)
          Logs a message with a specific level.
 void log(Log.Level level, String msg, Object arg)
          Logs a message with a specific level and argument.
 void log(Log.Level level, String msg, Object arg, Throwable cause)
          Logs a message with a specific level, argument and reason.
 void log(Object log, Log.Level level, long time, String msg, Object arg)
          Logs a message with a specific logger, level, date and argument.
 void log(Object log, Log.Level level, long time, String msg, Object arg, Throwable cause)
          Logs a message with a specific logger, level, date, argument and reason.
 void log(Object log, Log.Level level, Object msg)
          Logs a message with a specific logger and level.
 void log(Object log, Log.Level level, String msg, Object arg)
          Logs a message with a specific logger, level and argument.
 void log(Object log, Log.Level level, String msg, Object arg, Throwable cause)
          Logs a message with a specific logger, level, argument and reason.
 void release()
          Releases cached log instances.
 void removeAppender(Object log, String name)
          Removes an appender from the specified logger.
 void removeFilter(String className)
          Removes an exception filter.
 void setAdditivity(Object log, boolean additivity)
          Sets the additivity of the specified logger.
 void setBufferSize(int size)
          Sets the log buffer size.
 void setDefaultLogFactory(boolean flag)
          Sets whether a default log factory.
 void setFilters(String[] filters)
          Sets exception filters.
 void setLevel(Log.Level level)
          Sets the root level.
 void setLevel(Object log, Log.Level level)
          Sets the level of the specified logger.
 void setLevelAsString(Object log, String level)
          Sets the level of the specified logger as a string.
 void setLevelAsString(String level)
          Sets the root level as a string.
 void setLogClassName(String className)
          Sets the log implementation class name.
 void setLogEntryEncoding(LogEntry.Encoding enc)
          Sets the log entry encoding.
 void setLoggerName(Log.Level level, String name)
          Sets the logger name for the specified level.
 void setPollingInterval(int msecs)
          Sets the interval of polling new enries for logging.
 void setStackTrace(boolean flag)
          Sets the stack trace flag for all categories called through this logger instance.
 void setStaticTrace(boolean flag)
          Sets the trace flag for static trace methods.
 void setSystemErrLogged(boolean flag)
          Sets if system err if to be logged by this logger.
 void setSystemOutLogged(boolean flag)
          Sets if system out is to be logged by this logger.
 void setTimeZoneId(String zone)
          Sets the default time zone.
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance, getInstance, isLoaderSupported
 
Methods inherited from interface org.norther.tammi.core.config.Configurable
addProperty, addProperty, addPropertyFilePath, addPropertyFilePath, clearProperties, containsProperty, getConfigKey, getProperties, getProperty, getPropertyFilePath, getPropertyFilePaths, indexOfProperty, propertyMap, propertyMap, removeProperty, removeProperty, removePropertyFilePath, setConfigKey, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, setPropertyFilePaths, setPropertyFilePaths, storeProperties
 
Methods inherited from interface org.norther.tammi.core.locale.ResourceMap
addResourceBundleName, addResourceBundleNames, clearResourceBundleNames, clearResourceBundleNames, getDefaultBaseName, getFallbackResourcesName, getPlugInBaseName, getResourceBundleNames, getResourceFinderName, qualifierSet, removeResourceBundleName, resolveResourceBundle, resolveResourceBundleName, setDefaultBaseName, setFallbackResourcesName, setResourceBundleName, setResourceBundleNames, setResourceFinderName
 
Methods inherited from interface org.norther.tammi.acorn.locale.Localizer
resolveLocalizedObject, resolveLocalizedResource, resolveLocalizedString, resolveLocalizedStrings
 
Methods inherited from interface org.norther.tammi.core.cache.CacheClient
clearCached, expireCached, expireFraction, getCache, getSharedCacheName, isCachingDisabled, removeCache, setCachingDisabled, setSharedCacheName
 
Methods inherited from interface org.norther.tammi.core.base.Refreshable
getRefreshed, refresh
 

Method Detail

isStaticTrace

boolean isStaticTrace()
Gets the trace flag for the static trace methods.

Returns:
true, if static trace is on.

setStaticTrace

void setStaticTrace(boolean flag)
Sets the trace flag for static trace methods.

Parameters:
flag - the static trace on/off flag.

isStackTrace

boolean isStackTrace()
Gets the stack trace flag for all categories called through this logger instance.

Returns:
true, if stack trace in on.

setStackTrace

void setStackTrace(boolean flag)
Sets the stack trace flag for all categories called through this logger instance.

Parameters:
flag - the stack trace on/off flag.

getBufferSize

int getBufferSize()
Gets the log buffer size.

Returns:
the buffer size as a number of log entries.

setBufferSize

void setBufferSize(int size)
Sets the log buffer size.

Parameters:
size - the buffer size as a number of log entries.

getPollingInterval

int getPollingInterval()
Gets the interval of polling new enries for logging.

Returns:
the polling interval in msecs.

setPollingInterval

void setPollingInterval(int msecs)
Sets the interval of polling new enries for logging.

Parameters:
msecs - the polling interval in msecs.

getTimeZoneId

String getTimeZoneId()
Gets the default time zone.

Returns:
the default time zone of log entries.

setTimeZoneId

void setTimeZoneId(String zone)
Sets the default time zone.

Parameters:
zone - the default time zone of log entries.

getLogEntryEncoding

LogEntry.Encoding getLogEntryEncoding()
Gets the log entry encoding.

Returns:
the log entry encoding.

setLogEntryEncoding

void setLogEntryEncoding(LogEntry.Encoding enc)
Sets the log entry encoding.

Parameters:
enc - the log entry encoding.

isDefaultLogFactory

boolean isDefaultLogFactory()
Checks whether a default log factory.

Returns:
true if a default factory, false otherwise.

setDefaultLogFactory

void setDefaultLogFactory(boolean flag)
Sets whether a default log factory.

Parameters:
flag - true if a default factory, false otherwise.

getLoggerClassName

String getLoggerClassName()
Gets the logger implementation class name.

Returns:
the logger class name.

getLogClassName

String getLogClassName()
Gets the log implementation class name.

Returns:
the log class name.

setLogClassName

void setLogClassName(String className)
Sets the log implementation class name.

Parameters:
className - the log class name.

getLoggerName

String getLoggerName(Log.Level level)
Gets the logger name for the specified level.

Parameters:
level - the level.
Returns:
the logger or null for root.

setLoggerName

void setLoggerName(Log.Level level,
                   String name)
Sets the logger name for the specified level.

Parameters:
level - the level.
name - the logger name.

isLogEnabled

boolean isLogEnabled(Log.Level level)
Checks the specified level.

Parameters:
level - the level.
Returns:
true, if the level is enabled.

getLevel

Log.Level getLevel()
Gets the root level.

Returns:
the level.

setLevel

void setLevel(Log.Level level)
Sets the root level.

Parameters:
level - the level.

setLevelAsString

void setLevelAsString(String level)
Sets the root level as a string.

Parameters:
level - the level as a string.

isLogEnabled

boolean isLogEnabled(Object log,
                     Log.Level level)
Checks the specified level and logger.

Parameters:
log - the logger.
level - the level.
Returns:
true, if the level for the logger is enabled.

getLevel

Log.Level getLevel(Object log)
Gets the level of the specified logger.

Parameters:
log - the logger.
Returns:
the level.

setLevel

void setLevel(Object log,
              Log.Level level)
Sets the level of the specified logger.

Parameters:
log - the logger.
level - the level.

setLevelAsString

void setLevelAsString(Object log,
                      String level)
Sets the level of the specified logger as a string.

Parameters:
log - the logger.
level - the level as a string.

getAdditivity

boolean getAdditivity(Object log)
Gets the additivity of the specified logger.

Parameters:
log - the logger.
Returns:
the additivity.

setAdditivity

void setAdditivity(Object log,
                   boolean additivity)
Sets the additivity of the specified logger.

Parameters:
log - the logger.
additivity - the additivity.

addAppender

void addAppender(Object log,
                 Object appender)
Adds a new appender for the specified logger.

Parameters:
log - the logger.
appender - the appender class name.

getAppenderNames

String[] getAppenderNames(Object log)
Gets appender names of the specified logger.

Parameters:
log - the logger.
Returns:
an array of appender names.

removeAppender

void removeAppender(Object log,
                    String name)
Removes an appender from the specified logger.

Parameters:
log - the logger.
name - the appender name.

clearAppenders

void clearAppenders(Object log)
Clears appenders of the specified logger.

Parameters:
log - the logger.

getFilters

String[] getFilters()
Gets exception filters.

Returns:
an array of exception filters.

setFilters

void setFilters(String[] filters)
Sets exception filters.

Parameters:
filters - an array of exception filters.

addFilter

void addFilter(String className)
Adds an exception filter.

Parameters:
className - the class name of a filtered exception.

removeFilter

void removeFilter(String className)
Removes an exception filter.

Parameters:
className - the class name of a filtered exception.

clearFilters

void clearFilters()
Clears all exception filters.


log

void log(Log.Level level,
         Object msg)
Logs a message with a specific level.

Parameters:
level - the level of the message.
msg - the message to log.

log

void log(Log.Level level,
         String msg,
         Object arg)
Logs a message with a specific level and argument.

Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument or cause.

log

void log(Log.Level level,
         String msg,
         Object arg,
         Throwable cause)
Logs a message with a specific level, argument and reason.

Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument.
cause - the cause.

log

void log(Log.Level level,
         long time,
         String msg,
         Object arg)
Logs a message with a specific level, date and argument.

Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument or cause.

log

void log(Log.Level level,
         long time,
         String msg,
         Object arg,
         Throwable cause)
Logs a message with a specific level, date, argument and reason.

Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument.
cause - the cause.

log

void log(Object log,
         Log.Level level,
         Object msg)
Logs a message with a specific logger and level.

Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.

log

void log(Object log,
         Log.Level level,
         String msg,
         Object arg)
Logs a message with a specific logger, level and argument.

Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.
arg - the argument or cause.

log

void log(Object log,
         Log.Level level,
         String msg,
         Object arg,
         Throwable cause)
Logs a message with a specific logger, level, argument and reason.

Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.
arg - the argument.
cause - the cause.

log

void log(Object log,
         Log.Level level,
         long time,
         String msg,
         Object arg)
Logs a message with a specific logger, level, date and argument.

Parameters:
log - the logger.
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument or cause.

log

void log(Object log,
         Log.Level level,
         long time,
         String msg,
         Object arg,
         Throwable cause)
Logs a message with a specific logger, level, date, argument and reason.

Parameters:
log - the logger.
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument.
cause - the cause.

isSystemOutLogged

boolean isSystemOutLogged()
Checks if system out is to be logged by this logger.

Returns:
true if logged, false otherwise,

setSystemOutLogged

void setSystemOutLogged(boolean flag)
Sets if system out is to be logged by this logger.

Parameters:
flag - true if logged, false otherwise,

isSystemErrLogged

boolean isSystemErrLogged()
Checks if system err is to be logged by this logger.

Returns:
true if logged, false otherwise,

setSystemErrLogged

void setSystemErrLogged(boolean flag)
Sets if system err if to be logged by this logger.

Note that echo will be automatically off.

Parameters:
flag - true if logged, false otherwise,

getLocalizedMessage

String getLocalizedMessage(Object msg)
Gets a localized message for the default locale.

Parameters:
msg - the message to localize.
Returns:
the localized message or the original one if not available.

getLocalizedMessage

String getLocalizedMessage(Object msg,
                           Locale locale)
Gets a localized message for the specified locale.

Parameters:
msg - the message to localize.
locale - the locale to apply.
Returns:
the localized message or the original one if not available.

flush

void flush()
Flushes queued log entries.


release

void release()
Releases cached log instances.



Copyright © 2004 The Norther Organization. All rights reserved.