Package adams.core.logging
Class Logger
- java.lang.Object
-
- adams.core.logging.Logger
-
- All Implemented Interfaces:
CleanUpHandler
public class Logger extends Object implements CleanUpHandler
Simple logger class.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(Handler h)
Adds the handler.void
cleanUp()
Cleans up data structures, frees up memory.void
config(String msg)
Logs aLevel.CONFIG
message.void
fine(String msg)
Logs aLevel.FINE
message.void
finer(String msg)
Logs aLevel.FINER
message.void
finest(String msg)
Logs aLevel.FINEST
message.Handler[]
getHandlers()
Returns all current handlers.Level
getLevel()
Returns the logging level.static Logger
getLogger(String name)
Returns a logger for the name.String
getName()
Returns the name of the logger.boolean
getUseParentHandlers()
Always false.void
info(String msg)
Logs aLevel.INFO
message.void
log(Level level, String msg)
Logs the message with the specified level.void
log(Level level, String msg, Object param)
Logs the message with the specified level.void
log(Level level, String msg, Object[] params)
Logs the message with the specified level.void
log(Level level, String msg, Throwable t)
Logs the message with the specified level.void
log(LogRecord record)
Logs the given record.void
removeHandler(Handler h)
Removes the handler.void
setLevel(Level value)
Sets the logging level.void
setUseParentHandlers(boolean value)
Ignored.void
severe(String msg)
Logs aLevel.SEVERE
message.void
warning(String msg)
Logs aLevel.WARNING
message.
-
-
-
Constructor Detail
-
Logger
public Logger(String name)
Initializes the logger with the specified name.- Parameters:
name
- the name
-
-
Method Detail
-
getName
public String getName()
Returns the name of the logger.- Returns:
- the name
-
addHandler
public void addHandler(Handler h)
Adds the handler.- Parameters:
h
- the handler
-
removeHandler
public void removeHandler(Handler h)
Removes the handler.- Parameters:
h
- the handler
-
getHandlers
public Handler[] getHandlers()
Returns all current handlers.- Returns:
- the handlers
-
setLevel
public void setLevel(Level value)
Sets the logging level.- Parameters:
value
- the level
-
getLevel
public Level getLevel()
Returns the logging level.- Returns:
- the level
-
setUseParentHandlers
public void setUseParentHandlers(boolean value)
Ignored.- Parameters:
value
- ignored
-
getUseParentHandlers
public boolean getUseParentHandlers()
Always false.- Returns:
- false
-
log
public void log(LogRecord record)
Logs the given record.- Parameters:
record
- the record
-
severe
public void severe(String msg)
Logs aLevel.SEVERE
message.- Parameters:
msg
- the message to log
-
warning
public void warning(String msg)
Logs aLevel.WARNING
message.- Parameters:
msg
- the message to log
-
config
public void config(String msg)
Logs aLevel.CONFIG
message.- Parameters:
msg
- the message to log
-
info
public void info(String msg)
Logs aLevel.INFO
message.- Parameters:
msg
- the message to log
-
fine
public void fine(String msg)
Logs aLevel.FINE
message.- Parameters:
msg
- the message to log
-
finer
public void finer(String msg)
Logs aLevel.FINER
message.- Parameters:
msg
- the message to log
-
finest
public void finest(String msg)
Logs aLevel.FINEST
message.- Parameters:
msg
- the message to log
-
log
public void log(Level level, String msg)
Logs the message with the specified level.- Parameters:
level
- the level of the messagemsg
- the message to log
-
log
public void log(Level level, String msg, Throwable t)
Logs the message with the specified level.- Parameters:
level
- the level of the messagemsg
- the message to logt
- the exception to log
-
log
public void log(Level level, String msg, Object param)
Logs the message with the specified level.- Parameters:
level
- the level of the messagemsg
- the message to logparam
- the parameter to log
-
log
public void log(Level level, String msg, Object[] params)
Logs the message with the specified level.- Parameters:
level
- the level of the messagemsg
- the message to logparams
- the parameters to log
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-