public final class AgentLogger
extends java.util.logging.Logger
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Formatter |
AGENT_FILE_FORMATTER
Defines the default file formatter as : LOG_LEVEL : message
|
static java.util.logging.Formatter |
AGENT_FORMATTER
Defines the default formatter as : [agent's name] LOG_LEVEL : message
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(java.util.logging.Handler handler) |
void |
createLogFile()
Creates a log file for this logger.
|
static void |
createLogFiles()
Create a log file for each agent having a non
null logger. |
java.util.logging.Level |
getWarningLogLevel()
Returns the log level above which MaDKit warnings are displayed
for the corresponding agent.
|
void |
log(java.util.logging.LogRecord record) |
static void |
setAllLogLevels(java.util.logging.Level level)
Set all the agents' loggers to the specified level
|
void |
setLevel(java.util.logging.Level newLevel)
Set the log level for the corresponding agent.
|
void |
setWarningLogLevel(java.util.logging.Level warningLogLevel)
Sets the agent's log level above which MaDKit warnings are displayed
|
void |
severeLog(java.lang.String msg)
This call bypasses any settings and always produces severe log
messages.
|
void |
severeLog(java.lang.String msg,
java.lang.Throwable t)
This call bypasses any settings and always produces severe log
messages which display the stack trace of the throwable if it is
not
null |
void |
talk(java.lang.String msg)
Log a TALK message.
|
java.lang.String |
toString() |
config, entering, entering, entering, exiting, exiting, fine, finer, finest, getAnonymousLogger, getAnonymousLogger, getFilter, getGlobal, getHandlers, getLevel, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, info, isLoggable, log, log, log, log, logp, logp, logp, logp, logrb, logrb, logrb, logrb, removeHandler, setFilter, setParent, setUseParentHandlers, severe, throwing, warning
public static final java.util.logging.Formatter AGENT_FORMATTER
public static final java.util.logging.Formatter AGENT_FILE_FORMATTER
public java.util.logging.Level getWarningLogLevel()
public void setWarningLogLevel(java.util.logging.Level warningLogLevel)
warningLogLevel
- the log level to setpublic void createLogFile()
Madkit.Option.logDirectory
,
which is set to "logs" by default.public void addHandler(java.util.logging.Handler handler) throws java.lang.SecurityException
addHandler
in class java.util.logging.Logger
java.lang.SecurityException
public void talk(java.lang.String msg)
If the logger's level is not Level.OFF
then the given message is forwarded to all the registered output Handler objects.
If the logger's level is Level.OFF
then the message is only printed to System.out
msg
- The string messagepublic void setLevel(java.util.logging.Level newLevel) throws java.lang.SecurityException
setLevel
in class java.util.logging.Logger
java.lang.SecurityException
public java.lang.String toString()
toString
in class java.lang.Object
public void log(java.util.logging.LogRecord record)
log
in class java.util.logging.Logger
public void severeLog(java.lang.String msg, java.lang.Throwable t)
null
msg
- the message to displayt
- the related exception if any. It can be null
public void severeLog(java.lang.String msg)
msg
- the message to displaypublic static void setAllLogLevels(java.util.logging.Level level)
level
- the new levelpublic static void createLogFiles()
null
logger.createLogFile()
Fabien Michel, Olivier Gutknecht, Jacques Ferber - November 18 2014