Class AppLogService

java.lang.Object
fr.paris.lutece.portal.service.util.AppLogService

public final class AppLogService extends Object
This class provides writing services in the application logs files
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debug(Object objToLog)
    Log a message object with the DEBUG level.
    static void
    debug(String message, Object... params)
    Logs a message with parameters at the DEBUG level.
    static void
    debug(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the DEBUG level.
    static void
    error(Object objToLog)
    Log a message object with the ERROR Level.
    static void
    error(Object message, Throwable t)
    Log a message object with the ERROR level including the stack trace of the Throwable t passed as parameter.
    static void
    error(String message, Object... params)
    Logs a message with parameters at the ERROR level.
    static void
    error(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the ERROR level.
    Gets the all the loggers.
    static void
    info(Object objToLog)
    Log a message object with the INFO Level in application.log
    static void
    info(String message, Object... params)
    Logs a message with parameters at the INFO level.
    static void
    info(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the INFO level.
    static boolean
    Tells if the logger accepts debug messages.
    static boolean
    Tells if the logger accepts debug messages.
    static boolean
    Tells if the logger accepts error messages.
    static boolean
    Tells if the logger accepts info messages.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isDebugEnabled

      public static boolean isDebugEnabled()
      Tells if the logger accepts debug messages. If not it prevents to build consuming messages that will be ignored.
      Returns:
      True if the logger accepts debug messages, otherwise false.
    • debug

      public static void debug(Object objToLog)
      Log a message object with the DEBUG level. It is logged in application.log
      Parameters:
      objToLog - the message object to log
    • debug

      public static void debug(String message, Object... params)
      Logs a message with parameters at the DEBUG level. To improve performance, do not use String concatenation such as : AppLogService.error( "my message with param1 " + param1 + " and " + param2, myexception ); Recommended use : AppLogService.error( "my message with param1 {} and param2 {}", param1, param2, myexception );
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • debug

      public static void debug(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the DEBUG level.
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • isDebugEnabled

      public static boolean isDebugEnabled(String strLogger)
      Tells if the logger accepts debug messages. If not it prevents to build consuming messages that will be ignored.
      Parameters:
      strLogger - The Logger name
      Returns:
      True if the logger accepts debug messages, otherwise false.
    • error

      public static void error(Object objToLog)
      Log a message object with the ERROR Level. It is logged in error.log
      Parameters:
      objToLog - the message object to log
    • error

      public static void error(Object message, Throwable t)
      Log a message object with the ERROR level including the stack trace of the Throwable t passed as parameter. It is logged in error.log
      Parameters:
      message - the message object to log
      t - the exception to log, including its stack trace
    • error

      public static void error(String message, Object... params)
      Logs a message with parameters at the ERROR level. To improve performance, do not use String concatenation such as : AppLogService.error( "my message with param1 " + param1 + " and " + param2, myexception); Recommended use : AppLogService.error( "my message with param1 {} and param2 {}", param1, param2, myexception );
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
      See Also:
      • Logger.getMessageFactory()
    • error

      public static void error(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the ERROR level.
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • isErrorEnabled

      public static boolean isErrorEnabled()
      Tells if the logger accepts error messages. If not it prevents to build consuming messages that will be ignored.
      Returns:
      True if the logger accepts error messages, otherwise false.
    • info

      public static void info(Object objToLog)
      Log a message object with the INFO Level in application.log
      Parameters:
      objToLog - the message object to log
    • info

      public static void info(String message, Object... params)
      Logs a message with parameters at the INFO level. To improve performance, do not use String concatenation such as : AppLogService.error( "my message with param1 " + param1 + " and " + param2, myexception ); Recommended use : AppLogService.error( "my message with param1 {} and param2 {}", param1, param2, myexception );
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • info

      public static void info(String message, org.apache.logging.log4j.util.Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the INFO level.
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • isInfoEnabled

      public static boolean isInfoEnabled()
      Tells if the logger accepts info messages. If not it prevents to build consuming messages that will be ignored.
      Returns:
      True if the logger accepts info messages, otherwise false.
    • getLoggersInfo

      public static Collection<LoggerInfo> getLoggersInfo()
      Gets the all the loggers.
      Returns:
      the all the loggers