|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.base.Adaptee org.norther.tammi.core.config.DefaultConfigurable org.norther.tammi.core.config.DefaultConfigurableFactory<Log> org.norther.tammi.core.logger.AbstractLogger
public abstract class AbstractLogger
An abstract implementation of Logger.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.norther.tammi.core.config.DefaultConfigurable |
---|
DefaultConfigurable.Modified |
Field Summary | |
---|---|
protected static boolean |
traceOn
The trace flag. |
Fields inherited from class org.norther.tammi.core.base.Adaptee |
---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer |
---|
ANY_NAME |
Constructor Summary | |
---|---|
AbstractLogger()
Contructs a new logger. |
Method Summary | |
---|---|
protected void |
activate(LoggerListener log,
String name)
Activates the specified logger listener. |
void |
addAppender(Object log,
Object appender)
Adds a new appender for the specified logger. |
void |
addFilter(String className)
Adds an exception filter. |
void |
addResourceBundleName(String qualifier,
String baseName)
Adds a resource bundle name for the qualified name. |
void |
addResourceBundleNames(String qualifier,
String[] baseNames)
Adds resource bundle names for the qualified name. |
void |
clearAppenders(Object log)
Clears appenders of the specified logger. |
void |
clearCached()
Clears all cached entries without notifying. |
void |
clearFilters()
Clears all exception filters. |
void |
clearResourceBundleNames()
Clears all resource bundle names. |
void |
clearResourceBundleNames(String qualifier)
Clears all resource bundle names of the qualified name. |
void |
expireCached(long timestamp)
Expires all cached entries notifying them about expiration. |
void |
expireFraction(long timestamp,
float fraction)
Expires the specified fraction of cached entries notifying them about expiration. |
void |
flush()
Flushes queued log entries. |
boolean |
getAdditivity(Object log)
Gets the additivity of the specified logger. |
protected Object |
getAnonymousLogger(Log.Level level)
Gets the logger for the specified level. |
String[] |
getAppenderNames(Object log)
Gets appender names of the specified logger. |
int |
getBufferSize()
Gets the log buffer size. |
ConcurrentMap<String,String> |
getCache(boolean... create)
Gets and optionally creates the cache. |
String |
getDefaultBaseName()
Gets the default base name. |
ObjectName |
getFallbackResourcesName()
Gets the fallback resources of this map. |
String[] |
getFilters()
Gets exception filters. |
Log |
getInstance(String className,
ObjectName loader,
Object[] params,
String[] signature)
Gets an instance of a named class using a specified class loader. |
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 |
getLoggerName(Log.Level level)
Gets the logger name for the specified level. |
protected String |
getLoggerName(Object log)
Gets the logger name for the specified log object. |
protected abstract Object |
getNativeLogger(String name)
Gets a named native logger. |
String |
getPlugInBaseName(String key)
Gets the base name of the resource bundle class associated with the specified plug-in key. |
int |
getPollingInterval()
Gets the interval of polling new enries for logging. |
long |
getRefreshed()
Gets the last refresh timestamp. |
String[] |
getResourceBundleNames(String qualifier)
Gets the qualified resource bundle names. |
ObjectName |
getResourceFinderName()
Gets the resource finder of this map. |
ObjectName |
getSharedCacheName()
Gets the the shared cache of this client. |
String |
getTimeZoneId()
Gets the default time zone. |
boolean |
isCachingDisabled()
Checks whether the caching is disabled. |
boolean |
isDefaultLogFactory()
Checks whether a default log factory. |
boolean |
isLoaderSupported(String className)
Checks if specified class loaders are supported for a named class. |
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 reason)
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 |
postmanaged()
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time. |
protected abstract void |
push(LogEntry entry)
Pushes a log entry into a queue. |
Set<String> |
qualifierSet()
Returns a read-only set of resource qualifiers. |
void |
refresh()
Refreshes the MBean. |
void |
removeAppender(Object log,
String appender)
Removes an appender from the specified logger. |
void |
removeCache()
Removes the cache. |
void |
removeFilter(String className)
Removes an exception filter. |
void |
removeResourceBundleName(String qualifier,
String baseName)
Removes a resource bundle name of the qualified name. |
Object |
resolveLocalizedObject(String name,
String key,
Locale... locale)
Resolves a localized object for the qualified name, key and locale. |
Object |
resolveLocalizedResource(String name,
String key,
Locale... locale)
Resolves a localized resource for the qualified name, key and locale. |
String |
resolveLocalizedString(String name,
String key,
Locale... locale)
Resolves a localized string for the qualified name, key and locale. |
String[] |
resolveLocalizedStrings(String name,
String key,
Locale... locale)
Resolves a localized string array for the qualified name, key and locale. |
LookupResourceBundle |
resolveResourceBundle(String name,
Locale... locale)
Resolves a resource bundle for the qualified name and locale. |
String |
resolveResourceBundleName(String name)
Resolves a resource bundle name for the qualified name. |
void |
setAdditivity(Object log,
boolean additivity)
Sets the additivity of the specified logger. |
void |
setBufferSize(int size)
Sets the log buffer size. |
void |
setCachingDisabled(boolean flag)
Sets the caching disabled flag. |
void |
setDefaultBaseName(String baseName)
Sets the default base name. |
void |
setDefaultLogFactory(boolean flag)
Sets whether a default log factory. |
void |
setFallbackResourcesName(ObjectName finder)
Sets the fallback resources of this map. |
void |
setFilters(String[] classNames)
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 |
setResourceBundleName(String qualifier,
String baseName)
Sets a resource bundle name for the qualified name. |
void |
setResourceBundleNames(String qualifier,
String[] baseNames)
Sets the resource bundle names of the qualified name. |
void |
setResourceFinderName(ObjectName finder)
Sets the resource finder of this map. |
void |
setSharedCacheName(ObjectName cache)
Sets the shared cache of this client. |
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. |
void |
unmanaged()
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time. |
Methods inherited from class org.norther.tammi.core.config.DefaultConfigurableFactory |
---|
getInstance, getInstance, getInstance |
Methods inherited from class org.norther.tammi.core.base.Adaptee |
---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.norther.tammi.core.logger.Logger |
---|
getLoggerClassName, isLogEnabled, isLogEnabled, release |
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory |
---|
getInstance, getInstance, getInstance |
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 |
Field Detail |
---|
protected static boolean traceOn
Constructor Detail |
---|
public AbstractLogger()
Method Detail |
---|
public void postmanaged()
Manageable
postmanaged
in interface Manageable
postmanaged
in class Adaptee
public void unmanaged() throws Exception
Manageable
unmanaged
in interface Manageable
unmanaged
in class Adaptee
Exception
- if the adaptee refused to be unmanaged.public boolean isStaticTrace()
Logger
isStaticTrace
in interface Logger
public void setStaticTrace(boolean flag)
Logger
setStaticTrace
in interface Logger
flag
- the static trace on/off flag.public boolean isStackTrace()
Logger
isStackTrace
in interface Logger
public void setStackTrace(boolean flag)
Logger
setStackTrace
in interface Logger
flag
- the stack trace on/off flag.public int getBufferSize()
Logger
getBufferSize
in interface Logger
public void setBufferSize(int size)
Logger
setBufferSize
in interface Logger
size
- the buffer size as a number of log entries.public int getPollingInterval()
Logger
getPollingInterval
in interface Logger
public void setPollingInterval(int msecs)
Logger
setPollingInterval
in interface Logger
msecs
- the polling interval in msecs.public String getTimeZoneId()
Logger
getTimeZoneId
in interface Logger
public void setTimeZoneId(String zone)
Logger
setTimeZoneId
in interface Logger
zone
- the default time zone of log entries.public LogEntry.Encoding getLogEntryEncoding()
Logger
getLogEntryEncoding
in interface Logger
public void setLogEntryEncoding(LogEntry.Encoding enc)
Logger
setLogEntryEncoding
in interface Logger
enc
- the log entry encoding.public boolean isDefaultLogFactory()
Logger
isDefaultLogFactory
in interface Logger
public void setDefaultLogFactory(boolean flag)
Logger
setDefaultLogFactory
in interface Logger
flag
- true if a default factory, false otherwise.public String getLogClassName()
Logger
getLogClassName
in interface Logger
public void setLogClassName(String className)
Logger
setLogClassName
in interface Logger
className
- the log class name.public String getLoggerName(Log.Level level)
Logger
getLoggerName
in interface Logger
level
- the level.
public void setLoggerName(Log.Level level, String name)
Logger
setLoggerName
in interface Logger
level
- the level.name
- the logger name.public Log.Level getLevel()
Logger
getLevel
in interface Logger
public void setLevel(Log.Level level)
Logger
setLevel
in interface Logger
level
- the level.public void setLevelAsString(String level)
Logger
setLevelAsString
in interface Logger
level
- the level as a string.public Log.Level getLevel(Object log)
Logger
getLevel
in interface Logger
log
- the logger.
public void setLevel(Object log, Log.Level level)
Logger
setLevel
in interface Logger
log
- the logger.level
- the level.public void setLevelAsString(Object log, String level)
Logger
setLevelAsString
in interface Logger
log
- the logger.level
- the level as a string.public boolean getAdditivity(Object log)
Logger
getAdditivity
in interface Logger
log
- the logger.
public void setAdditivity(Object log, boolean additivity)
Logger
setAdditivity
in interface Logger
log
- the logger.additivity
- the additivity.public void addAppender(Object log, Object appender)
Logger
addAppender
in interface Logger
log
- the logger.appender
- the appender class name.public String[] getAppenderNames(Object log)
Logger
getAppenderNames
in interface Logger
log
- the logger.
public void removeAppender(Object log, String appender)
Logger
removeAppender
in interface Logger
log
- the logger.appender
- the appender name.public void clearAppenders(Object log)
Logger
clearAppenders
in interface Logger
log
- the logger.public String[] getFilters()
Logger
getFilters
in interface Logger
public void setFilters(String[] classNames)
Logger
setFilters
in interface Logger
classNames
- an array of exception filters.public void addFilter(String className)
Logger
addFilter
in interface Logger
className
- the class name of a filtered exception.public void removeFilter(String className)
Logger
removeFilter
in interface Logger
className
- the class name of a filtered exception.public void clearFilters()
Logger
clearFilters
in interface Logger
public void log(Log.Level level, Object msg)
Logger
log
in interface Logger
level
- the level of the message.msg
- the message to log.public void log(Log.Level level, String msg, Object arg)
Logger
log
in interface Logger
level
- the level of the message.msg
- the message to log.arg
- the argument or cause.public void log(Log.Level level, String msg, Object arg, Throwable reason)
Logger
log
in interface Logger
level
- the level of the message.msg
- the message to log.arg
- the argument.reason
- the cause.public void log(Log.Level level, long time, String msg, Object arg)
Logger
log
in interface Logger
level
- the level of the message.time
- the time of the event.msg
- the message to log.arg
- the argument or cause.public void log(Log.Level level, long time, String msg, Object arg, Throwable cause)
Logger
log
in interface Logger
level
- the level of the message.time
- the time of the event.msg
- the message to log.arg
- the argument.cause
- the cause.public void log(Object log, Log.Level level, Object msg)
Logger
log
in interface Logger
log
- the logger.level
- the level of the message.msg
- the message to log.public void log(Object log, Log.Level level, String msg, Object arg)
Logger
log
in interface Logger
log
- the logger.level
- the level of the message.msg
- the message to log.arg
- the argument or cause.public void log(Object log, Log.Level level, String msg, Object arg, Throwable cause)
Logger
log
in interface Logger
log
- the logger.level
- the level of the message.msg
- the message to log.arg
- the argument.cause
- the cause.public void log(Object log, Log.Level level, long time, String msg, Object arg)
Logger
log
in interface Logger
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.public void log(Object log, Log.Level level, long time, String msg, Object arg, Throwable cause)
Logger
log
in interface Logger
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.public boolean isSystemOutLogged()
Logger
isSystemOutLogged
in interface Logger
public void setSystemOutLogged(boolean flag)
Logger
setSystemOutLogged
in interface Logger
flag
- true if logged, false otherwise,public boolean isSystemErrLogged()
Logger
isSystemErrLogged
in interface Logger
public void setSystemErrLogged(boolean flag)
Logger
Note that echo will be automatically off.
setSystemErrLogged
in interface Logger
flag
- true if logged, false otherwise,public String getLocalizedMessage(Object msg)
Logger
getLocalizedMessage
in interface Logger
msg
- the message to localize.
public String getLocalizedMessage(Object msg, Locale locale)
Logger
getLocalizedMessage
in interface Logger
msg
- the message to localize.locale
- the locale to apply.
public void flush()
Logger
flush
in interface Logger
public Log getInstance(String className, ObjectName loader, Object[] params, String[] signature) throws ConstructionException
ObjectFactory
Class loaders are supported only if the isLoaderSupported method returns true. Otherwise the loader parameter is ignored.
getInstance
in interface ObjectFactory<Log>
getInstance
in class DefaultConfigurableFactory<Log>
className
- the name of the class.loader
- the class loader.params
- an array containing the parameters of the constructor.signature
- an array containing the signature of the constructor.
ConstructionException
- if construction fails.public boolean isLoaderSupported(String className)
ObjectFactory
isLoaderSupported
in interface ObjectFactory<Log>
isLoaderSupported
in class DefaultConfigurableFactory<Log>
className
- the name of the class.
public boolean isCachingDisabled()
CacheClient
isCachingDisabled
in interface CacheClient<String,String>
public void setCachingDisabled(boolean flag)
CacheClient
setCachingDisabled
in interface CacheClient<String,String>
flag
- the caching disabled flag.public void expireCached(long timestamp)
CacheClient
expireCached
in interface CacheClient<String,String>
timestamp
- the timestamp of the expiration.public void expireFraction(long timestamp, float fraction)
CacheClient
expireFraction
in interface CacheClient<String,String>
timestamp
- the timestamp of the expiration.fraction
- the fraction of entries to expire (0.0..1.0).public void clearCached()
CacheClient
clearCached
in interface CacheClient<String,String>
public ConcurrentMap<String,String> getCache(boolean... create)
CacheClient
getCache
in interface CacheClient<String,String>
create
- true to create a missing cache.
public void removeCache()
CacheClient
removeCache
in interface CacheClient<String,String>
public ObjectName getSharedCacheName()
CacheClient
getSharedCacheName
in interface CacheClient<String,String>
public void setSharedCacheName(ObjectName cache)
CacheClient
setSharedCacheName
in interface CacheClient<String,String>
cache
- the object name of the shared cache or a query.public void refresh()
Refreshable
refresh
in interface Refreshable
public long getRefreshed()
Refreshable
getRefreshed
in interface Refreshable
public ObjectName getResourceFinderName()
ResourceMap
getResourceFinderName
in interface ResourceMap
public void setResourceFinderName(ObjectName finder)
ResourceMap
setResourceFinderName
in interface ResourceMap
finder
- the object name of the resource finder or a query.public String getPlugInBaseName(String key)
ResourceMap
getPlugInBaseName
in interface ResourceMap
key
- the plug-in key.
public ObjectName getFallbackResourcesName()
ResourceMap
getFallbackResourcesName
in interface ResourceMap
public void setFallbackResourcesName(ObjectName finder)
ResourceMap
setFallbackResourcesName
in interface ResourceMap
finder
- the object name of the fallback resources or a query.public String getDefaultBaseName()
ResourceMap
getDefaultBaseName
in interface ResourceMap
public void setDefaultBaseName(String baseName)
ResourceMap
setDefaultBaseName
in interface ResourceMap
baseName
- the base name of the default bundle.public String[] getResourceBundleNames(String qualifier)
ResourceMap
getResourceBundleNames
in interface ResourceMap
qualifier
- the resource qualifier.
public void setResourceBundleNames(String qualifier, String[] baseNames)
ResourceMap
setResourceBundleNames
in interface ResourceMap
qualifier
- the resource qualifier.baseNames
- the base names of the resource bundles.public void setResourceBundleName(String qualifier, String baseName)
ResourceMap
setResourceBundleName
in interface ResourceMap
qualifier
- the resource qualifier.baseName
- the base name of the resource bundle.public void addResourceBundleNames(String qualifier, String[] baseNames)
ResourceMap
addResourceBundleNames
in interface ResourceMap
qualifier
- the resource qualifier.baseNames
- the base names of the resource bundles.public void addResourceBundleName(String qualifier, String baseName)
ResourceMap
addResourceBundleName
in interface ResourceMap
qualifier
- the resource qualifier.baseName
- the base name of the resource bundle.public void removeResourceBundleName(String qualifier, String baseName)
ResourceMap
removeResourceBundleName
in interface ResourceMap
qualifier
- the resource qualifier.baseName
- the base name of the resource bundle.public void clearResourceBundleNames(String qualifier)
ResourceMap
clearResourceBundleNames
in interface ResourceMap
qualifier
- the resource qualifier.public void clearResourceBundleNames()
ResourceMap
clearResourceBundleNames
in interface ResourceMap
public Set<String> qualifierSet()
ResourceMap
qualifierSet
in interface ResourceMap
public String resolveResourceBundleName(String name)
ResourceMap
resolveResourceBundleName
in interface ResourceMap
name
- the qualified name.
public LookupResourceBundle resolveResourceBundle(String name, Locale... locale)
ResourceMap
resolveResourceBundle
in interface ResourceMap
name
- the qualified name.locale
- the locale.
public Object resolveLocalizedResource(String name, String key, Locale... locale)
Localizer
If the qualified name is a wildcard "*", the first mapped resource regardless of its package is returned.
resolveLocalizedResource
in interface Localizer
name
- the qualified name.key
- the resource key.locale
- the locale.
public Object resolveLocalizedObject(String name, String key, Locale... locale)
Localizer
resolveLocalizedObject
in interface Localizer
name
- the qualified name.key
- the resource key.locale
- the locale.
public String resolveLocalizedString(String name, String key, Locale... locale)
Localizer
resolveLocalizedString
in interface Localizer
name
- the qualified name.key
- the resource key.locale
- the locale.
public String[] resolveLocalizedStrings(String name, String key, Locale... locale)
Localizer
resolveLocalizedStrings
in interface Localizer
name
- the qualified name.key
- the resource key.locale
- the locale.
protected void activate(LoggerListener log, String name) throws ConstructionException
log
- the logger listener.name
- the logger name.
ConstructionException
- if failed.protected String getLoggerName(Object log)
log
- the log object.
protected abstract void push(LogEntry entry)
entry
- a log entry.protected abstract Object getNativeLogger(String name)
name
- the logger name.
protected Object getAnonymousLogger(Log.Level level)
level
- the level.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |