-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NET 6 Not working #11
Comments
No issue with .NET 7 / WebAPI
Logging Registering public static void RegisterLogging(this WebApplicationBuilder builder)
{
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddSerilog(
new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration)
.Enrich.FromLogContext()
.CreateLogger());
} Setup Configuration "Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Discord" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "C:\\TEMP\\MY_APP_NAME.Api-.log",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {CorrelationId} {Level:u3}] {Username} {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "Discord",
"Args": {
"WebhookId": "105...",
"WebhookToken": "DCH..."
}
}
]
} Do not forget to create the #channel webhook Hope this help. |
It doesn't. Using async sink with inline configuration... Logger = new LoggerConfiguration()
.WriteTo.Console()
.WriteTo.File(logFile, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true)
.WriteTo.Async(x=>x.Discord(_config.Logging.DiscordWebhookId, _config.Logging.DiscordWebhookToken)).Enrich.FromLogContext()
.CreateLogger(); Logs to console, file, but not Discord. |
In the end, I used a Serilog.Sinks.Discord.Lite by Colombera Javier. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello.
I have a problem using this sink. After applying the following configuration
It receives logs to the console, but does not get them to the discord server via webhook.
I have added a webhook to the server, and from it I fetched ID and Token.
Additionally, I installed Serilog 2.12.0, DiscordNet.Webhook 2.6.1, and Serilog.Sink.Console 4.1.0
Can I ask for some hint?
The text was updated successfully, but these errors were encountered: