Questions tagged [microsoft.extensions.logging]
28 questions
1
vote
1 answer
.NET Non-host LoggerFactory configuration
I am trying to add logging to an existing .NET Framework application. I have added my own logger (called MyLogger) and put the config settings into appsettings.json like this:
{
"LogFilePath": "C:\\Temp\\Logs\\%yyyy-%MM-%dd.txt",
"Logging": {
…

Sandy
- 1,284
- 2
- 14
- 32
0
votes
1 answer
Why is my .Net 7 Console App with Log4Net and Extensions.Logging not outputting on LogDebug() even with Level set to DEBUG
I can't seem to get ILogger.LogDebug() to write using Log4Net and Microsoft.Extensions.Logging.Log4Net.AspNetCore in a .Net 7 console app. I am confident that I'm setting the 'level' element in the log4net.config file correctly to 'DEBUG'. I can…

Jayden
- 2,656
- 2
- 26
- 31
0
votes
0 answers
How to set mimimum level to serilog sinks in appsettings.json
Microsoft.Extensions.Logging Trace vs Serilog Verbose
the workaround: https://github.com/Su-s/serilogworkaround
this is the configuration in my appsettings.json
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate":…

11738472
- 184
- 3
- 22
0
votes
0 answers
Use unique features of a component while it's registered on a common interface
Let me give an example using Serilog and Microsoft.Extensions.Logging. The application uses Serilog as its logging component, the loggers can be used as ILogger by dependency injection. Serilog has a nice feature called message template that…

Cheng Chen
- 42,509
- 16
- 113
- 174
0
votes
1 answer
AsyncTaskTarget cannot get scope properties (but TargetWithContext can)
I tried to implement the solution from this SO post: Get ScopeContext properties in AsyncTaskTarget.
However, the solution seems to (no longer?) work. Or, more accurately, it does work with TargetWithContext:
public class ExampleTarget :…

marsze
- 15,079
- 5
- 45
- 61
0
votes
0 answers
Microsoft.Extensions.Logging and frameworks logging
Great that MS standardized logging with the ILogger interface (MEL), making it easy for us to set up common logging. But a side effect of frameworks (EF, ASP.NET MVC etc.) doing proper logging and sharing the LoggerFactory in the ServiceProvider, is…

Stig
- 1,974
- 2
- 23
- 50
0
votes
1 answer
Assembly is loaded differently via AssemblyResolve?
I have an app which dynamically loads a DLL from a different folder.
This DLL needs Microsoft.Extensions.Logging.dll, and if I load it before I load my DLL, it works fine:
void f()
{
…

user3570224
- 1
- 1
0
votes
0 answers
Do I have to explicitly dispose a Microsoft.Extensions.Logging.BeginScope?
I have got a series of hangfire jobs and I put in the constructor this piece of code, to use with Serilog/Seq
public CheckoutExternalToursBookingJob(
...omiss...
ILogger logger,
IEmailSender…

advapi
- 3,661
- 4
- 38
- 73
0
votes
0 answers
Micrsoft Logs AWS CloudWatch Logs
I am currently using Microsoft.Extensions.Logging to log to AWS CloudWatch , but when I look at the logs the stack trace is broken up into separate logs in cloudwatch, I read that it might be an issue with \n in the stack trace, but I'm not sure how…

user2612665
- 91
- 1
- 2
- 11
0
votes
2 answers
How to create a logging class library project that can be used by other projects that is thread safe?
We have projects in VB and C# and they all have logging. Right now the implementation of a logger factory is causing memory leaks during load test. Looks like someone tried to hack the old code to support nlog and it creates counless instances of…

Aswin Francis
- 87
- 1
- 13
0
votes
0 answers
Writing multiple log files with Log4Net using Microsoft.Extensions.Logging.Abstractions
I have successfully set up logging in my app using Microsoft.Extensions and Log4Net. But what I cannot do is log different information to different log files. With Log4Net natively, I can simply set up two rollingFileAppenders and call LogManager…

Ron
- 867
- 11
- 26
0
votes
0 answers
Why is nothing being logged?
I am currently having issues with viewing the logs my application should create.
I have using this https://elanderson.net/2019/12/log-requests-and-responses-in-asp-net-core-3/ created a middleware that should log request and responses.
I have then…

I am not Fat
- 283
- 11
- 36
0
votes
0 answers
How to return the ID of the log when logging with Microsoft.Extensions.Logging
In my .NET 6 web application I'm using the following infrastructure to log various events and exceptions:
Microsoft.Extensions.Logging as logging API
Serilog as logging framework
MS SQL database as loging sink (i.e. the target where the logs are…

dario
- 2,861
- 3
- 15
- 34