Package com.nuodb.jdbc.logger
Class StandardLogger
- java.lang.Object
-
- com.nuodb.jdbc.logger.StandardLogger
-
- All Implemented Interfaces:
Logger
public class StandardLogger extends Object implements Logger
Logger is used to print messages to the standard JDBC log writer set throughDriverManager.setLogWriter(PrintWriter)or custom log writer. The logger has a "level" associated with it and is set to info by default, OFF level disables log messages. Other valid log levels are:- ERROR
- WARN
- INFO
- DEBUG
- TRACE
- %level outputs log level
- %date(dateFormatStyle,default=yyyy-MM-dd HH:mm:ss.SSS) produces current timestamp formatted to custom style or default one yyyy-MM-dd HH:mm:ss.SSS, if custom style is not set
- %line(short|long|or custom format built from any combination of {className}, {methodName}, {shortClassName}, {lineNumber} placeholders) outputs stack trace element
- %message prints original message
- Author:
- Sergey Bushik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStandardLogger.Formatstatic classStandardLogger.FormatParserstatic classStandardLogger.Paramstatic classStandardLogger.ParamType
-
Field Summary
Fields Modifier and Type Field Description static StandardLogger.FormatFORMAT_DEFAULTstatic LevelLEVEL_DEFAULTstatic StringPATTERN_DEFAULTDefault pattern to print log records
-
Constructor Summary
Constructors Constructor Description StandardLogger()StandardLogger(String loggerName)StandardLogger(String loggerName, String callerClassName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(String message)voiddebug(String message, Throwable failure)booleanequals(Object o)voiderror(String message)voiderror(String message, Throwable failure)StandardLogger.FormatgetFormat()LevelgetLevel()PrintWritergetLogWriter()StringgetName()StringgetPattern()inthashCode()voidinfo(String message)voidinfo(String message, Throwable failure)booleanisDebugEnabled()booleanisErrorEnabled()booleanisInfoEnabled()booleanisLevelEnabled(Level level)booleanisTraceEnabled()booleanisWarnEnabled()voidlog(Level level, String callerClassName, String message, Throwable failure)voidlog(Level level, String message, Throwable failure)voidsetFormat(StandardLogger.Format format)voidsetLevel(Level level)voidsetLogWriter(PrintWriter logWriter)voidsetPattern(String pattern)StringtoString()voidtrace(String message)voidtrace(String message, Throwable failure)voidwarn(String message)voidwarn(String message, Throwable failure)
-
-
-
Field Detail
-
LEVEL_DEFAULT
public static final Level LEVEL_DEFAULT
-
PATTERN_DEFAULT
public static final String PATTERN_DEFAULT
Default pattern to print log records- See Also:
- Constant Field Values
-
FORMAT_DEFAULT
public static final StandardLogger.Format FORMAT_DEFAULT
-
-
Method Detail
-
isErrorEnabled
public boolean isErrorEnabled()
- Specified by:
isErrorEnabledin interfaceLogger
-
isWarnEnabled
public boolean isWarnEnabled()
- Specified by:
isWarnEnabledin interfaceLogger
-
isInfoEnabled
public boolean isInfoEnabled()
- Specified by:
isInfoEnabledin interfaceLogger
-
isDebugEnabled
public boolean isDebugEnabled()
- Specified by:
isDebugEnabledin interfaceLogger
-
isTraceEnabled
public boolean isTraceEnabled()
- Specified by:
isTraceEnabledin interfaceLogger
-
isLevelEnabled
public boolean isLevelEnabled(Level level)
- Specified by:
isLevelEnabledin interfaceLogger
-
getLogWriter
public PrintWriter getLogWriter()
-
setLogWriter
public void setLogWriter(PrintWriter logWriter)
-
getPattern
public String getPattern()
-
setPattern
public void setPattern(String pattern)
-
getFormat
public StandardLogger.Format getFormat()
-
setFormat
public void setFormat(StandardLogger.Format format)
-
setLevel
public void setLevel(Level level)
-
getLevel
public Level getLevel()
-
-