Repository navigation
The AsyncActionLogger.Adapter Interface
The AsyncActionLogger.Adapter interface provides a way to connect your preferred logging framework to consume internal logs generated by the framework.
The framework determines which logging adapter to use based on the LoggerPlugin AsyncActionParameter__mdt record. If no custom adapter is configured or if the specified adapter is invalid, the framework uses the built-in DefaultLogger that writes to System.debug.
Important: The framework performs asynchronous runs as the Automated Process user. To see these debug logs, enable a trace flag on this system user.
The framework includes AsyncActionLogger.NebulaAdapter, which sends its logs to Nebula Logger without a custom adapter or a package dependency. Set the LoggerPlugin parameter to AsyncActionLogger.NebulaAdapter. It works with both Nebula Logger's unlocked package and its managed (Nebula namespace) package. If Nebula Logger isn't installed, the framework falls back to the DefaultLogger.
This requires Nebula Logger v4.14.10 or newer. Framework logs are added as Nebula Logger entries with the apex-async-actions tag, and saved using Nebula Logger's default save method. When the framework logs an exception, the exception is passed to Nebula Logger so its type and stack trace are recorded.
Each entry's origin is AsyncActionLogger.NebulaAdapter.log until Nebula Logger releases CallableLogger's ignoreOrigin action. The framework already calls it, so once your Nebula Logger version supports it, entries show the framework method that logged them instead.
Logs a message at the specified level.
Saves/commits any pending log entries. Implementation depends on the logging adapter.
This example routes internal framework logs to a custom MyLogger class:
global class MyLoggerAdapter implements AsyncActionLogger.Adapter {
global void log(System.LoggingLevel level, Object logMessage) {
MyLogger.add(level, String.valueOf(logMessage));
}
global void save() {
MyLogger.flush();
}
}- AsyncAction__c
- AsyncActionProcessor__mdt
- AsyncActionParameter__mdt
- AsyncActionScheduledJob__mdt
- AsyncActionScheduledJobItem__mdt