Closed Su-s closed 1 year ago
@Su-s please replace requestHeader:{RequestHeader}
with clientAgent:{UserAgent}
and let me know the result.
by keeping the changes in the enriched, correct?
now also the log did not changed
also the serilog is not showing the clientagent details in seq
I added a sample project. Check the branch and see if it is working, use the enricher configuration in the appsettings.json
file and also make sure your requests has the User-Agent
header.
the agent and correlation id are working with your sample code.
but I had updated the code slightly so that it match with the settings in my application, and found that the after applying the change to set the log level no logs were displaying after the application start
"MinimumLevel": { "Default": "Verbose", "Override": { "Microsoft.AspNetCore": "Warning", "Microsoft": "Information", "Microsoft.EntityFrameworkCore.Database.Command": "Error", "Microsoft.AspNetCore.SignalR": "Information", "Microsoft.AspNetCore.Http.Connections": "Information" } },
the logs in the above screenshot are the only logs getting in appliaction
When you run your application for the first time (application startup), these fields are null (first 4 lines of logs) and when client sends request to your application, they should have values. Send a request from your browser and check the logs again.
yes, understood that. i have updated the serilog wrodaroud app to make the changes work
https://github.com/Su-s/serilogworkaround/commit/d5673b0206d20de17c19ceb5c6b54fa01f5885bc
could you please take a look and suggest me the changes.
when i did the sample without additional configuration, just like the code in your sample app, there were no issues. but its not working as expected, like as before. even after adding the changes you mentioned in the sample app
when i try to debug the httpcontext become null, please check the image
meanwhile the same on your sample application
like this
I've added builder.Services.AddHttpContextAccessor();
to your code and it fixed the problem.
Hi this is my serilog configuration in app.settings.json
I have updated the client agent to request header according to the enricher package change. But now, im not able to display the client agent details in log.
Please help me to fix the issue