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 (log4j2) 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 default log4j2 jar files (log4j-core-x.x.x.jar and log4j-api-x.x.x.jar) from the classpath.
Add the new logger framework jar files and the implementation of the external logger object to the classpath. For example, to use
slf4j
as external logger, addslf4j
logging framework jar files to the classpath.Pass the custom logger object to the Ingrian Provider:
Security.addProvider (new IngrianProvider(new CustomLogger()))