Package net.simplace.core.logging
Class Logger
java.lang.Object
net.simplace.core.logging.Logger
Singleton logger to be used to organize the logging process.
Logger stores information about the log-level of the application
It can be used to trigger different log categories
use like:
if (Logger.isERROR()) Logger.ERROR("message", aException, this);
Additional features:
- for performance reasons you can always log to the root logger.
Use Method "setUseLOGGERclazz" to false if you want to do so.
- you can avoid the logger to print stack traces if you set the
Logger instance to true in "setDisableStackTrace".
- Author:
- Andreas Enders
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
debug log without exception stackstatic void
debug log with exception stackstatic void
error log with exception stackstatic void
fatal log with exception stackstatic void
info log without exception stackstatic void
info log with exception stackstatic boolean
isDEBUG()
if Debug should be logged returns truestatic boolean
isERROR()
if Error should be logged returns truestatic boolean
isINFO()
if Info should be logged returns truestatic boolean
isTRACE()
if Debug should be logged returns truestatic boolean
isWARN()
if Warn should be logged returns truestatic void
setDisableStackTrace
(boolean aDisableStackTrace) avoid the logger to print stack traces (true) default (false)static void
setLogLevel
(int aLogLevel) Use a numeric index to set a log level.static void
setLogLevel
(Logger.LOGLEVEL aLogLevel) set the log level for the system manuallystatic void
setUseLOGGERclazz
(boolean aUseLOGGERclazz) for performance reasons you can always log to the root logger (false) default is (true)static void
warn log without exception stackstatic void
warn log with exception stack
-
Constructor Details
-
Logger
public Logger()
-
-
Method Details
-
setLogLevel
set the log level for the system manually- Parameters:
aLogLevel
-
-
setLogLevel
public static void setLogLevel(int aLogLevel) Use a numeric index to set a log level. Used for external calls from e.g. R.Use LOGLEVEL.values() to see what log levels the indices correspond to.
- Parameters:
aLogLevel
-
-
setUseLOGGERclazz
public static void setUseLOGGERclazz(boolean aUseLOGGERclazz) for performance reasons you can always log to the root logger (false) default is (true)- Parameters:
aUseLOGGERclazz
-
-
setDisableStackTrace
public static void setDisableStackTrace(boolean aDisableStackTrace) avoid the logger to print stack traces (true) default (false)- Parameters:
aDisableStackTrace
- the disableStackTrace to set
-
isTRACE
public static boolean isTRACE()if Debug should be logged returns true- Returns:
- the Trace
-
isDEBUG
public static boolean isDEBUG()if Debug should be logged returns true- Returns:
- the dEBUG
-
isINFO
public static boolean isINFO()if Info should be logged returns true- Returns:
- the iNFO
-
isWARN
public static boolean isWARN()if Warn should be logged returns true- Returns:
- the wARN
-
isERROR
public static boolean isERROR()if Error should be logged returns true- Returns:
- the eRROR
-
DEBUG
debug log with exception stack- Parameters:
aStringToLog
-aExceptionToLog
-aThisInstance
-
-
DEBUG
debug log without exception stack- Parameters:
aStringToLog
-aThisInstance
-
-
INFO
info log with exception stack- Parameters:
aStringToLog
-aExceptionToLog
-aThisInstance
-
-
INFO
info log without exception stack- Parameters:
aStringToLog
-aThisInstance
-
-
WARN
warn log with exception stack- Parameters:
aStringToLog
-aExceptionToLog
-aThisInstance
-
-
WARN
warn log without exception stack- Parameters:
aStringToLog
-aThisInstance
-
-
ERROR
error log with exception stack- Parameters:
aStringToLog
-aException
-This
-
-
FATAL
fatal log with exception stack- Parameters:
aStringToLog
-aExceptionToLog
-aThisInstance
-
-