Different configuration options to turn logging On/Off for explicit entities and users

For integrating the Logging Framework, following are the configuration options using which we can turn logging on or off for explicit entities and users:

  1. The common thing that needs to be added to see logging on or off for explicit entities and users is,

    <add key="serilog:using:FilterExpressions" value="Serilog.Filters.Expressions" />

  2. To turn logging On/Off for explicit entities or classes,
    1. To turn On, add the following configuration keys,

      <add key="serilog:filter:ByIncluding.expression" value="SourceContext = 'GenericEntity'" />
      Where 'Generic entity' is just an example of a class name for which you want to see logging.

    2. To turn it Off, you just need to remove the above-mentioned configuration key from the file.
  3. Turn logging On/Off for explicit users,
    1. To turn On, add the following configuration keys,
      <add key="serilog:filter:ByIncluding.expression" value="UserName = 'TestUser'" />
      Where 'TestUser' is just an example of a username for which you want to see logging.
    2. To turn it Off, you just need to remove the above-mentioned configuration key from the file.

Customizing config options for Aptify specific items we put into the OutputTemplate

For customizing config options for Aptify specific items we put into the OutputTemplate, you can edit the below given configuration key in the file:

<add key="serilog:write-to:RollingFile.outputTemplate" value="[{Timestamp:hh:mm:ss}
{Level:u3}] [UserCredentials: {UserContext}] [ClassName:{SourceContext}] {Message}