ilogger Questions

3

I'm working on setting up some logging in our ASP.NET Core 3 application, using ILogger (Microsoft.Extensions.Logging) with NLog to enable writing to text files. The problem is, that the ILogger d...
Whitelivered asked 26/5, 2020 at 8:3

4

Solved

I've updated the content of my original question as I was starting to cause some confusion amongst the people trying to help me. I am using the library "Microsoft.ApplicationInsights.AspNetCor...
Refutation asked 8/1, 2022 at 17:41

2

Some of my unit tests are failing after updating Microsoft.Extensions.Logging.Abstractions from Version=2.0.0.0 to Version=3.1.1.0. I have an ILogger mocked as so: var loggerMock = new Mock<IL...
Trader asked 11/5, 2020 at 20:37

5

Solved

I've created a .NET Core 3.1 project using a Host, the IoC container with IServiceCollection and implemented logging allover the place using the ILogger<T> interface from Microsoft.Extensions...
Lunatic asked 1/5, 2020 at 14:7

5

Solved

Since the recently introduced new structure of the Program.cs startup code, the documentation confuses me a bit. In the officially provided Serilog.AspNetCore example and in the Serilog.Sentry exam...
Moue asked 24/3, 2022 at 8:36

18

Solved

This is my controller: public class BlogController : Controller { private IDAO<Blog> _blogDAO; private readonly ILogger<BlogController> _logger; public BlogController(ILogger<Bl...
Sardanapalus asked 15/4, 2017 at 8:51

4

Solved

I have a C# .NET Core Azure Function App, and I am using the ILogger to send logs to Application Insights. This is working well so far. Function header: public static void Run([TimerTrigger("0...

3

I'm working on a fun project for myself to learn blazor, a lot of core concepts and just general practice. I'm trying to implement logger extension for FakeItEasy to easier test Microsofts ILogger....
Nibelung asked 17/10, 2020 at 15:17

1

Solved

I created the following class: public static class PingEndpoints { public static void Endpoints(this WebApplication application) { var group = application.MapGroup("ping"); group.Map...
Hippomenes asked 5/4, 2023 at 11:21

2

Solved

We want to get an ILogger instance so that it can be passed to other library. We tried below, but the ILogger instance does not log into Application Insights. It logs into Event Viewer successfully...

3

Until now, we I was mocking the ILogger.LogXXX calls by following this approach. Unfortunately, after updating the project to .net core 3.0, and if you're using strict mocks (Moq), it will always ...
Dedication asked 8/10, 2019 at 9:3

3

Solved

I'm using FunctionsStartup in an Azure Functions project to setup IoC bindings. However, any logs created from an injected ILogger<T> aren't appearing when I run it in Azure. I've created a ...
Drews asked 3/4, 2020 at 20:23

2

Solved

I have a .Net Core 3 application and am trying to test calls to ILogger in my method: public class MyClass { private readonly ILogger<MyClass> _logger; public MyClass(ILogger<MyClass&g...
Drupe asked 14/3, 2020 at 15:53

4

Solved

I have create a simple Serilog sink project that looks like this : namespace MyApp.Cloud.Serilog.MQSink { public class MessageQueueSink: ILogEventSink { private readonly IMQProducer _MQProducerS...
Underworld asked 16/2, 2022 at 16:37

11

Solved

I've configured my console application's Main like so var services = new ServiceCollection() .AddLogging(logging => logging.AddConsole()) .BuildServiceProvider(); And then I try to use it in ...
Polymorphous asked 22/10, 2018 at 3:16

2

I have a class level ILogger which is set up with the ILoggerFactory in the constructor. The logger is then used within a method within that class and this works perfectly. I am struggling on how...
Violoncellist asked 30/10, 2019 at 16:55

2

Solved

I'm setting up a new web app to log via Application Insights. I've installed AI, and am seeing all the expected telemetry (server requests, failed requests, etc.) but not logging sent through ILogg...
Recently asked 12/7, 2021 at 20:6

1

I have a system and I want to make a custom logs to create separate folders for each user. Now, I made it in NLog.Logger like a custom file target public static LogFactory ConfigureCustomNLog(strin...
Musketeer asked 1/4, 2021 at 13:59

3

I follow this document Logging in .NET Core and ASP.NET Core, try to write log to Windows EventLog. first, I create Source and Log in Windows Event Log: if (!EventLog.SourceExists("MyTestSource")...
Chequered asked 4/12, 2019 at 10:17

1

Solved

So this is my logging configuration: public static void Main(string[] args) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("apps...
Stellastellar asked 7/12, 2020 at 17:24

2

Solved

So I'm trying to setup ILogger with Dependency Injection and I'm having some trouble. In my startup.cs file I have something that looks like this: builder.Services.AddLogging(); I then try to fee...
Subordinary asked 13/8, 2020 at 21:51

1

How do I instantiate a logger implementing Microsoft.Extensions.Logging.ILogger<out TCategoryName> that will output logs to my Serilog logger, when I cannot do it via standard ASP.NET Core de...
Canvasback asked 10/6, 2020 at 11:49

2

Solved

Objects are rendered as strings, (name of the object), in Application Insights custom dimensions when passed as arguments to ilogger. The actual values are not shown. Register Application Insights...
Dagmar asked 7/3, 2020 at 22:46

1

Solved

I've using vs 2019 for a console application(dotnet core 3.1), Install-Package Microsoft.Extensions.Logging.Console -Version 3.1.2 and this code: using Microsoft.Extensions.Logging; class Prog...
Lyris asked 9/3, 2020 at 11:7

2

Solved

I'm using NLog in a .NET Core 3.1 worker service application. Following the tutorial of NLog I inserted an nlog.config file to manage the configuration. Now I'm confused because I have three points...
Swell asked 8/1, 2020 at 14:45

© 2022 - 2025 — McMap. All rights reserved.