Class AppLogService
java.lang.Object
fr.paris.lutece.portal.service.util.AppLogService
This class provides writing services in the application logs files
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidLog a message object with the DEBUG level.static voidLogs a message with parameters at theDEBUGlevel.static voidLogs a message with parameters which are only to be constructed if the logging level is theDEBUGlevel.static voidLog a message object with the ERROR Level.static voidLog a message object with the ERROR level including the stack trace of the Throwable t passed as parameter.static voidLogs a message with parameters at theERRORlevel.static voidLogs a message with parameters which are only to be constructed if the logging level is theERRORlevel.static org.apache.logging.log4j.LoggerReturns "lutece.application" a Logger .static voidLog a message object with the INFO Level in application.logstatic voidLogs a message with parameters at theINFOlevel.static voidLogs a message with parameters which are only to be constructed if the logging level is theINFOlevel.static booleanTells if the logger accepts debug messages.static booleanisDebugEnabled(String strLogger) Tells if the logger accepts debug messages.static booleanTells if the logger accepts error messages.static booleanTells if the logger accepts info messages.
-
Method Details
-
getLogger
public static org.apache.logging.log4j.Logger getLogger()Returns "lutece.application" a Logger .- Returns:
- The "lutece.application" Logger.
-
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
Log a message object with the DEBUG level. It is logged in application.log- Parameters:
objToLog- the message object to log
-
debug
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(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
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
Log a message object with the ERROR Level. It is logged in error.log- Parameters:
objToLog- the message object to log
-
error
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
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(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
Log a message object with the INFO Level in application.log- Parameters:
objToLog- the message object to log
-
info
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(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.
-