Implementing External Logger
Other than using the default logging framework, CT-V allows you to use external logger to log details such as the operation name, the client’s IP address, the username, the date, and time to a log file.
As per your requirement, you can configure logging features such as log level and log limit. You can either upgrade the existing log4j jar files or can use any other logging framework jar files.
Note
If custom logger object is used, the default internal logging of CT-V will be disabled.
Create a Custom Logger Class
To create a custom logger class:
Implement the
IngrianLogService
interface as shown here:public interface IngrianLogService { public void debug(String msg); public void debug(String msg, Throwable t); public void error(String msg); public void error(String msg, Throwable t); public void info(String msg); public boolean isDebugEnabled(); ... }
Set the logger object on the application level:
Security.addProvider (new IngrianProvider(new CustomLogger()))
where,
CustomLogger
object is the customized logger used to implement logging methods such as debug(), info(), trace(), and error() ofIngrianLogService
interface.
Using External Logger Object
The following steps describe how to upgrade the existing log4j jar files or how to use any other logging framework jar files:
Remove the existing log4j jars (
Ingrianlog4j-core-2.10.0.jar
andIngrianlog4j-api- 2.10.0.jar
) from the classpath.Add the new logger framework jar files and the implementation of the external logger object in the classpath. For example, to use slf4j as external logger, add the following slf4j logging framework jar files in the classpath:
slf4j-simple-1.7.9.jar
slf4j-api-1.7.9.jar
logback-core-1.2.3.jar
logback-classic-1.2.3.jar
Pass the custom logger object to the Ingrian Provider:
Security.addProvider (new IngrianProvider(new CustomLogger()));