Class SanitizedLogger

java.lang.Object
org.identityconnectors.common.logging.SanitizedLogger
All Implemented Interfaces:
LogSpi

public class SanitizedLogger extends Object implements LogSpi
SanitizedLogger implements LogSpi. Used to wrap the configured LogSpi instance returned in Log.getLog(java.lang.Class<?>, org.identityconnectors.common.logging.LogSpi) to sanitize control characters in log messages to prevent log injection attacks.
  • Constructor Details

    • SanitizedLogger

      public SanitizedLogger(LogSpi logger)
      Implementation of LogSpi that sanitizes log messages before delegating to the configured logger.
  • Method Details

    • log

      public void log(Class<?> clazz, String method, Log.Level level, String message, Throwable ex)
      Sanitize control characters from log messages before delegating to the configured LogSpi class.
      Specified by:
      log in interface LogSpi
      Parameters:
      clazz - Class that logging.
      level - the level at which to log.
      message - optional message to send to the log.
      ex - optional exception at logging point.
    • log

      public void log(Class<?> clazz, StackTraceElement caller, Log.Level level, String message, Throwable ex)
      Sanitize control characters from log messages before delegating to the configured LogSpi class.
      Specified by:
      log in interface LogSpi
      Parameters:
      clazz - Class that logging.
      level - the level at which to log.
      message - optional message to send to the log.
      ex - optional exception at logging point.
    • isLoggable

      public boolean isLoggable(Class<?> clazz, Log.Level level)
      Description copied from interface: LogSpi
      Determines if the it should be logged based on Class and Level.
      Specified by:
      isLoggable in interface LogSpi
    • needToInferCaller

      public boolean needToInferCaller(Class<?> clazz, Log.Level level)
      Description copied from interface: LogSpi
      Determines if Log need to infer caller based on Class and Level.
      Specified by:
      needToInferCaller in interface LogSpi