Implement External Logger Object
User can create own custom logger object by implementing the IngrianLogService
interface.
public interface IngrianLogService {
public void info(String message);
public void trace(String message);
public void debug(String message);
public void debug(String message,Throwable t);
public void error(String message);
public void error(String message,Throwable t);
public void warn(String message);
public void warn(String message,Throwable t);
. . .
}
Set the above created logger object on application level as below:
Security.addProvider (new IngrianProvider(new CustomLogger()))
Here, CustomLogger
object implements all the common logging methods such as debug, info, trace, and error of IngrianLogService
interface.
Note
If Custom Logger object is used, the default internal logging of CADP for Java will be disabled.
How to use 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 jar files (log4j-core-2.17.2.jar and log4j-api-2.17.2.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 followingslf4j
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()))