Class 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 through DriverManager.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
    Log messages are printed to the underlying log writer and formatted using provided message pattern. Message pattern can include several placeholders, which will be expanded in runtime:
    • %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
    Messages are formatted according to [%date(yyyy-MM-dd HH:mm:ss.SSS)] (%level) (%line(long)) - %message pattern by default.
    Author:
    Sergey Bushik