Questions tagged [nlog-configuration]

28 questions
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
0
votes
1 answer

nLog conditional layouts

I'm using nLog 2.0 and after this interesting read I tried to apply conditions to a simple layout as such: layout="${message:when=logger==A}" layout="${message:when=logger=='A'}" layout="${message:when='logger==A'}" Not only do none of these have…
stijn
  • 34,664
  • 13
  • 111
  • 163
0
votes
0 answers

How to add methodname in logging using runtime reconfiguration

I'm working on a C# application, using NLog for logging purposes. I have just seen the following in a logfile: 2023-06-08 11:15:58.1816 | NameSpace.ClassName | CheckMATCO | Check CheckFixstation ... This is caused by the following piece of source…
Dominique
  • 16,450
  • 15
  • 56
  • 112
0
votes
1 answer

Nlog configuration loading best practices

I'm doing an NLog logger wrapper dll to use in some projects and I want to give multiple options to load configuration files. NLog default paths File specified by parameters Nlog config file path specified in some app.config setting. File located…
JuanDYB
  • 590
  • 3
  • 9
  • 23
0
votes
0 answers

NLog doesn't log in Uwp project

I try to use NLog in my Uwp application. I've added NLog nuget package to the project, created NLog.config file in the project directory, maken it Copy always
Foo Boy
  • 9
  • 4
0
votes
3 answers

NLog - Write log entry to different file

I haven't found a solution for the problem yet. In some cases I have errors in my application that I have to log to a seperated log file. The problem with some of these errors is that they consists of a lot of data and I'd like to have the log…
BlackMatrix
  • 474
  • 5
  • 19
0
votes
2 answers

Specific Log to specific files using Nlog in .Net core 2.2

I have successfully configured NLog in .net core 2.2 web api. But I wanted to achieve specifications with logging. How to achieve below: Warnings should be logged to warn specific file Errors should be logged to error specific file When I log…
0
votes
1 answer

Is there a missing setting in my nlog.config file configured for webservice to trigger method in controller?

I want to send the Information from Nlog in a file and to a webservice at the same time. The file works fine. The webservice one won't hit a breakpoint at the controller. I tried the steps recommended here…
Lukas
  • 35
  • 1
  • 11
0
votes
1 answer

NLog config not reading boolean Property

I have the following NLog filter (logger outputs to the DB): And that…
Kal
  • 141
  • 1
  • 12
0
votes
2 answers

NLog log files not getting compressed but gets deleted

I am trying to zip and archive the old logs. I used the below target for this purpose.
AnOldSoul
  • 4,017
  • 12
  • 57
  • 118
0
votes
2 answers

Modify NLog configurations specified with Configuration API through NLog config file xml

I have a project which uses the below code to create a NLog instance. public FileTarget CreateNLogFileTarget(string layout, FileArchivePeriod archiveMode, int maxArchiveFiles, bool keepFileOpen, bool enableConcurrentWrites,…
AnOldSoul
  • 4,017
  • 12
  • 57
  • 118
0
votes
1 answer

Ignore if target not found

I have a nlog logger configured via nlog.config file. I have multiple targets defined in the config file. Is it possible that if nlog fails to find any target (for e.g. database due to network error), it can ignore that particular target and write…
Marshal
  • 6,551
  • 13
  • 55
  • 91
0
votes
1 answer

Why do NLog configuration changes not take effect?

I tried to change NLog's configuration via: LogManager.Configuration.AddTarget (name, foo); LogManager.Configuration.LoggingRules.Add (new LoggingRule ("*", LogLevel.Trace, foo)); but it silently ignored my changes. However, when I…
mafu
  • 31,798
  • 42
  • 154
  • 247
1
2