Package de.bund.bva.isyfact.logging.util
Class LogHelper
java.lang.Object
de.bund.bva.isyfact.logging.util.LogHelper
Helper class for creating log entries. It provides the other helper classes of this component
with a mechanism for creating uniform logs.
-
Constructor Summary
ConstructorsConstructorDescriptionLogHelper(boolean loggeAufruf, boolean loggeErgebnis, boolean loggeDauer, boolean loggeDaten, boolean loggeDatenBeiException, long loggeMaximaleParameterGroesse) Constructor of the class.LogHelper(boolean loggeAufruf, boolean loggeErgebnis, boolean loggeDauer, boolean loggeDaten, boolean loggeDatenBeiException, long loggeMaximaleParameterGroesse, BeanConverter konverter) Constructor of the class. -
Method Summary
Modifier and TypeMethodDescriptionlongHelper method to obtain the current timestamp in milliseconds.static BeanToMapConverterHelper method for creating a BeanToMapConverter in case no converter was provided during the invocation of the constructor.Returns the currents value of the attribute 'konverter'.voidloggeAufruf(IsyLogger logger, Method methode) Creates a log entry for the invocation of the passed in method.voidloggeDauer(IsyLogger logger, Method methode, long dauer, boolean erfolgreich) Logs the duration of a method invocation and creates a corresponding log entry.voidloggeErgebnis(IsyLogger logger, Method methode, boolean erfolgreich, Object[] parameter, Object ergebnis) Creates a log entry for the result of the passed in method's invocation.voidloggeNachbarsystemAufruf(IsyLogger logger, Method methode, String nachbarsystemName, String nachbarsystemUrl) Creates a log entry for the method invocation of an adjacent system.voidloggeNachbarsystemDauer(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.voidloggeNachbarsystemErgebnis(IsyLogger logger, Method methode, String nachbarsystemName, String nachbarsystemUrl, boolean erfolgreich) Creates a log entry for the result of the passed in method's invocation.voidsetKonverter(BeanToMapConverter konverter) Sets the value for the attribute 'konverter'.
-
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
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
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
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
Sets the value for the attribute 'konverter'.- Parameters:
konverter- The new value for the attribute.
-
getKonverter
Returns the currents value of the attribute 'konverter'.- Returns:
- Value of the attribute.
-