arshad
|
|
Group: Forum Members
Posts: 3,
Visits: 11
|
Hi Due to some technical reasons we have separated logs and errors files into two individual files using serilog . In this case , logs and errors from component space trace is not getting logged . Please refer the attached serilog configuration which i have . I have also followed the below link to enable trace , which works good when i had the same configuration with name as "Serilog:Async" , but my problem is i have split the individual logger for log and error using the name "Logger", so in this case component space is not working . https://www.componentspace.com/Forums/7936/Enabling-SAML-Trace?Keywords=serilogCan anyone help me resolve this issue ?
|
|
|
ComponentSpace
|
|
ComponentSpace Development
Group: Administrators
Posts: 3.2K,
Visits: 11K
|
Could you elaborate on what's not working? I used the exact same Serilog configuration and ComponentSpace Information and Debug entries were written to the log file in the logs\WebApp\Informations folder. I've copied your config below for reference. "Serilog": { "MinimumLevel": { "Default": "Debug", "Override": { "Default": "Debug", "Microsoft": "Information", "Microsoft.Hosting.Lifetime": "Information", "ComponentSpace": "Debug" } }, "WriteTo": [ { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Error', 'Fatal', 'Warning'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Errors/error_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } }, { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Information', 'Debug'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Informations/log_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } } ], "Enrich": [ "FromLogContext", "WithMachineName" ], "Properties": { "Application": "MultipleLogFilesSample" } },
I included the following Serilog package references. <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> <PackageReference Include="Serilog.Enrichers.Context" Version="4.2.0" /> <PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" /> <PackageReference Include="Serilog.Expressions" Version="3.2.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
The information log included entries such as: 2021-09-16T11:34:15.9726192+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) ComponentSpace.Saml2, Version=3.7.0.0, Culture=neutral, PublicKeyToken=16647a1283418145, .NET 5.0 build, Licensed. 2021-09-16T11:34:15.9732505+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) CLR: .NET 5.0.10, OS: Microsoft Windows 10.0.19043, Culture: English (Australia) 2021-09-16T11:34:15.9734046+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Configuration resolver: ComponentSpace.Saml2.Configuration.Resolver.SamlConfigurationResolver 2021-09-16T11:34:15.9739768+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate manager: ComponentSpace.Saml2.Certificates.CertificateManager 2021-09-16T11:34:15.9740766+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate loader: ComponentSpace.Saml2.Certificates.CachedCertificateLoader 2021-09-16T11:34:15.9741469+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) ID cache: ComponentSpace.Saml2.Cache.DistributedIDCache 2021-09-16T11:34:15.9742400+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Artifact cache: ComponentSpace.Saml2.Cache.DistributedArtifactCache 2021-09-16T11:34:15.9743180+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) SSO session store: ComponentSpace.Saml2.Session.DistributedSsoSessionStore
Regards ComponentSpace Development
|
|
|
arshad
|
|
Group: Forum Members
Posts: 3,
Visits: 11
|
+xCould you elaborate on what's not working? I used the exact same Serilog configuration and ComponentSpace Information and Debug entries were written to the log file in the logs\WebApp\Informations folder. I've copied your config below for reference. "Serilog": { "MinimumLevel": { "Default": "Debug", "Override": { "Default": "Debug", "Microsoft": "Information", "Microsoft.Hosting.Lifetime": "Information", "ComponentSpace": "Debug" } }, "WriteTo": [ { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Error', 'Fatal', 'Warning'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Errors/error_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } }, { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Information', 'Debug'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Informations/log_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } } ], "Enrich": [ "FromLogContext", "WithMachineName" ], "Properties": { "Application": "MultipleLogFilesSample" } },
I included the following Serilog package references. <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> <PackageReference Include="Serilog.Enrichers.Context" Version="4.2.0" /> <PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" /> <PackageReference Include="Serilog.Expressions" Version="3.2.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
The information log included entries such as: 2021-09-16T11:34:15.9726192+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) ComponentSpace.Saml2, Version=3.7.0.0, Culture=neutral, PublicKeyToken=16647a1283418145, .NET 5.0 build, Licensed. 2021-09-16T11:34:15.9732505+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) CLR: .NET 5.0.10, OS: Microsoft Windows 10.0.19043, Culture: English (Australia) 2021-09-16T11:34:15.9734046+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Configuration resolver: ComponentSpace.Saml2.Configuration.Resolver.SamlConfigurationResolver 2021-09-16T11:34:15.9739768+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate manager: ComponentSpace.Saml2.Certificates.CertificateManager 2021-09-16T11:34:15.9740766+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate loader: ComponentSpace.Saml2.Certificates.CachedCertificateLoader 2021-09-16T11:34:15.9741469+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) ID cache: ComponentSpace.Saml2.Cache.DistributedIDCache 2021-09-16T11:34:15.9742400+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Artifact cache: ComponentSpace.Saml2.Cache.DistributedArtifactCache 2021-09-16T11:34:15.9743180+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) SSO session store: ComponentSpace.Saml2.Session.DistributedSsoSessionStore
Hi thanks for replying , am not having these configurations on appsettings.json file instead am having these in a custom json file and the path of that custom json file is added in the appsettings.json file. Wil that be a problem ?
|
|
|
ComponentSpace
|
|
ComponentSpace Development
Group: Administrators
Posts: 3.2K,
Visits: 11K
|
No. That shouldn't be a problem.
Regards ComponentSpace Development
|
|
|
arshad
|
|
Group: Forum Members
Posts: 3,
Visits: 11
|
+x+xCould you elaborate on what's not working? I used the exact same Serilog configuration and ComponentSpace Information and Debug entries were written to the log file in the logs\WebApp\Informations folder. I've copied your config below for reference. "Serilog": { "MinimumLevel": { "Default": "Debug", "Override": { "Default": "Debug", "Microsoft": "Information", "Microsoft.Hosting.Lifetime": "Information", "ComponentSpace": "Debug" } }, "WriteTo": [ { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Error', 'Fatal', 'Warning'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Errors/error_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } }, { "Name": "Logger", "Args": { "configureLogger": { "Filter": [ { "Name": "ByIncludingOnly", "Args": { "expression": "(@l in ['Information', 'Debug'])" } } ], "WriteTo": [ { "Name": "File", "Args": { "path": "Logs/WebApp/Informations/log_.log", "outputTemplate": "{Timestamp:o} [{Level:u3}] ({SourceContext}) {Message}{NewLine}{Exception}", "rollingInterval": "Day" } } ] } } } ], "Enrich": [ "FromLogContext", "WithMachineName" ], "Properties": { "Application": "MultipleLogFilesSample" } },
I included the following Serilog package references. <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> <PackageReference Include="Serilog.Enrichers.Context" Version="4.2.0" /> <PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" /> <PackageReference Include="Serilog.Expressions" Version="3.2.0" /> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
The information log included entries such as: 2021-09-16T11:34:15.9726192+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) ComponentSpace.Saml2, Version=3.7.0.0, Culture=neutral, PublicKeyToken=16647a1283418145, .NET 5.0 build, Licensed. 2021-09-16T11:34:15.9732505+10:00 [INF] (ComponentSpace.Saml2.SamlProvider) CLR: .NET 5.0.10, OS: Microsoft Windows 10.0.19043, Culture: English (Australia) 2021-09-16T11:34:15.9734046+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Configuration resolver: ComponentSpace.Saml2.Configuration.Resolver.SamlConfigurationResolver 2021-09-16T11:34:15.9739768+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate manager: ComponentSpace.Saml2.Certificates.CertificateManager 2021-09-16T11:34:15.9740766+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Certificate loader: ComponentSpace.Saml2.Certificates.CachedCertificateLoader 2021-09-16T11:34:15.9741469+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) ID cache: ComponentSpace.Saml2.Cache.DistributedIDCache 2021-09-16T11:34:15.9742400+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) Artifact cache: ComponentSpace.Saml2.Cache.DistributedArtifactCache 2021-09-16T11:34:15.9743180+10:00 [DBG] (ComponentSpace.Saml2.SamlProvider) SSO session store: ComponentSpace.Saml2.Session.DistributedSsoSessionStore
Hi thanks for replying , am not having these configurations on appsettings.json file instead am having these in a custom json file and the path of that custom json file is added in the appsettings.json file. Wil that be a problem ? In that case, am getting all other trace except component logs. What am i missing
|
|
|
ComponentSpace
|
|
ComponentSpace Development
Group: Administrators
Posts: 3.2K,
Visits: 11K
|
Please try the following. Modify the ExampleServiceProvider project's appsettings.json with your Serilog configuration as shown above. Add the package references as shown above. Take a look at the information log. I followed these steps and the logging worked. If there's still an issue, I suggest you zip up the modified ExampleServiceProvider project, without the binaries, and send it to [email protected] so we can rebuild the project and reproduce the issue. If the logging works with the modified ExampleServiceProvider, as it should, compare it with your application to see what's different regarding the Serilog setup.
Regards ComponentSpace Development
|
|
|