Giter Club home page Giter Club logo

Comments (5)

andrewlock avatar andrewlock commented on June 3, 2024 1

Could you share your configuration (appsettings.json) please - bear in mind that the format required by Serilog's ReadFrom.Configuration() method is different to the default ASP.NET Core logging configuration.

from serilog-extensions-hosting.

klyse avatar klyse commented on June 3, 2024 1

Hi @nblumhardt,
never mind :). I was only confused with the configuration.

Best regards
Klyse

from serilog-extensions-hosting.

klyse avatar klyse commented on June 3, 2024

okay, after further trouble shooting I found the error somewhere in the config.
The issue that led me on the wrong path is the following:

.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration																 
    .ReadFrom.Configuration(hostingContext.Configuration)
    .Enrich.FromLogContext()
    .WriteTo.Console());

The logger does not work if the hostingContext.Configuration is either empty or not valid. Even if the .WriteTo.Console() method gets called. Correct?

Same for this example:

.UseSerilog((hostingContext, loggerConfiguration) =>
	{
		loggerConfiguration.WriteTo.Console();
	});

This way I figured that it's a logger problem and not configuration related.

from serilog-extensions-hosting.

nblumhardt avatar nblumhardt commented on June 3, 2024

I am not sure what's going on, here - some more info might be needed, if you think there's a problem in the Serilog code causing this. Cheers!

from serilog-extensions-hosting.

CarpeCodemAtGit avatar CarpeCodemAtGit commented on June 3, 2024

I have interesting issue using rabbitmq using generic host

running IHostedService and if i use UseSerilog(with configuration etc) rabbit doesnt catch message (most of the time, sometimes at start it does get a single message)

using following (tried using all 3 versions of hosting)

<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.4" />
<PackageReference Include="MongoDB.Driver" Version="2.10.4" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="2.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Graylog" Version="2.1.3" />

from serilog-extensions-hosting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.