Open
Description
Hi,
I created an asp.net core project and wrote logs into Graylog:
using Serilog;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Host.UseSerilog((context, cfg) =>
{
cfg.ReadFrom.Configuration(context.Configuration);
});
var app = builder.Build();
await app.RunAsync();
Environment:
Dependencies | Version |
---|---|
.NET | 8 |
Serilog.Sinks.Graylog | 3.1.1 |
Serilog config:
"Serilog": {
"MinimumLevel": {
"Default": "Information"
},
"WriteTo": [
{
"Name": "Graylog",
"Args": {
"hostnameOrAddress": "82.156.64.210",
"port": "12201",
"transportType": "Tcp",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff} {Level:u3}] [{SourceContext:l}] {Message:lj} {NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff} {Level:u3}] [{SourceContext:l}] {Message:lj} {NewLine}{Exception}"
}
}
]
}
When I run the project, it prints 4 logs on the console, but only one message in Graylog:
But, if I debug at TcpTransport.Send
, it will write more than one message into Graylog:
In the TcpTransportClient.Send
method some messages may not be successfully sent to the network, I'm not sure.
Metadata
Metadata
Assignees
Labels
No labels