Class LogHelper

java.lang.Object
de.bund.bva.isyfact.logging.util.LogHelper

public class LogHelper extends Object
Helper class for creating log entries. It provides the other helper classes of this component with a mechanism for creating uniform logs.
  • Constructor Details

    • LogHelper

      public LogHelper(boolean loggeAufruf, boolean loggeErgebnis, boolean loggeDauer, boolean loggeDaten, boolean loggeDatenBeiException, long loggeMaximaleParameterGroesse)
      Constructor of the class. Initializes the passed in class attributes.
      Parameters:
      loggeDauer - Flag determining whether the duration of an invocation should be logged.
      loggeAufruf - Flag determining whether a method invocation should be logged.
      loggeErgebnis - Flag determining whether the result of an invocation (Success/Failure) should be logged.
      loggeDaten - Flag determining whether all data passed to a method during its invocation should be logged.
      loggeDatenBeiException - Flag determining whether the parameters of a method invocation should be logged if an exception occurs.
      loggeMaximaleParameterGroesse - Configuration property to set the maximum size limit for an invocation parameter to be included in the log.
    • LogHelper

      public LogHelper(boolean loggeAufruf, boolean loggeErgebnis, boolean loggeDauer, boolean loggeDaten, boolean loggeDatenBeiException, long loggeMaximaleParameterGroesse, BeanConverter konverter)
      Constructor of the class. Initializes the passed in class attributes.
      Parameters:
      loggeDauer - Flag determining whether the duration of an invocation should be logged.
      loggeAufruf - Flag determining whether a method invocation should be logged.
      loggeErgebnis - Flag determining whether the result of an invocation (Success/Failure) should be logged.
      loggeDaten - Flag determining whether all data passed to a method during its invocation should be logged.
      loggeDatenBeiException - Flag determining whether the parameters of a method invocation should be logged if an exception occurs.
      loggeMaximaleParameterGroesse - Configuration property to set the maximum size limit for an invocation parameter to be included in the log.
      konverter - Converter to convert beans before they are serialized.
  • Method Details

    • erstelleStandardKonverter

      public static BeanToMapConverter erstelleStandardKonverter()
      Helper method for creating a BeanToMapConverter in case no converter was provided during the invocation of the constructor.
      Returns:
      The converter that is to be used.
    • loggeAufruf

      public void loggeAufruf(IsyLogger logger, Method methode)
      Creates a log entry for the invocation of the passed in method.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
    • loggeErgebnis

      public void loggeErgebnis(IsyLogger logger, Method methode, boolean erfolgreich, Object[] parameter, Object ergebnis)
      Creates a log entry for the result of the passed in method's invocation.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
      erfolgreich - Determines whether the invocation was successful (No exceptions were thrown).
      parameter - Parameters the method was invoked with.
      ergebnis - The result of the method invocation (This can also be an exception).
    • loggeDauer

      public void loggeDauer(IsyLogger logger, Method methode, long dauer, boolean erfolgreich)
      Logs the duration of a method invocation and creates a corresponding log entry.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
      dauer - The duration of the invocation.
      erfolgreich - Specifies whether the invocation was successful.
    • loggeNachbarsystemAufruf

      public void loggeNachbarsystemAufruf(IsyLogger logger, Method methode, String nachbarsystemName, String nachbarsystemUrl)
      Creates a log entry for the method invocation of an adjacent system.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
      nachbarsystemName - Name of the adjacent system.
      nachbarsystemUrl - URL of the adjacent system.
    • loggeNachbarsystemErgebnis

      public void loggeNachbarsystemErgebnis(IsyLogger logger, Method methode, String nachbarsystemName, String nachbarsystemUrl, boolean erfolgreich)
      Creates a log entry for the result of the passed in method's invocation. of an adjacent system.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
      nachbarsystemName - Name of the adjacent system.
      nachbarsystemUrl - URL of the adjacent system.
      erfolgreich - Specifies whether the invocation was successful.
    • loggeNachbarsystemDauer

      public void loggeNachbarsystemDauer(IsyLogger logger, Method methode, long dauer, String nachbarsystemName, String nachbarsystemUrl, boolean erfolgreich)
      Logs the duration of a method invocation of an adjacent system and creates a corresponding log entry.
      Parameters:
      logger - The logger that is to be used.
      methode - The invoked method.
      dauer - The duration of the invocation.
      nachbarsystemName - Name of the adjacent system.
      nachbarsystemUrl - URL of the adjacent system.
      erfolgreich - Specifies whether the invocation was successful.
    • ermittleAktuellenZeitpunkt

      public long ermittleAktuellenZeitpunkt()
      Helper method to obtain the current timestamp in milliseconds. This timestamp is used to determine the duration of a method invocation.
      Returns:
      The current timestamp in milliseconds.
    • setKonverter

      public void setKonverter(BeanToMapConverter konverter)
      Sets the value for the attribute 'konverter'.
      Parameters:
      konverter - The new value for the attribute.
    • getKonverter

      public BeanConverter getKonverter()
      Returns the currents value of the attribute 'konverter'.
      Returns:
      Value of the attribute.