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
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddebug log without exception stackstatic voiddebug log with exception stackstatic voiderror log with exception stackstatic voidfatal log with exception stackstatic voidinfo log without exception stackstatic voidinfo log with exception stackstatic booleanisDEBUG()if Debug should be logged returns truestatic booleanisERROR()if Error should be logged returns truestatic booleanisINFO()if Info should be logged returns truestatic booleanisTRACE()if Debug should be logged returns truestatic booleanisWARN()if Warn should be logged returns truestatic voidsetDisableStackTrace(boolean aDisableStackTrace) avoid the logger to print stack traces (true) default (false)static voidsetLogLevel(int aLogLevel) Use a numeric index to set a log level.static voidsetLogLevel(Logger.LOGLEVEL aLogLevel) set the log level for the system manuallystatic voidsetUseLOGGERclazz(boolean aUseLOGGERclazz) for performance reasons you can always log to the root logger (false) default is (true)static voidwarn log without exception stackstatic voidwarn 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-
-