Package com.atlassian.bamboo.specs.util
Class Logger
- java.lang.Object
-
- com.atlassian.bamboo.specs.util.Logger
-
public final class Logger extends java.lang.ObjectSimple utility for logging toSystem.outat various log levels. Logging level is controlled by a system propertyLOG_LEVEL_PROPERTY.- See Also:
LOG_LEVEL_PROPERTY,Logger.LogLevel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogger.LogLevelAvailable levels of logging.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOG_HIDE_DATEName of system property which will indicate if date should be hidden in the log.static Logger.LogLevelLOG_LEVELCurrent log level.static java.lang.StringLOG_LEVEL_PROPERTYName of system property which will indicate logging level.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(@NotNull java.lang.String message, @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.DEBUGlevel.voiddebug(@NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.DEBUGlevel.voiddebug(@NotNull java.lang.Throwable throwable, @NotNull java.lang.String message, @NotNull java.lang.Object... args)static @NotNull LoggergetLogger(@NotNull java.lang.Class<?> forClass)Returns an instance of the logger for the givenclass.voidinfo(@NotNull java.lang.String message, @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.INFOlevel.voidinfo(@NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.INFOlevel.voidinfo(@NotNull java.lang.Throwable throwable, @NotNull java.lang.String message, @NotNull java.lang.Object... args)booleanisDebugEnabled()Returns true if logging atLogger.LogLevel.DEBUGis enabled.booleanisInfoEnabled()Returns true if logging atLogger.LogLevel.INFOis enabled.booleanisTraceEnabled()Returns true if logging atLogger.LogLevel.TRACEis enabled.voidlog(@NotNull Logger.LogLevel logLevel, @NotNull java.lang.String message, @NotNull java.lang.Object... args)Logs the givenmessageatlogLevel.voidlog(@NotNull Logger.LogLevel logLevel, @NotNull java.lang.Throwable throwable)Logs the giventhrowableatlogLevellevel.voidlog(@NotNull Logger.LogLevel logLevel, @NotNull java.lang.Throwable throwable, @NotNull java.lang.String message, @NotNull java.lang.Object... args)Logs the giventhrowableandmessageatlogLevel.voidtrace(@NotNull java.lang.String message, @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.TRACElevel.voidtrace(@NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.TRACElevel.voidtrace(@NotNull java.lang.Throwable throwable, @NotNull java.lang.String message, @NotNull java.lang.Object... args)
-
-
-
Field Detail
-
LOG_LEVEL_PROPERTY
public static final java.lang.String LOG_LEVEL_PROPERTY
Name of system property which will indicate logging level. The value should be set to one of the values ofLogger.LogLevelenum (case insensitive).Usage example:
java -Dbamboo.specs.log.level=DEBUG ...- See Also:
- Constant Field Values
-
LOG_HIDE_DATE
public static final java.lang.String LOG_HIDE_DATE
Name of system property which will indicate if date should be hidden in the log. Default is false.Usage example:
java -Dbamboo.specs.log.hideDate=true ...- See Also:
- Constant Field Values
-
LOG_LEVEL
public static final Logger.LogLevel LOG_LEVEL
Current log level.
-
-
Method Detail
-
getLogger
@NotNull public static @NotNull Logger getLogger(@NotNull @NotNull java.lang.Class<?> forClass)
Returns an instance of the logger for the givenclass.
-
info
public void info(@NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.INFOlevel. The message is formatted usingString.format(String, Object...).
-
info
public void info(@NotNull @NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.INFOlevel.
-
info
public void info(@NotNull @NotNull java.lang.Throwable throwable, @NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the giventhrowableandmessageatLogger.LogLevel.INFOlevel. The message is formatted usingString.format(String, Object...).
-
debug
public void debug(@NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.DEBUGlevel. The message is formatted usingString.format(String, Object...).
-
debug
public void debug(@NotNull @NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.DEBUGlevel.
-
debug
public void debug(@NotNull @NotNull java.lang.Throwable throwable, @NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the giventhrowableandmessageatLogger.LogLevel.DEBUGlevel. The message is formatted usingString.format(String, Object...).
-
trace
public void trace(@NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the givenmessageatLogger.LogLevel.TRACElevel. The message is formatted usingString.format(String, Object...).
-
trace
public void trace(@NotNull @NotNull java.lang.Throwable throwable)Logs the giventhrowableatLogger.LogLevel.TRACElevel.
-
trace
public void trace(@NotNull @NotNull java.lang.Throwable throwable, @NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the giventhrowableandmessageatLogger.LogLevel.TRACElevel. The message is formatted usingString.format(String, Object...).
-
log
public void log(@NotNull @NotNull Logger.LogLevel logLevel, @NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the givenmessageatlogLevel. The message is formatted usingString.format(String, Object...).
-
log
public void log(@NotNull @NotNull Logger.LogLevel logLevel, @NotNull @NotNull java.lang.Throwable throwable)Logs the giventhrowableatlogLevellevel.
-
log
public void log(@NotNull @NotNull Logger.LogLevel logLevel, @NotNull @NotNull java.lang.Throwable throwable, @NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.Object... args)Logs the giventhrowableandmessageatlogLevel. The message is formatted usingString.format(String, Object...).
-
isInfoEnabled
public boolean isInfoEnabled()
Returns true if logging atLogger.LogLevel.INFOis enabled.
-
isDebugEnabled
public boolean isDebugEnabled()
Returns true if logging atLogger.LogLevel.DEBUGis enabled.
-
isTraceEnabled
public boolean isTraceEnabled()
Returns true if logging atLogger.LogLevel.TRACEis enabled.
-
-