SeriLog won't log to railway?
samson
HOBBYOP

10 months ago

Hey guys,
dumb question incoming…

I tried to setup serilog so i can log easier.

Doing this in Main()
using var logger = new LoggerConfiguration() .MinimumLevel.Debug() .Enrich.FromLogContext() .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}") .CreateLogger();

Then this in ConfigureServices:
// Konfiguriere den DI-Container var serviceProvider = ConfigureServices();

services.AddLogging(loggingBuilder => { loggingBuilder.ClearProviders(); loggingBuilder.AddSerilog(); });

And this is a test log after ConfigureServices:
var _logger = serviceProvider.GetRequiredService>(); _logger.LogDebug($"ENVIRONMENT={Environment.GetEnvironmentVariable("ENVIRONMENT")}");

A normal Console.WriteLine() is shown in railway.

Any help is highly appreciated

Solved

11 Replies

samson
HOBBYOP

10 months ago

24415e1c-9ff5-4133-b834-05af53c29590


10 months ago

are those logs going to stdout / stderr?


samson
HOBBYOP

10 months ago

should be. from what i read serilog logs to stdout / stderr


10 months ago

is it unbuffered?


samson
HOBBYOP

10 months ago

phew! how can i check that?


10 months ago

i'm not familiar with how SeriLog works. your google is as good as mine here.


samson
HOBBYOP

10 months ago

okay! i'm trying to get that info. 🙂


samson
HOBBYOP

10 months ago

The Problem is the dsharpplus framework i use doesnt support DI Loggers like that.
I have to update it.
Thanks so far!


10 months ago

no problem!

am I good to mark this as solved?


samson
HOBBYOP

10 months ago

Yes i think so 🙂


10 months ago

!s


Status changed to Solved brody 11 months ago


Loading...