Package org.xwiki.logging
Class LogUtils
- java.lang.Object
-
- org.xwiki.logging.LogUtils
-
public final class LogUtils extends Object
- Since:
- 5.4RC1
- Version:
- $Id: 9a667f8cc77a29add626d06f602dfdf9fd74e5b4 $
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object[]getArgumentArray(Object... arguments)Filter out the logThrowablefrom passed arguments.static ThrowablegetThrowable(Object... arguments)Extract the logThrowablefrom passed arguments.static LogEventnewLogEvent(org.slf4j.Marker marker, LogLevel level, String message, Object[] arguments)Create and return a newLogEventinstance based on the passed parameters.static LogEventnewLogEvent(org.slf4j.Marker marker, LogLevel level, String message, Object[] argumentArray, Throwable throwable)Create and return a newLogEventinstance based on the passed parameters.static LogEventnewLogEvent(org.slf4j.Marker marker, LogLevel level, String message, Object[] argumentArray, Throwable throwable, long timeStamp)Create and return a newLogEventinstance based on the passed parameters.static LogEventtranslate(LogEvent logEvent, String translatedMessage)Translate the passedLogEventbased on the passed translation message pattern.static Messagetranslate(Message message, String translatedPattern)Translate the passedMessagebased on the passed translation message pattern.
-
-
-
Method Detail
-
newLogEvent
public static LogEvent newLogEvent(org.slf4j.Marker marker, LogLevel level, String message, Object[] argumentArray, Throwable throwable)
Create and return a newLogEventinstance based on the passed parameters.- Parameters:
marker- the log markerlevel- the log levelmessage- the log messageargumentArray- the event arguments to insert in the messagethrowable- 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 newLogEventinstance based on the passed parameters.- Parameters:
marker- the log markerlevel- the log levelmessage- the log messageargumentArray- the event arguments to insert in the messagethrowable- the throwable associated to the eventtimeStamp- 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 newLogEventinstance based on the passed parameters.
-
translate
public static LogEvent translate(LogEvent logEvent, String translatedMessage)
Translate the passedLogEventbased 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} messagein order to modify the order of the argument which can be required depending on the language.
-
translate
@Unstable public static Message translate(Message message, String translatedPattern)
Translate the passedMessagebased 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} messagein order to modify the order of the argument which can be required depending on the language.
-
getArgumentArray
@Unstable public static Object[] getArgumentArray(Object... arguments)
Filter out the logThrowablefrom passed arguments.- Parameters:
arguments- the passed argument from which to filter out the throwable- Returns:
- the actual argument
- Since:
- 15.0RC1, 14.10.1
-
-