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
1 answer

NLog appsetting default to relative path

I want to use in NLog (the NLog.Extended NuGet package to be specific) to do something like this: Where I set up RemoteLogDir when I publish my app, but…
ricksmt
  • 888
  • 2
  • 13
  • 34
1
vote
2 answers

How to get the logging date (timestamp) in a program using NLog in C#

I would like to obtain the date(timestamp) of my logger in a program. I configured my logger like this: var fileTarget = new FileTarget(); string folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); …
user3841581
  • 2,637
  • 11
  • 47
  • 72
1
vote
1 answer

Using ServiceStack REST to receive data without a POCO on the server

We're trying to write a ServiceStack Rest method to received data from the NLOG WebService Target. https://github.com/NLog/NLog/wiki/WebService-target It appears that Nlog will send a WCF formatted Json POST based on the class…
mbalsam
  • 611
  • 1
  • 6
  • 16
1
vote
1 answer

Configure NLog to log at set days of week

I have a service running hourly that uses NLog to send mail when exception occurs. So how do I configure it to not log at Saturday and Sunday? Can I even do that? Here's my target:
Ivan Maslov
  • 168
  • 2
  • 13
1
vote
0 answers

NLog conditional logging rules for Debug and Release

I would like to create different logging rules for the Debug and for the Release situation. Better said, I would like to log TRACE level if I am in Debug mode.
Franki1986
  • 1,320
  • 1
  • 15
  • 40
1
vote
0 answers

How to collect log in memory until exception occured and write to file after?

I'm using NLog. And I wanna do next: keep everything logged in memory until something bad will happens. If the request is completed successfully - flush memory log. If some exception has occurred - write to log file everything collected from the…
1
vote
1 answer

NLog doesn't emit messages with Obfuscation

I have an application that I'm trying to obfuscate. When unobfuscated, the program emits NLog logging messages, but after obfuscation, it doesn't generate any messages at all even though the rest of the application operates as expected. I've tried…
ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
1
vote
1 answer

Nlog Error when writing to database, what is the correct config for Nlog in asp core 2?

what is the correct config for Nlog in asp.net core. I followed this tutorial and the loggers are working properly except for writing in the database. I keep getting this error (internal nlog), 2017-08-30 18:05:39.8956 Error Error when writing to…
JSON
  • 1,583
  • 4
  • 31
  • 63
1
vote
1 answer

app.config transformation - nlog rules logger replace not works

in App.config I have nlog section:
user3057544
  • 807
  • 9
  • 22
1
vote
1 answer

NLog different layout for different loggers

To fully use advantages of MDLC in NLog I'm trying to set MDLC params at the init method of all objects I need to identify later when debugging by logs. For example, there is an A class with some Foo() method where I have something like…
Tony Young
  • 45
  • 1
  • 7
1
vote
1 answer

Configuring CloudWatch as a target for NLog

I have been trying to set cloudwatch as a target to my Nlog framework in .Net application. They haven't mentioned much on their documentation about this. This is my Nlog.config file 
CharithW
  • 81
  • 1
  • 8
1
vote
1 answer

NLog use diferrent config file according to Solution Configurations

I am working on a ASP.Net web API 2 project and have configured nlog to write application logs to a database. Since we have 4 environments (local, testing, staging, prod) I need to write logs to different databases. So, in my web.config I have…
SJMan
  • 1,547
  • 2
  • 14
  • 37
1
vote
0 answers

NLog not able to read aspnet-request variables in specific server

NLog is able to read aspnet-request variables in one of the server and its working fine. Alternatively the same NLog configuration is not working in another server. It is throwing below exception. error application="Portal" host="test-machine" …
1
vote
2 answers

Is NLog 4.4.11 usable with a dotnet core 1.1 application?

I have a dotnet core 1.1 application (In VS, targets .NETCoreApp 1.1). I can't install NLog 4.4.11 via NuGet because it has a dependency on dotnet framework. Nuget reports the following: Package NLog 4.4.11 is not compatible with netcoreapp1.1 …
akaioi
  • 265
  • 4
  • 13
1
vote
2 answers

Using NLog for several projects on one solution c#

I have 8 console projects in one solution(I'm planning to convert them to services in future) referencing each other. I'm planning to create a ILogger interface and Logger class to encapsulate Nlog methods as I don't want to reference nlog in every…