Class AppLogService
- java.lang.Object
-
- fr.paris.lutece.portal.service.util.AppLogService
-
public final class AppLogService extends java.lang.ObjectThis class provides writing services in the application logs files
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddebug(java.lang.Object objToLog)Log a message object with the DEBUG level.static voiddebug(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theDEBUGlevel.static voiddebug(java.lang.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 theDEBUGlevel.static voiderror(java.lang.Object objToLog)Log a message object with the ERROR Level.static voiderror(java.lang.Object message, java.lang.Throwable t)Log a message object with the ERROR level including the stack trace of the Throwable t passed as parameter.static voiderror(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theERRORlevel.static voiderror(java.lang.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 theERRORlevel.static java.util.Collection<LoggerInfo>getLoggersInfo()Gets the all the loggers.static voidinfo(java.lang.Object objToLog)Log a message object with the INFO Level in application.logstatic voidinfo(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theINFOlevel.static voidinfo(java.lang.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 theINFOlevel.static booleanisDebugEnabled()Tells if the logger accepts debug messages.static booleanisDebugEnabled(java.lang.String strLogger)Tells if the logger accepts debug messages.static booleanisErrorEnabled()Tells if the logger accepts error messages.static booleanisInfoEnabled()Tells if the logger accepts info messages.
-
-
-
Method Detail
-
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(java.lang.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(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theDEBUGlevel. 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(java.lang.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 theDEBUGlevel.- 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(java.lang.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(java.lang.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(java.lang.Object message, java.lang.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 logt- the exception to log, including its stack trace
-
error
public static void error(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theERRORlevel. 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(java.lang.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 theERRORlevel.- 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(java.lang.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(java.lang.String message, java.lang.Object... params)Logs a message with parameters at theINFOlevel. 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(java.lang.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 theINFOlevel.- 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 java.util.Collection<LoggerInfo> getLoggersInfo()
Gets the all the loggers.- Returns:
- the all the loggers
-
-