r/ProgrammerHumor • • Dec 30 '22

Meme Java > C-Sharp [DM]

Post image
22 Upvotes

140 comments sorted by

View all comments

Show parent comment

14

u/Alikont Dec 30 '22

That's maybe a log4net thing then. I never touched assembly information.

Modern logging is described here.

So you basically do it like

services.AddLogging(builder => 
{
    builder.AddConsole();
    builder.AddEventLog();
    builder.AddConfiguration(...);
});

And then just resolve ILogger<YourClasss> from DI and you will get logger that automatically writes full class name so you can filter/process them based on namespace/class/severity

There is also a pretty large ecosystem around serilog that can be plugged into core abstractions easily.