You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use it like this: _logger .ForContext("CommandName", command.Name) .ForContext("Client", client) .ForContext("Date", DateTime.Now) .ForContext("ServiceType", command.ServiceType) .ForContext("CommandType", command.CommandType) .ForContext("HttpResponseCode", (int)response.StatusCode) .ForContext("RequestBody", requestBody) .ForContext("ResponseBody", responseBody) .Error("test");
The problem is, in my case ResponseBody is ~6.8k symbols. When I comment out the line .ForContext("ResponseBody", responseBody)
logging works. I tried to set DataLength to -1 (or 8k like in current case) and re-create the table, still not working.
Please clearly describe the expected behavior:
To be able to log entries with more than (I guess) 5000 symbols.
List the names and versions of all Serilog packages used in the project:
We have currently have no plans or resources to implement a truncation for addidional columns like in your scenario but are always open for a pull request.
If you look for a way to work around this, take a look at Serilog enrichers. These are custom methods called upon log event generation which allow you to do modifications to the log event data (like truncating a value).
Bug Report
Serilog.Sinks.MSSqlServer, version 6.0.0
I created custom log table (automatically created), here is my configuration:
I use it like this:
_logger .ForContext("CommandName", command.Name) .ForContext("Client", client) .ForContext("Date", DateTime.Now) .ForContext("ServiceType", command.ServiceType) .ForContext("CommandType", command.CommandType) .ForContext("HttpResponseCode", (int)response.StatusCode) .ForContext("RequestBody", requestBody) .ForContext("ResponseBody", responseBody) .Error("test");
The problem is, in my case ResponseBody is ~6.8k symbols. When I comment out the line
.ForContext("ResponseBody", responseBody)
logging works. I tried to set DataLength to -1 (or 8k like in current case) and re-create the table, still not working.
To be able to log entries with more than (I guess) 5000 symbols.
Program.cs:
[ ] .NET Core 6.0
OS: Windows 10 Pro
can be found above
can be found above
can be found above
The text was updated successfully, but these errors were encountered: