Skip to content
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

Can't work with .NET Aspire logging #392

Open
nicholasyin opened this issue Jan 9, 2025 · 1 comment
Open

Can't work with .NET Aspire logging #392

nicholasyin opened this issue Jan 9, 2025 · 1 comment
Labels

Comments

@nicholasyin
Copy link

using Serilog;

Log.Logger = new LoggerConfiguration()
    .WriteTo.Console()
    .CreateLogger();

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSerilog();

// Add service defaults & Aspire client integrations.
builder.AddServiceDefaults();

With this configuration, the application will not send any log content to .NET Aspire's dashboard, unless Serilog code were removed.

@nicholasyin nicholasyin added the bug label Jan 9, 2025
@nblumhardt nblumhardt added question and removed bug labels Jan 9, 2025
@nblumhardt
Copy link
Member

builder.Logging.AddSerilog() will do what you're after, preserving the rest of the default logging setup.

The serilog tag on Stack Overflow is a good source for more info if you need it. HTH!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants