Creating a pluggable audit logger - B3Partners/tailormap-legacy GitHub Wiki
Pluggable audit providers are discovered using the Java SPI (Service Provider Interface) functionality. To create a pluggable audit provider you need to:
- implement the
nl.b3p.viewer.audit.LoggingServiceinterface:
public final class NOPLoggingService implements LoggingService {
@Override
public void logMessage(String user, String message) {
}
}
- add a SPI file named
nl.b3p.viewer.audit.LoggingServicethat lists the classname of your implementation in theMETA-INF/servicesdirectory of your jar file.
nl.b3p.viewer.audit.impl.NOPLoggingService
SPI file META-INF/services/nl.b3p.viewer.audit.LoggingService
In your deployment you should add the created jar file in the WEb-INF/lib directory of the viewer webapp.
A working example is available in the viewer-audit-noplogger module.