The ViewerLogger class provides functionality to log messages to an integrated or user-defined logger. It serves as the global logger for the viewer module and can be used to log various events and messages.
Example usage:
// Configure the viewer logger to use the default integrated logger
ViewerLogger.setLogger(new FileLogger("/path/to/file.log"));
// Log an debug message
ViewerLogger.debug("Debug message");
// Log an error message
ViewerLogger.error("Error message");
Note: The ViewerLogger class can be configured to use a custom logger implementation by calling the setLogger(ILogger) method. By default, it uses the integrated logger provided by the viewer module.
public static void error(Throwable throwable, String message, Object[] arguments)
Writes an error log message to the console. Error log messages provide information about unrecoverable events in the application flow.
Parameters:
Parameter
Type
Description
throwable
java.lang.Throwable
The exception associated with the error log message.
message
java.lang.String
The error log message.
arguments
java.lang.Object[]
The arguments to be replaced in the message. They will replace {} placeholders in the order they are passed.
isErrorEnabled()
public static boolean isErrorEnabled()
Checks if error-level logging is enabled.
Returns:
boolean - true if error-level logging is enabled, false otherwise.
getLogger()
public static synchronized ILogger getLogger()
Gets the logger instance that will be used for logging messages. The logger instance can be used to log messages of different levels such as trace, debug, warning, and error.
Returns:
com.groupdocs.foundation.logging.ILogger - the logger instance.
setLogger(ILogger logger)
public static synchronized void setLogger(ILogger logger)
Sets the logger instance that will be used for logging messages. The logger instance can be used to log messages of different levels such as trace, debug, warning, and error.
Parameters:
Parameter
Type
Description
logger
com.groupdocs.foundation.logging.ILogger
The logger instance to set.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.