Logging SDK plugins
PingFederate provides an SLF4J logger for application events, and LoggingUtil for security events.
SLF4J
For diagnostic and debug messages, use SLF4J. The SDK includes slf4j-api as a public dependency, so it’s on the classpath and needs no additional Maven configuration.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyPlugin implements SomePluginInterface {
private static final Logger log = LoggerFactory.getLogger(MyPlugin.class);
public void doSomething() {
log.debug("Starting operation");
if (somethingFailed) {
log.error("Operation failed", exception);
}
}
}
These messages go to the PingFederate application log, which is typically <pingfed-install>/pingfederate/log/server.log. Learn more about logging in Logging.
Because slf4j-api is a facade, PingFederate can bind it to any logging framework without having to reconfigure your plugin.
LoggingUtil
For messages that you want to track in the PingFederate security audit trail, like authentication attempts, access decisions, or suspicious activity, use com.pingidentity.sdk.logging.LoggingUtil. It’s part of the SDK:
import com.pingidentity.sdk.logging.LoggingUtil;
// Set transaction correlation IDs for audit trail tracking
LoggingUtil.setRequestJti(jwtId); // JWT ID
LoggingUtil.setRequestId(transactionId); // Transaction correlation ID
Don’t create your on logger for audit events. LoggingUtil handles the integration with PingFederate’s audit system.
Learn more about LoggingUtil in the SDK javadocs at <pingfed-install>/pingfederate/sdk/doc/com/pingidentity/sdk/logging/LoggingUtil.html.