New logging features of Acumatica

Hello everybody,

today I want to compare two logging mechanisms of Acumatica:

  • PXTrace
  • ILogger of Microsoft.Extensions.Logging

 

In order to compare them, I've did following:

1. modified web.config

2. created C# class

Modification section pxtrace of web.config goes below:

    <pxtrace>
	    <providers>
		<remove name="PXSessionTraceProvider" />
		<add name="PXSessionTraceProvider" type="PX.Data.PXSessionTraceProvider, PX.Data"
		     url="../Frames/Trace.aspx" />
		<remove name="PXFileTraceProvider" />
		<add name="PXFileTraceProvider" type="PX.Data.PXFileTraceProvider, PX.Data"
		     file = "d:\Instances\22.202.0040\SignalR\out\AcumaticaTraceInfo.txt" />
		</providers>
    </pxtrace>

 Code goes below:

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
    public static bool IsActive() => true;
 
    [InjectDependency]
    private ILogger<SOShipmentEntry> MyLogger { getset; }
 
    public PXAction<SOShipment> trace;
 
    [PXButton(CommitChanges = true), PXUIField(DisplayName = "Trace", MapEnableRights = PXCacheRights.Select)]
    public IEnumerable Trace(PXAdapter adapter)
    {
        var sw = new Stopwatch();
        const int n = 10000;
        sw.Start();
        for (int i = 0; i < n; i++)
        {
            PXTrace.WriteInformation("Test message tracer");
        }
        sw.Stop();
 
        PXTrace.WriteInformation("------------------------------------- trace " + sw.ElapsedMilliseconds);
 
        sw.Start();
        for (int i = 0; i < n; i++)
        {
            MyLogger.LogInformation("Test message logger");
        }
        sw.Stop();
 
        PXTrace.WriteInformation("------------------------------------- logger " + sw.ElapsedMilliseconds);
 
        return adapter.Get();
    }
}

 if to sum up, these two changes do following:

1. Put all information into file AcumaticaTraceInfo.txt

2. Button is created on the form shipments: so302000

3. If user clicks on that button, then 10 000 logging messages are created using PXTrace

4. 10 000 logging messages, through Microsoft.Extensions.Logging

Additional tables

 Besides that, want to mention following tables in Acumatica, which has some loggings.

LoginTrace: All login, logout, form opening, session expiration, and customization publishing events
UPSnapshotHistory: All snapshot restore operations
UPHistory: All application updates
AUScheduleHistory: All schedule execution events
AuditHistory: All field changes (if auditing is enabled)
EMailSyncLog: All exchange synchronization operations
AUNotificationHistory: All notification operations
PushNotificationsErrors: Errors during creation of push notifications
PushNotificationsFailedToSend: Information on the push notifications that Acumatica ERP failed to send to the notification destination within the last two days

Add comment

Loading