Platform API: Improved Logging in Connectors for External Systems
MYOB Acumatica 2025.1 introduces improved logging of events for the connectors for external systems. Now the system logs requests and events related to the connector on the Request Profiler (SM205070) form if a user specifies the following settings on this form:
- Log Requests (Apply Filter): Selected
- Log Events (Apply Filter): Selected
- Log Level: Verbose
- Category: Commerce
For the implementation of this improvement, multiple API changes have been made. A developer needs to update their implementation of the connector as described in the following sections. For more information about the implementation of a custom connector, see Implementing a Connector for an External System.
Changes to the BCConnectorBase Class
The PX.Commerce.Core.BCConnectorBase<TGraph> abstract class now implements the PX.Commerce.Core.IConnector interface. Therefore, the BCConnectorBase<TGraph> abstract class now includes the following abstract methods:
- Process(ConnectorOperation operation, int?[] syncIDs = null, CancellationToken cancellationToken = default)
- GetSyncTime(ConnectorOperation operation)
- NavigateExtern(ISyncStatus status, ISyncDetail detail = null)
- ProcessHook(IEnumerable<BCExternQueueMessage> messages, CancellationToken cancellationToken = default)
A developer must override these methods in their implementation of a connector for an external system. Also, there is no need to derive the connector class from the IConnector interface.
Changes to the IProcessor and IConnector Interfaces
All logging methods of the PX.Commerce.Core.IProcessor and PX.Commerce.Core.IConnector interfaces have been removed.
A developer must remove their previous implementation of these methods. Instead, the developer can use the methods that are provided in the PX.Commerce.Core.Logging.CommerceLoggerExtensions class. These methods extend the functionality of the Serilog.ILogger interface.
The following code shows an example of writing a log message. The example uses the PX.Commerce.Core.BCProcessorBase<TGraph, TEntityBucket, TPrimaryMapped>.Logger class, which uses the ILogger methods.
Logger.LogCommerceVerbose(
BCLogScopeFactory.ForOperation(Operation),
LogMessages.LogSyncPerformed,
String.Join(", ", oprs));