public abstract class AbstractLogService extends AbstractService implements LogService
LogService
implementations.DEBUG, ERROR, INFO, LOG_LEVEL_BY_SOURCE_PROPERTY, LOG_LEVEL_PROPERTY, NONE, TRACE, WARN
Constructor and Description |
---|
AbstractLogService() |
AbstractLogService(Properties properties) |
Modifier and Type | Method and Description |
---|---|
void |
addLogListener(LogListener listener)
Adds an item to the list of registered listeners.
|
void |
alwaysLog(int level,
Object msg,
Throwable t)
Logs a message with an exception.
|
int |
getLevel()
Returns the log level of this logger.
|
protected String |
getPrefix(int level)
Deprecated.
Use
LogLevel.prefix(int) instead. |
LogSource |
getSource()
Returns the
LogSource associated with this logger. |
protected abstract void |
messageLogged(LogMessage message) |
void |
notifyListeners(LogMessage event)
Broadcasts the given log message to the registered listeners.
|
void |
removeLogListener(LogListener listener)
Removes an item from the list of registered listeners.
|
void |
setLevel(int level)
Changes the log level of the root logger.
|
void |
setLevel(String classOrPackageName,
int level)
For messages that are logged directly to the LogService.
|
void |
setLevelForLogger(String source,
int level)
Setting the log level for loggers depending on their
LogSource . |
Logger |
subLogger(String name,
int level)
Creates a sub logger, that forwards the message it gets to this logger.
|
getContext, setContext, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
public AbstractLogService()
public AbstractLogService(Properties properties)
public void setLevel(int level)
LogService
setLevel
in interface LogService
public void setLevel(String classOrPackageName, int level)
LogService
setLevel
in interface LogService
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.public void setLevelForLogger(String source, int level)
LogService
LogSource
.
This will only affect loggers that are created after this method has been
called.setLevelForLogger
in interface LogService
protected abstract void messageLogged(LogMessage message)
public void alwaysLog(int level, Object msg, Throwable t)
Logger
Logger.getLevel()
).public LogSource getSource()
Logger
LogSource
associated with this logger.public int getLevel()
Logger
LogLevel
public Logger subLogger(String name, int level)
Logger
public void addLogListener(LogListener listener)
Logger
addLogListener
in interface Logger
public void removeLogListener(LogListener listener)
Logger
removeLogListener
in interface Logger
public void notifyListeners(LogMessage event)
Logger
notifyListeners
in interface Logger
@Deprecated protected String getPrefix(int level)
LogLevel.prefix(int)
instead.Copyright © 2015–2022 SciJava. All rights reserved.