Configuring Logging Framework

This page details down the step-by-step instructions to configure Logging Framework implementation. 

Prerequisite

  • Aptify 6.3 or higher version up and running

Configuration Steps

By default, there is no setting present in the config file of applications for Smart Client, Aptify Web, and Async Processor. Thus, logging will be disabled.

<add key=" Aptify.Framework.LoggerFactory.isLoggingDisabled" value="false" />

Configuring logging framework with Smart Client, Aptify Web, and Async Processor

Please follow the below given configuration steps of the integration of the Logging framework with Aptify:

  1. Go to folder structure where Aptify is installed. (For example- C:\Program Files\Aptify 5.0)
  2. Search and open the appropriate config file for the application as shown below.

    Sr NoApplicationFile Name
    1Smart Client

    AptifyShell.exe

    2Aptify WebWeb.Config
    3Async Processor

    AptifyAsyncProcessor.exe

  3. Under <appSettings> section, add the below given keys.

     Click here to view...

    <add key="serilog:using:RollingFile" value="Serilog.Sinks.RollingFile" />
    <add key="serilog:write-to:RollingFile.pathFormat" value="Your local system path" />
    <add key="serilog:write-to:RollingFile.outputTemplate" value="
    [{Timestamp:hh:mm:ss}{Level:u3}] [UserCredentials: {UserContext}] [ClassName:{SourceContext}]{Message} {NewLine}{Exception}" />
    <add key="serilog:write-to:RollingFile.rollingInterval" value="Day" />
    <add key="serilog:write-to:RollingFile.rollOnFileSizeLimit" value="true" />
    <add key="serilog:write-to:RollingFile.shared" value="true" />
    <add key="serilog:minimum-level" value="Information" />
    <add key="Aptify.Framework.LoggerFactory.isLoggingDisabled" value="False" />

  4. Add file path as shown below, where the generated log file will be placed in the path format app setting of the config file.
    Name of app setting - "serilog:write-to:RollingFile.pathFormat" Value= “add file path here”
    For example – “c:\\foldername\\log.txt”
  5. Login to Application (Smart Client/Aptify Web/Async Processor).
  6. On successful login, verify firing of log user context event by checking the log file.
    In the log file, you can see the user credentials are logged with the correct user and check for other entity relation data like person, employee, or web user (if available).

Note

For getting error and process flow information to be logged in the log file instead of event viewer

You need to add following key in the exception management section of config files of different applications.

<publisher mode="on" days="3" assembly="AptifyExceptionManagement"
type="Aptify.Framework.ExceptionManagement.SerilogPublisher"/>


Verification steps:

  1. Login to Aptify application with valid user and update a person record.
  2. Check the log file in this case, the log file should have logged correct updated data with detailed actions.
  3. Try saving person record without adding data in one of the mandatory fields. Check the log file here if the log file is giving a valid error message and it is explanatory.

Sample log file generated for an entity action

Once you generate a log file for an entity action, you can see the below-given information:

  • Time Stand
  • User Credentials
  • Class Name
  • Source Contest