Class SAPLoggingProxyListener

java.lang.Object
de.hybris.e2e.hybrisrootcauseanalysis.exceptionanalysis.SAPLoggingProxyListener
All Implemented Interfaces:
HybrisLogListener

public class SAPLoggingProxyListener extends Object implements HybrisLogListener
A listener to serve as a proxy to the SAP Logging framework (ListLog 2.0) Upon initialization, this listener registers itself with the Hybris logging framework and acts as a proxy to the SAP ListLog logging framework. Whenever a log event occurs, this framework simply passes it to the SAP's SimpleLogger interface which has builtin logic to determine whether the event should be logged or traced. The isEnabledFor() is set by the enableevents property. If set to true, enables the event flow (tracing and logging). In addition the determination of whether the log or trace should be written is done by the SAP logging framework. Important: This proxy listener will suppress any logging event which doesn't pass the Root logger's threshold level. For example, if the root logger is set to OFF, then the log/trace severities of the SAP logging framework won't matter. Here are a few example scenarios: (2) Root logger = OFF, SAP Log severity = DEBUG => No messages will be logged (2) Root logger = DEBUG, SAP Log severity = DEBUG => All messages will get logged (3) Root logger = ERROR, SAP log severity = DEBUG => Only ERROR and FATAL messages will get logged
  • Field Details

  • Constructor Details

    • SAPLoggingProxyListener

      public SAPLoggingProxyListener()
  • Method Details

    • init

      public void init()
      Initializes some of the properties and registers the listener with HybrisLogger
    • register

      public void register()
      Registers this listener with HybrisLogger
    • deregister

      public void deregister()
      Deregisters the listener from HybrisLogger
    • isEnabledFor

      public boolean isEnabledFor(org.apache.log4j.Level level)
      Decides whether the current logging event should be logged or not By default it's set to true. This listener is just a proxy to the SAP logging framework, it just passed the logging event to the framwork. Then, the framework has builtin logic to determine whether to log/trace the event or not.
      Specified by:
      isEnabledFor in interface HybrisLogListener
      Parameters:
      level - level of the log which has to be checked for filtering
      Returns:
      true, if level is OK and log can be passed to log method, false otherwise
    • log4jLevelToSAPSeverity

      protected int log4jLevelToSAPSeverity(org.apache.logging.log4j.Level level)
      Maps default Log4J 2 Level to SAP Severity
      Parameters:
      level - The Log4J level
      Returns:
      mapped SAP Severity
    • log4jConvertLevel1to2

      protected org.apache.logging.log4j.Level log4jConvertLevel1to2(org.apache.log4j.Level level)
      Converts Log4J 1 Level to Log4J 2 Level NOTE: The class HybrisLoggingEvent is still using the Log4J 1.2 Level. Therefore, this class is just there to map the old levels to new ones.
      Parameters:
      level - Level object from Log4J 1.2 package
      Returns:
      Level object from Log4J 2.5 package
    • log

      public void log(HybrisLoggingEvent e)
      Writes the log or trace to the physical file. Collects all the information about the logging event and writes the log and trace if necessary. SAP logging api provides SimpleLogger interface to write the logs and traces to phyical files. The api internally determines when to write the log or trace based on the severities we set. This is also the reason that the isEnabledFor() method is always returning true.
      Specified by:
      log in interface HybrisLogListener
      Parameters:
      e - the log which will be processed
    • setLogFilePath

      public void setLogFilePath(String logFilePath)
    • setTraceFilePath

      public void setTraceFilePath(String traceFilePath)
    • setLogSeverity

      public void setLogSeverity(String logSeverity)
    • setTraceSeverity

      public void setTraceSeverity(String traceSeverity)
    • setRotationSize

      public void setRotationSize(int rotationSize)
    • setRotationCount

      public void setRotationCount(int rotationCount)
    • setCsnComponentName

      public void setCsnComponentName(String csnComponentName)
    • setDcComponentName

      public void setDcComponentName(String dcComponentName)
    • setEnableEvents

      public void setEnableEvents(boolean enableEvents)
    • setEnableTracing

      public void setEnableTracing(boolean enableTracing)
    • setDataSupplierRepositoryService

      public void setDataSupplierRepositoryService(DataSupplierRepositoryService dataSupplierRepositoryService)
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)
    • getLogSeverity

      public String getLogSeverity()
    • getTraceSeverity

      public String getTraceSeverity()
    • isEnableTracing

      public boolean isEnableTracing()
    • isEnableEvents

      public boolean isEnableEvents()
    • getLogFilePath

      public String getLogFilePath()
    • getTraceFilePath

      public String getTraceFilePath()
    • getRotationCount

      public int getRotationCount()
    • getRotationSize

      public int getRotationSize()