Questions tagged [nlog]

NLog is a free logging platform for .NET

NLog is a logging platform for .NET with support for structured logging. NLog enables easy routing and filtering of output to various targets.

Resources

2784 questions
26
votes
2 answers

Microsoft.Extensions.Logging Vs. NLog

I see a lot of posts mentioning usage of Microsoft.Extensions.Logging together with NLog. I'd like to better understand what Microsoft.Extensions.Logging is used for? And specifically why is it needed or what's the benefit of using it together…
AlexVPerl
  • 7,652
  • 8
  • 51
  • 83
26
votes
5 answers

Enterprise Logging Block vs NLog vs log4net

I need to use a logging library in my project and considering between Enterprise Logging Block vs NLog vs log4net. I found some links on the comparison but most of those are quite old and complaint about things like no new versions of log4net for…
imak
  • 6,489
  • 7
  • 50
  • 73
26
votes
2 answers

Using NLog as a rollover file logger

How - if possible - can I use NLog as a rollover file logger? as if: I want to have at most 31 files for 31 days and when a new day started, if there is an old day log file ##.log, then it should be deleted but during that day all logs are appended…
Kaveh Shahbazian
  • 13,088
  • 13
  • 80
  • 139
25
votes
1 answer

How to integrate NLog to write log to Azure Streaming log

Currently I am using NLog to write my application errors to a text file. How can I configure NLog to write the error messages to Azure Streaming Log apart from writing to a Azure Blob Storage?
Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156
24
votes
4 answers

NLog throws configuration exception on all aspnet layout renderers

I have been working to set up NLog v2 on my ASP.NET MVC 3 application and it has worked very well so far. (I'm using the package from the offical nuGet repository) However, when I try to change the log layout to include any of the aspnet-* layout…
Jacob
  • 1,285
  • 2
  • 11
  • 27
23
votes
3 answers

Add, enable and disable NLog loggers programmatically

How can I add, edit, delete, enable, and disable loggers from code for NLog?
Stacker
  • 8,157
  • 18
  • 73
  • 135
23
votes
2 answers

LoggerFactory Generates InvalidOperationException

I've created a console application using Microsoft.Extensions.Logging that uses a service layer. Program.cs public static void Main(string[] args) { // Create service collection var serviceCollection = new ServiceCollection(); …
Gerald Hughes
  • 5,771
  • 20
  • 73
  • 131
22
votes
2 answers

Have NLog write to console

I'm pretty new to NLog. I have a .NET framework console application using NLog. I hope to configure NLog to write the log to console directly. I installed NLog and the NLog.Config NuGet package, with the following content in nlog.config:
checai
  • 836
  • 4
  • 11
  • 17
22
votes
3 answers

Wire and inject NLog into .NET Core console app

I created a consumer/job that I will have running as a process on Linux written in C#. The process will: Read a message from RabbitMQ Make changes to the database Log any errors All the documentation on NLog about .NET Core are on ASP.NET Core.…
Matt R
  • 2,577
  • 5
  • 30
  • 46
22
votes
2 answers

Dependency Injection wth NLog

I've got a .NET Core web app that I'm trying to add logging to via NLog. In previous projects, I've just used something like the following at the top of every class: private static Logger logger = LogManager.GetCurrentClassLogger(); I'm trying to…
Steviebob
  • 1,705
  • 2
  • 23
  • 36
22
votes
5 answers

make NLog.config file load the file from (d:\dev) instead of "\bin\debug\"

I used Nlog for logging purpose in a particular DLL. The DLL is then used in another application (it is loaded dynamically using System.Reflection.Assembly.LoadFrom(path + a.dll)). I manually placed Nlog.dll and Nlog.config files in Path folder and…
21
votes
3 answers

Are there any alternatives to Common.Logging?

EDIT: Common.Logging 2.1.1 was released on June 9, 2012 and the Github page is fairly active, with the author commenting specifically on the health of the project. We're looking at using Common.Logging in a new .NET project but I'm a bit concerned…
Tom Robinson
  • 8,348
  • 9
  • 58
  • 102
21
votes
2 answers

Having NLog loggers with different configuration

In NLog is possible to create multiple loggers with different configuration? I have a component that every time that is instanced must log all events to a different file that is related to the new instance. Is this possible with NLog? If not, there…
max
  • 213
  • 1
  • 2
  • 4
21
votes
2 answers

WCF logging/tracing and activity id propagation using log4net or NLog

I have seen many other questions on logging. Best practices. What logging platform is best. Etc. Here are some links from here on SO with very good discussions on the topic: logging best practices log4net vs TraceSource best logging solution for…
wageoghe
  • 27,390
  • 13
  • 88
  • 116
21
votes
10 answers

Config Transformation on NLog does not work

I have a web project (ASP.NET MVC 4 project) that has a number of configurations stored in Web.Config and in NLog.config files. I have several publish profiles PublishProfile1, PublishProfile2 etc. When using a publish profile to deploy my web…
Tamas Ionut
  • 4,240
  • 5
  • 36
  • 59