Package org.apache.synapse.commons.logger

# Class ContextAwareLogger

java.lang.Object
org.apache.synapse.commons.logger.ContextAwareLogger

public class ContextAwareLogger extends Object
This class provides the relevant context aware logging wrapper implementation according to the availability of the correlation id in the provided context and based on the expected behavior of the MDC.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContextAwareLogger()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static org.apache.commons.logging.Log`
  `getLogger(org.apache.axis2.context.MessageContext axis2MessageContext, org.apache.commons.logging.Log log, boolean removeFromMDC)`
  Provides a wrapper implementation for the given logger according to the availability of the correlation id in the axis2 and based on the expected behavior of the Correlation-ID MDC property.
  `static org.apache.commons.logging.Log`
  `getLogger(org.apache.http.protocol.HttpContext httpContext, org.apache.commons.logging.Log log, boolean removeFromMDC)`
  Provides a wrapper implementation for the given logger according to the availability of the correlation id in the httpcontext and based on the expected behavior of the Correlation-ID MDC property.
  `static void`
  `setCorrelationLoggingEnabled(Boolean correlationLoggingEnabled)`

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

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

- ## Constructor Details

  - ### ContextAwareLogger

    public ContextAwareLogger()

- ## Method Details

  - ### getLogger

    public static org.apache.commons.logging.Log getLogger(org.apache.axis2.context.MessageContext axis2MessageContext, org.apache.commons.logging.Log log, boolean removeFromMDC)
    Provides a wrapper implementation for the given logger according to the availability of the correlation id in the axis2 and based on the expected behavior of the Correlation-ID MDC property.
    Parameters:
      `axis2MessageContext` - Axis2MessageContext
      `log` - Log
      `removeFromMDC` - whether to remove the Correlation-ID property from MDC after logging
    Returns:
      log wrapper

  - ### getLogger

    public static org.apache.commons.logging.Log getLogger(org.apache.http.protocol.HttpContext httpContext, org.apache.commons.logging.Log log, boolean removeFromMDC)
    Provides a wrapper implementation for the given logger according to the availability of the correlation id in the httpcontext and based on the expected behavior of the Correlation-ID MDC property.
    Parameters:
      `httpContext` - HttpContext
      `log` - Log
      `removeFromMDC` - whether to remove the Correlation-ID property from MDC after logging
    Returns:
      log wrapper

  - ### setCorrelationLoggingEnabled

    public static void setCorrelationLoggingEnabled(Boolean correlationLoggingEnabled)