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
1
vote
2 answers

Why don't Info level messages get logged when minimum level is Debug?

I have the following code in my C# application using Nlog. The messages with 'Debug' get logged, but 'Info' do not. I had assumed that since minLevel is set to 'Debug' in app.config, the 'Info' messages will also get logged, since Debug has higher…
Chakra
  • 2,525
  • 8
  • 43
  • 82
1
vote
2 answers

AutoFlushWrapper with Mail target

I'm trying to send myself an email with the latest log entries when an error occurs. But I don't want to receive any mail unless an actual ERROR-level entry have been logged, so I've set the bufferSize to a big number. My problem is, the mail target…
tobloef
  • 1,821
  • 3
  • 21
  • 38
1
vote
1 answer

Adding intellisense on custom NLog targets

I'm looking to add a thirdparty target type to NLog.xsd. You would normally create a nlog.config file like this: ... …
ThomasArdal
  • 4,999
  • 4
  • 33
  • 73
1
vote
1 answer

Can NLog properties be conditional?

I have the following Is it possible to make the identity conditional ? I've tried using ${identity}:when=logger!='MyNamespace.MyLogger' but that doesn't work
Shane Courtrille
  • 13,960
  • 22
  • 76
  • 113
1
vote
2 answers

how to log Environment.UserName in NLog?

how to log Environment.UserName in NLog? i have an application that works both on window authentication and form authentication. So i need to log Environment.UserName in my log file.
1
vote
1 answer

Pre azure start up

We are sending all trace logs to our NLog logger. (with a trace listener) Nlog is configured to work with DryIoC. Locally this works perfect, however, in Azure (web app), the first trace message is logged, before we could create our DryIoc…
Identity
  • 1,553
  • 1
  • 22
  • 44
1
vote
1 answer

NLog configuration not working as expected

I have the following NLog configuration file
Hecatonchires
  • 1,009
  • 4
  • 13
  • 42
1
vote
1 answer

Create NLog file checksum

We are using NLog and need to implement integrity check of the logs. To make sure that it was not tampered. We are looking to create SHA-256 hash of the log file once it rolls and store it in the database for the check. Does anyone know if this is…
Farukh
  • 2,173
  • 2
  • 23
  • 38
1
vote
1 answer

Sending NLog logs to the server through WCF

I have one server and many client applications, NLog is used everywhere. The purpose is to nearly completely remove logs from client and to send logs from a client directly to the server. It's successfully done through WCF, ILogReceiverServer and…
Anton
  • 127
  • 1
  • 3
  • 11
1
vote
1 answer

How do I rename nlog.config?

A while ago, I developed a WPF control and integrated into a third-party solution. Just my luck, turns out the supplier also now use nlog (v2), which they have registered in the GAC. They don't currently use an nlog.config file, although they could…
1
vote
1 answer

I am unable to create a new NLog Logger because of 'Logger.Logger()'s protection level

I am currently working on a new Prism project in C# and wanted to create an NLog Logger in my Bootstrapper class. Unfortunately, no matter what I do it refuses to build, telling me... 'Logger.Logger()' is inaccessible due to its protection…
Tesnich
  • 37
  • 4
1
vote
1 answer

ASP.NET MVC 5 application on Azure won't log exceptions

I'm having difficulties getting uncaught exceptions logged when deploying my ASP.NET MVC 5 application to an Azure App Service slot. When an uncaught exception occurs, the app rightly returns a 500 and the standard "Error. An error occurred while…
Joshua
  • 1,788
  • 1
  • 11
  • 18
1
vote
0 answers

Why does NLog always write to Application event log instead of my own Custom log?

I have a C# console application trying to log events to my custom event log using NLog. However, the log events are always written to the Application log and not to the one I have already configured. I am using NLog version 4.4.0. What am I missing…
1
vote
1 answer

.NET Core Class Library with NLog targeting .Net 4.6.1

I'm currently creating a common library from my work that would implement an abstracted logger using NLog. I've created a .NET Core class library targeting .NET 4.6.1 and implemented NLog, but when I try to execute a unit test that I've created,…
mallows98
  • 1,529
  • 4
  • 22
  • 37
1
vote
1 answer

Using NLog LogLevel value from AppSettings configuration file

I need to configure NLog settings from another application, essentially I have a main Application and a Configuration Application and need to set some log settings from the Configuration Application. I have tried below but minlevel is an enum and is…
Pappy
  • 447
  • 3
  • 15