Class JDK14Logger

  • All Implemented Interfaces:
    SFLogger

    public class JDK14Logger
    extends Object
    implements SFLogger
    Use java.util.logging to implements SFLogger.

    Log Level mapping from SFLogger to java.util.logging: ERROR -- SEVERE WARN -- WARNING INFO -- INFO DEBUG -- FINE TRACE -- FINEST

    Created by hyu on 11/17/16.

    • Field Detail

      • STDOUT

        public static String STDOUT
    • Constructor Detail

      • JDK14Logger

        public JDK14Logger​(String name)
    • Method Detail

      • isDebugEnabled

        public boolean isDebugEnabled()
        Description copied from interface: SFLogger
        Is debug level enabled?
        Specified by:
        isDebugEnabled in interface SFLogger
        Returns:
        true if the trace level is DEBUG
      • isErrorEnabled

        public boolean isErrorEnabled()
        Description copied from interface: SFLogger
        Is error level enabled?
        Specified by:
        isErrorEnabled in interface SFLogger
        Returns:
        true if the trace level is ERROR
      • isInfoEnabled

        public boolean isInfoEnabled()
        Description copied from interface: SFLogger
        Is info level enabled?
        Specified by:
        isInfoEnabled in interface SFLogger
        Returns:
        true if the trace level is INFO
      • isTraceEnabled

        public boolean isTraceEnabled()
        Description copied from interface: SFLogger
        Is trace level enabled?
        Specified by:
        isTraceEnabled in interface SFLogger
        Returns:
        true if the trace level is TRACE
      • isWarnEnabled

        public boolean isWarnEnabled()
        Description copied from interface: SFLogger
        Is warn level enabled?
        Specified by:
        isWarnEnabled in interface SFLogger
        Returns:
        true if the trace level is WARN
      • debug

        public void debug​(String msg,
                          boolean isMasked)
        Specified by:
        debug in interface SFLogger
      • debug

        public void debug​(String msg,
                          Object... arguments)
        Description copied from interface: SFLogger
        Logs message at DEBUG level.
        Specified by:
        debug in interface SFLogger
        Parameters:
        msg - Message or message format
        arguments - objects that supply value to placeholders in the message format. Expensive operations that supply these values can be specified using lambdas implementing ArgSupplier so that they are run only if the message is going to be logged. E.g., Logger.debug("Value: {}", (ArgSupplier) () -> expensiveOperation());
      • error

        public void error​(String msg,
                          boolean isMasked)
        Specified by:
        error in interface SFLogger
      • error

        public void error​(String msg,
                          Object... arguments)
        Description copied from interface: SFLogger
        Logs message at ERROR level.
        Specified by:
        error in interface SFLogger
        Parameters:
        msg - Message or message format
        arguments - objects that supply value to placeholders in the message format. Expensive operations that supply these values can be specified using lambdas implementing ArgSupplier so that they are run only if the message is going to be logged. E.g., Logger.warn("Value: {}", (ArgSupplier) () -> expensiveOperation());
      • info

        public void info​(String msg,
                         boolean isMasked)
        Specified by:
        info in interface SFLogger
      • info

        public void info​(String msg,
                         Object... arguments)
        Description copied from interface: SFLogger
        Logs message at INFO level.
        Specified by:
        info in interface SFLogger
        Parameters:
        msg - Message or message format
        arguments - objects that supply value to placeholders in the message format. Expensive operations that supply these values can be specified using lambdas implementing ArgSupplier so that they are run only if the message is going to be logged. E.g., Logger.info("Value: {}", (ArgSupplier) () -> expensiveOperation());
      • trace

        public void trace​(String msg,
                          boolean isMasked)
        Specified by:
        trace in interface SFLogger
      • trace

        public void trace​(String msg,
                          Object... arguments)
        Description copied from interface: SFLogger
        Logs message at TRACE level.
        Specified by:
        trace in interface SFLogger
        Parameters:
        msg - Message or message format
        arguments - objects that supply value to placeholders in the message format. Expensive operations that supply these values can be specified using lambdas implementing ArgSupplier so that they are run only if the message is going to be logged. E.g., Logger.trace("Value: {}", (ArgSupplier) () -> expensiveOperation());
      • warn

        public void warn​(String msg,
                         boolean isMasked)
        Specified by:
        warn in interface SFLogger
      • warn

        public void warn​(String msg,
                         Object... arguments)
        Description copied from interface: SFLogger
        Logs message at WARN level.
        Specified by:
        warn in interface SFLogger
        Parameters:
        msg - Message or message format
        arguments - objects that supply value to placeholders in the message format. Expensive operations that supply these values can be specified using lambdas implementing ArgSupplier so that they are run only if the message is going to be logged. E.g., Logger.warn("Value: {}", (ArgSupplier) () -> expensiveOperation());
      • addHandler

        public static void addHandler​(Handler handler)
      • removeHandler

        public static void removeHandler​(Handler handler)
      • setUseParentHandlers

        public static void setUseParentHandlers​(boolean value)
      • setLevel

        public static void setLevel​(Level level)
      • getLevel

        public static Level getLevel()
      • instantiateLogger

        public static void instantiateLogger​(Level level,
                                             String logPath)
                                      throws IOException
        This is way to enable logging in JDBC through TRACING parameter or sf client config file.
        Parameters:
        level -
        Throws:
        IOException