FAQ Database Discussion Community


Buffered Emailing Logger for .Net (preferably a NLog Target)?

c#,email,logging,nlog
Could anyone point me to a NLog target or some other logging sink that would allow sinking logs to SMTP but in a buffered fashion (multiple errors logged in a single email)? Anyone who's ever used a SMTP sink has likely been spammed sometime or another from the default SMTP...

NLog not working with Application Insights

nlog,ms-application-insights
I am trying to get NLog to work with Microsoft Application Insights. I followed the instructions here: How do I use Microsoft Application Insights with NLog (Target cannot be found: 'ApplicationInsights') The above instructions got me through getting an ApplicationInsights target to register, however, now I am getting this error:...

NUnit keeps running the wrong version of a .dll

c#,nunit,inversion-of-control,castle-windsor,nlog
I am using the NUnit 2.6.4 test runner. I am running from an .nunit project file that loads my .csproj test. It keeps running the wrong version of a dependency. Background: I have castle windsor 3.3 using the NLog facility. I am using NLog 3.2. By default Windsor tries to...

NLog - disable a specific logger

nlog
I'd like to set all loggers to log to a file except one for a specific class. I can't seem to figure out how to do it. Currently I'm trying the following nlog.config No matter what I do, the interceptor is logging <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="file" xsi:type="File" fileName="${basedir}/logs/log.log"...

Add NLog provider to ILoggerFactory

dependency-injection,nlog,asp.net-5
I'm trying to add NLog as a provider to my logger factory in my startup.cs file, but I can't seem to add it. All the examples I have seen do this: loggerFactory.AddNLog(new global::NLog.LogFactory()); I am using : "Microsoft.Framework.Logging": "1.0.0-beta2" From what I can tell in the github examples etc, this...

How to configure NLog (Servicestack) for Multiple files

c#,servicestack,nlog
I need to save one log file for each of my threads running. So I want different log files, the code below saves one log, but I need to create diferent ones, how can I call the method saying which file I want to save? LogManager.LogFactory = new NLogFactory(); var...

Is this the correct way to log to a specific target with NLog?

c#,nlog
I'd like to log some special events into a different table that will contain more data then the general application log. If I add a second database target to the NLog.config how can I use it in my code? Would this be the right thing to do: NLog .LogManager .Configuration...

To implement the max level programmatically in condition

.net,logging,nlog
I had <logger name="*" minlevel="Trace" writeTo="f1" /> Now I added the maxlevel. so <logger name="*" minlevel="Trace" maxlevel="Error" writeTo="f1" /> I want to implement it programmatically. What I tried Then in code: var filter = new ConditionBasedFilter(); filter.Action = FilterResult.Log; filter.Condition = "(level <= LogLevel.Info)"; var loggerRule = new LoggingRule(ruleName, LogLevel.Debug,...

How to log a message correlation Id with ServiceStack.Logging ILog?

logging,servicestack,nlog
I'm very satisfied with the current logging solution I have in place right now, which is the ServiceStack Interface being implemented by NLOG. The NLOG targets I am using are as follows: xsi:type="Console" xsi:type="Debugger" xsi:type="File" xsi:type="Seq" of particular importance is Seq which is a log receiver on steroids and my...

Common.Logging.NLog32 unable to use NLog 3.2.1.0? On client only?

c#,wpf,client,nlog,common.logging
I'm currently setting up a client server project. My server part is a C# WebAPI project (net45). My client part is a C# WPF project (net45). For logging I want to use Common.Logging with the Common.Logging.NLog32 adapter. At first I configured it in the server part and it worked like...

NLog breaks when using operator '<'

.net,visual-studio,nlog
I have a configuration below and a relational operator '<' seems to be not escaped because it outputs error XML element is not closed. In documentation they have an example with '<=', which doesn't work too. What's interesting, '>' works fine. Am I missing something? <logger name="*" minlevel="Trace" writeTo="logFile"> <filters>...

Writing to .config files

asp.net-mvc,web-config,configuration-files,nlog
I am having an issue somewhat similar to this question: C#: Config file error BACKGROUND My situation is this: I am using NLog and I have setup a Database target. My app shows an installation page on first run from which I build a connection string for other purposes but...

App Config Connection String Not Updating For Service

c#,web-services,connection-string,app-config,nlog
I have created a webservice with an app.config which is holding my connection string. Everything works perfectly and as expected, apart from that when I change the connectionstring to point to a new table the service will continue to point at the old address (even when I switch the service...

How to set a fault tolerante channel between nlog and nxlog?

nlog,nxlog
My application uses nlog. It needs to send logs to a nxlog process running in the same host (which I also have control over). I thought of sending json lines using TCP or UDP from nlog to nxlog. That's a straightforward design but it is not fault tolerant AFAIK. If...

Turn off Logging during Release from Nlog.config

nlog
Now i am doing like this LogManager.DisableLogging(); But this need to deploy my code again, how can I disable loggin from nlog configuration file....

Send logs in separate emails

nlog
When using the built-in nlog Mail target, I am receiving multiple error logs grouped into one email. There seems to be some kind of buffering occurring. I want each log to be sent separately. Example of my log.config file: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <targets async="true"> <target...

Nlog file not writing

c#,.net,nlog
I've been trying to build an app that will use Nlog to log a file. The code is really basic, but not seeming to work. Anyone have any ideas? I've set the correct things to "copy always" as well, like in this question. NLog doen't work on IIS Code below....

Should I inherit the class logger when using NLog?

c#,nlog
When logging from a derived class, should I inherit the class-logger instance from the base class, or instantiate a new one? Namely, which is better: public class Base { private static Logger _logger = LogManager.GetCurrentClassLogger(); private void Foo() { _logger.Info("Hello world"); } } public class Derived : Base { new...