Table of Contents

Shared Service Settings

You may have noticed that some settings in the appsettings.json files have the same values across different services. It is possible to share those settings in a shared settings file by referring to it with the json setting SharedSettingFiles.

However, the use of SharedSettingFiles is not needed anymore, but it is still supported. All framework services and process will refer automatically to the main appsettings.json file. Even more, a fresh install of the framework comes with its own single appsettings.json file without any service specific settings files.

Note

Any description of Serilog settings only apply to framework versions before v5. Starting with framework v5 those settings can be removed as all logging settings are migrated and consolidated in a single new BamConfig section of a general appsettings.json file. It means that these separate Serilog settings are ignored if still present.

Old Situation

Let's say you have the following setting files for the Authority Service and the Core Service.

Old Core Service Settings File

{
    "Serilog": {
        "MinimumLevel": "Information",
        "WriteTo": [
            {
                "Name": "File",
                "Args": {
                    "path": "C:\\Program Files (x86)\\Ometa BVBA\\Log\\Services\\Ometa.Framework.Web.log",
                    "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fffffff} [{Level}-{ThreadId}]: {Message}{NewLine}{Exception}",
                    "shared": false,
                    "retainedFileCountLimit": 24,
                    "fileSizeLimitBytes": 2097152,
                    "rollOnFileSizeLimit": true,
                    "rollingInterval": "Day"
                }
            }
        ],
        "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId", "WithProcessId", "WithProcessName" ],
        "Properties": {
            "Application": "Ometa.Framework.Web"
        }
    },
    "ConnectionStrings": {
        "OmetaFrameworkDatabase": "Data Source=sqlserver.yourdomain.net;database=yourframeworkdatabase;trusted_connection=yes;TrustServerCertificate=True;"
    }
}

Old Authority Service Settings File

{
    "Serilog": {
        "MinimumLevel": "Information",
        "WriteTo": [
            {
                "Name": "File",
                "Args": {
                    "path": "C:\\Program Files (x86)\\Ometa BVBA\\Log\\Services\\Ometa.Framework.Authority.log",
                    "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fffffff} [{Level}-{ThreadId}]: {Message}{NewLine}{Exception}",
                    "shared": false,
                    "retainedFileCountLimit": 24,
                    "fileSizeLimitBytes": 2097152,
                    "rollOnFileSizeLimit": true,
                    "rollingInterval": "Day"
                }
            }
        ],
        "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId", "WithProcessId", "WithProcessName" ],
        "Properties": {
            "Application": "Ometa.Framework.Authority"
        }
    },
    "SigningCertificate": "CN=*.yourdomain.net",
    "ConnectionStrings": {
        "OmetaFrameworkDatabase": "Data Source=sqlserver.yourdomain.net;database=yourframeworkdatabase;trusted_connection=yes;TrustServerCertificate=True;"
    }
}

You notice that the section of Serilog and the ConnectionStrings are roughly having the same values. The Serilog section uses another log filename but this can be fixed by using a property in the configuration.

New Situation

Refer to the appsettings.json article