Package org.scijava.log
Class AbstractLogService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.log.AbstractLogService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Disposable,Identifiable,Initializable,Locatable,Logged,Logger,LogService,HasPluginInfo,RichPlugin,SciJavaPlugin,Prioritized,SciJavaService,Service,Versioned
- Direct Known Subclasses:
StderrLogService
public abstract class AbstractLogService extends AbstractService implements LogService
Base class forLogServiceimplementations.- Author:
- Johannes Schindelin, Curtis Rueden, Matthias Arzt
-
-
Field Summary
-
Fields inherited from interface org.scijava.log.LogService
DEBUG, ERROR, INFO, LOG_LEVEL_BY_SOURCE_PROPERTY, LOG_LEVEL_PROPERTY, NONE, TRACE, WARN
-
-
Constructor Summary
Constructors Constructor Description AbstractLogService()AbstractLogService(Properties properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddLogListener(LogListener listener)Adds an item to the list of registered listeners.voidalwaysLog(int level, Object msg, Throwable t)Logs a message with an exception.intgetLevel()Returns the log level of this logger. seeLogLevelprotected StringgetPrefix(int level)Deprecated.UseLogLevel.prefix(int)instead.LogSourcegetSource()Returns theLogSourceassociated with this logger.protected abstract voidmessageLogged(LogMessage message)voidnotifyListeners(LogMessage event)Broadcasts the given log message to the registered listeners.voidremoveLogListener(LogListener listener)Removes an item from the list of registered listeners.voidsetLevel(int level)Changes the log level of the root logger.voidsetLevel(String classOrPackageName, int level)For messages that are logged directly to the LogService.voidsetLevelForLogger(String source, int level)Setting the log level for loggers depending on theirLogSource.LoggersubLogger(String name, int level)Creates a sub logger, that forwards the message it gets to this logger.-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority
-
Methods inherited from class org.scijava.AbstractContextual
context
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.log.Logger
debug, debug, debug, error, error, error, getName, info, info, info, isDebug, isError, isInfo, isLevel, isTrace, isWarn, log, log, log, subLogger, trace, trace, trace, warn, warn, warn
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Constructor Detail
-
AbstractLogService
public AbstractLogService()
-
AbstractLogService
public AbstractLogService(Properties properties)
-
-
Method Detail
-
setLevel
public void setLevel(int level)
Description copied from interface:LogServiceChanges the log level of the root logger.- Specified by:
setLevelin interfaceLogService
-
setLevel
public void setLevel(String classOrPackageName, int level)
Description copied from interface:LogServiceFor messages that are logged directly to the LogService. The log level can be set depending on the class that makes the log.- Specified by:
setLevelin interfaceLogService- Parameters:
classOrPackageName- If this is the name of a class. Messages logged directly by this class are logged, if the message's level is less or equal to the given level. If this is a package, the same holds for all classes in this package.level- Given level.
-
setLevelForLogger
public void setLevelForLogger(String source, int level)
Description copied from interface:LogServiceSetting the log level for loggers depending on theirLogSource. This will only affect loggers that are created after this method has been called.- Specified by:
setLevelForLoggerin interfaceLogService
-
messageLogged
protected abstract void messageLogged(LogMessage message)
-
alwaysLog
public void alwaysLog(int level, Object msg, Throwable t)Description copied from interface:LoggerLogs a message with an exception. This message will always be logged even if its level is above the current level (given byLogger.getLevel()).
-
getSource
public LogSource getSource()
Description copied from interface:LoggerReturns theLogSourceassociated with this logger.
-
getLevel
public int getLevel()
Description copied from interface:LoggerReturns the log level of this logger. seeLogLevel
-
subLogger
public Logger subLogger(String name, int level)
Description copied from interface:LoggerCreates a sub logger, that forwards the message it gets to this logger.
-
addLogListener
public void addLogListener(LogListener listener)
Description copied from interface:LoggerAdds an item to the list of registered listeners.- Specified by:
addLogListenerin interfaceLogger
-
removeLogListener
public void removeLogListener(LogListener listener)
Description copied from interface:LoggerRemoves an item from the list of registered listeners.- Specified by:
removeLogListenerin interfaceLogger
-
notifyListeners
public void notifyListeners(LogMessage event)
Description copied from interface:LoggerBroadcasts the given log message to the registered listeners.- Specified by:
notifyListenersin interfaceLogger
-
getPrefix
@Deprecated protected String getPrefix(int level)
Deprecated.UseLogLevel.prefix(int)instead.
-
-