com.amazon.redshift.logger

## Class RedshiftLogger

- java.lang.Object
- - com.amazon.redshift.logger.RedshiftLogger

    public class RedshiftLogger
    extends Object

Logger for each connection or at driver.

Author:
  iggarish

### Constructor Summary

Constructors
Constructor and Description
`RedshiftLogger(String fileName, String logLevel, boolean driver, String maxLogFileSize, String maxLogFileCount)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static boolean` `checkLogLevel(LogLevel level, RedshiftLogger log)` Determines if logging should occur based on the LogLevel.
`void` `close()`
`void` `flush()`
`static RedshiftLogger` `getDriverLogger()`
`static String` `getLogFileUsingPath(String logLevel, String logPath)`
`LogLevel` `getLogLevel()`
`static boolean` `isEnable()` Check for logging enable or not.
`void` `log(LogLevel logLevel, String msg, Object... msgArgs)`
`void` `log(LogLevel logLevel, Throwable thrown, String msg, Object... msgArgs)`
`void` `logDebug(String msg, Object... msgArgs)`
`void` `logError(Exception error)`
`void` `logError(String msg, Object... msgArgs)`
`void` `logFunction(boolean entry, Object... params)`
`void` `logInfo(String msg, Object... msgArgs)`
`static String` `maskSecureInfo(String msg, String[] tokens, String tokenizer)`
`static Properties` `maskSecureInfoInProps(Properties info)`
`static String` `maskSecureInfoInUrl(String url)`
`static void` `removeUnrecognizedPropertiesFromLogging(Properties loggedProperties)` fetches set of properties defined in the RedshiftProperty enum class and properties defined in public docs compares against given properties and removes unrecognized properties from logs
`static String` `replaceIgnoreCase(Properties info, String key, String newVal)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RedshiftLogger

    public RedshiftLogger(String fileName,
                          String logLevel,
                          boolean driver,
                          String maxLogFileSize,
                          String maxLogFileCount)

### Method Detail

#### isEnable

    public static boolean isEnable()

Check for logging enable or not.

Returns:
  true if any of the connection enable the logging, false otherwise.

#### getDriverLogger

    public static RedshiftLogger getDriverLogger()

#### getLogLevel

    public LogLevel getLogLevel()

#### checkLogLevel

    public static boolean checkLogLevel(LogLevel level,
                                        RedshiftLogger log)

Determines if logging should occur based on the LogLevel.

Parameters:
  `level` - The level of logging to attempt.
  `log` - The ILogger to try to log to.
Returns:
  True if logging is to be done according to LogLevel; false otherwise.

#### maskSecureInfoInUrl

    public static String maskSecureInfoInUrl(String url)

#### maskSecureInfo

    public static String maskSecureInfo(String msg,
                                        String[] tokens,
                                        String tokenizer)

#### maskSecureInfoInProps

    public static Properties maskSecureInfoInProps(Properties info)

#### removeUnrecognizedPropertiesFromLogging

    public static void removeUnrecognizedPropertiesFromLogging(Properties loggedProperties)

fetches set of properties defined in the RedshiftProperty enum class and properties defined in public docs compares against given properties and removes unrecognized properties from logs

#### replaceIgnoreCase

    public static String replaceIgnoreCase(Properties info,
                                           String key,
                                           String newVal)

#### log

    public void log(LogLevel logLevel,
                    String msg,
                    Object... msgArgs)

#### log

    public void log(LogLevel logLevel,
                    Throwable thrown,
                    String msg,
                    Object... msgArgs)

#### logError

    public void logError(Exception error)

#### logError

    public void logError(String msg,
                         Object... msgArgs)

#### logInfo

    public void logInfo(String msg,
                        Object... msgArgs)

#### logFunction

    public void logFunction(boolean entry,
                            Object... params)

#### logDebug

    public void logDebug(String msg,
                         Object... msgArgs)

#### close

    public void close()

#### flush

    public void flush()

#### getLogFileUsingPath

    public static String getLogFileUsingPath(String logLevel,
                                             String logPath)