Class LogUtils


  • public final class LogUtils
    extends Object
    Since:
    5.4RC1
    Version:
    $Id: 9a667f8cc77a29add626d06f602dfdf9fd74e5b4 $
    • Method Detail

      • newLogEvent

        public static LogEvent newLogEvent​(org.slf4j.Marker marker,
                                           LogLevel level,
                                           String message,
                                           Object[] argumentArray,
                                           Throwable throwable)
        Create and return a new LogEvent instance based on the passed parameters.
        Parameters:
        marker - the log marker
        level - the log level
        message - the log message
        argumentArray - the event arguments to insert in the message
        throwable - the throwable associated to the event
        Returns:
        the LogEvent
      • newLogEvent

        public static LogEvent newLogEvent​(org.slf4j.Marker marker,
                                           LogLevel level,
                                           String message,
                                           Object[] argumentArray,
                                           Throwable throwable,
                                           long timeStamp)
        Create and return a new LogEvent instance based on the passed parameters.
        Parameters:
        marker - the log marker
        level - the log level
        message - the log message
        argumentArray - the event arguments to insert in the message
        throwable - the throwable associated to the event
        timeStamp - the number of milliseconds elapsed from 1/1/1970 until logging event was created.
        Returns:
        the LogEvent
        Since:
        6.4M1
      • newLogEvent

        @Unstable
        public static LogEvent newLogEvent​(org.slf4j.Marker marker,
                                           LogLevel level,
                                           String message,
                                           Object[] arguments)
        Create and return a new LogEvent instance based on the passed parameters.
        Parameters:
        marker - the log marker
        level - the log level
        message - the log message
        arguments - the event arguments to insert in the message and/or the Throwable associated with the message
        Returns:
        the LogEvent
        Since:
        14.0RC1
      • translate

        public static LogEvent translate​(LogEvent logEvent,
                                         String translatedMessage)
        Translate the passed LogEvent based on the passed translation message pattern.

        The translation message pattern use the same syntax than standard message pattern except that it's optionally possible to provide a custom index as in Some {1} translation {0} message in order to modify the order of the argument which can be required depending on the language.

        Parameters:
        logEvent - the LogEvent to translate
        translatedMessage - the translated version of the LogEvent message
        Returns:
        the translated version of the passed LogEvent
      • translate

        @Unstable
        public static Message translate​(Message message,
                                        String translatedPattern)
        Translate the passed Message based on the passed translation message pattern.

        The translation message pattern use the same syntax than standard message pattern except that it's optionally possible to provide a custom index as in Some {1} translation {0} message in order to modify the order of the argument which can be required depending on the language.

        Parameters:
        message - the Message to translate
        translatedPattern - the translated version of the Message message
        Returns:
        the translated version of the passed Message
        Since:
        15.0RC1, 14.10.1
      • getArgumentArray

        @Unstable
        public static Object[] getArgumentArray​(Object... arguments)
        Filter out the log Throwable from passed arguments.
        Parameters:
        arguments - the passed argument from which to filter out the throwable
        Returns:
        the actual argument
        Since:
        15.0RC1, 14.10.1
      • getThrowable

        @Unstable
        public static Throwable getThrowable​(Object... arguments)
        Extract the log Throwable from passed arguments.
        Parameters:
        arguments - the passed argument from which to extract the throwable
        Returns:
        the throwable
        Since:
        15.0RC1, 14.10.1