nlog

NLOG to output db.out

I would like to use nLog to output my LINQ to SQL generated SQL to the log file e.g. db.Log = Console.Out reports the generated SQL to the console, http://www.bryanavery.co.uk/post/2009/03/06/Viewing-the-SQL-that-is-generated-from-LINQ-to-SQL.aspx How can I get the log to log to NLOG? ...

Using the Ninject NLogModule Logger in global.asax

I'm using Ninject for DI in my asp.net application, so my Global class inherits from NinjectHttpApplication. In my CreateKernel(), I'm creating my custom modules and DI is working fine for me. However, I notice that there is a Logger property in the NinjectHttpApplication class, so I'm trying to use this in Application_Error whenever a...

Windows Service with NLog

Hi, I am creating a Windows Service which I want to use NLog with. I want the logs to be written to the install location of the service say something like: PathToInstalledService\Logs\MyLog.txt This is of course going to require administrator priveledges. So my question is, when creating the install for the Service, what account shou...

How to make Nlog archive a file with the date when the logging took place.

Hi, We are using Nlog as our logging framework and I cannot find a way to archive files the way I want. I would like to have the date of when the logging took place in the logging file name. Ex All logging that happend from 2009-10-01 00:00 -> 2009-10-01:23:59 should be placed in Log.2009-10-01.log. But all the logs for this day should ...

Problem using Nlog & VC6

I think it's probably my inexperience with .net, but I think I'm going to have to give up on my plan to use NLog instead of fixing our broken proprietary logging code. The plan was to introduce NLog then extend logging if we ever move to c#. I've called my own simple assembly code from VC6 before (get a pointer to the managed interface...

Can Nlog store the current Thread user

I am using NLog to provide all my logging, do you know if it is possible to store the current Thread user details, by changing the NLog.Config file? ...

NLog with VS 2008 Unit Test

I am trying log some entries in a log file (Log.Trace / Log.Debug) while my VS unit test runs. I have also copied the file NLog.config to out directory through DeploymentItem attribute over class. Still my log file is not created. Any help as to how can we log entries in a file same as we do for normal web application. ...

Application_Error event in Global.asax not firing in Release Mode? ASP.NET MVC application

I'm working on an ASP.NET MVC application. I'm having a problem where my Application_Error() event in my Global.asax file isn't firing in Release Mode. If I compile in Debug it fires just fine. PS: I'm using NLogger to log my runtime errors. Any help is appreciated. Thanks. ...

Using dependency injection with Nlog

I'm using Nlog as my logger, however I cant seem to find an Ilogger interface in Nlog namespaces unlike log4net's Ilogger interface, do I have to create my own wrapper? ...

How can I enable logging with Ninject?

Is there a way to get Ninject to log out what it is doing? In particular I'd like to see when objects are being created. As I have a mix of transient and singleton objects it'd be very useful for me during debug to be able to see how many instances of each are being created so that I can fix object scopes where needed. EDIT: N.B. I'...

Nlog not working in release mode

I am using Nlog to log the exceptions in my asp.net mvc (C#) application. Nlog is not working in release mode. The same is working when running in debug mode. What may be the problem? Is there any fix for this? ...

AppData For NLog

My NLog targets is like this: <targets> <target xsi:type="Console" name="console" layout="${longdate}|${level}|${message}" /> <target xsi:type="File" name="ErrorLog" fileName="${basedir}/error.txt" layout="${longdate} Trace: ${stacktrace} ${message}" /> <target xsi:type="File" name="AccessLog" f...

Contextual Information in app.config files

Is there an list of Contextual Information (ie ${longdate}, ${level}, ${message}) online? I want to set the log file in a folder the user's AppData\Local. Is it maybe ${appdatalocal}? And how would I access the file to send as an email attachment maybe like message.Attachments.Add("${appdatalocal}\somefolder\Application.log")? ...

How to get NLog to parse contents of file-contents renderer?

I have an NLog target: <target name="AspNetAsyncWrapperForMail" xsi:type="ASPNetBufferingWrapper"> <target name="mail" xsi:type="Mail" subject="Error: ${callsite:includeSourcePath=False}" smtpServer="MySMTP" from="[email protected]" to="[email protected]" smtpAuthentication="None" body="${date}${file-contents:$...

Use of nlog.xml

Hi, I just started playing with nlog, and noticed that nlog.xml file is brought along with nlog.dll into the output folder of the application. It's not too clear for me what that file is needed for and whether i should carry it over as a part of my app install or can safely remove it. Any ideas? Thanks, Andrey ...

NLog: Force BufferingTargetWrapper to empty on AppDomain UnhandledException

I have NLog configured in my application to to use the BufferingTargetWrapper for sending emails with the MailTarget. The problem I'm running into is I can not find a way to force NLog to empty the BufferingTargetWrapper before the application exits from Unhandled Exceptions. I tried calling LogManager.Flush() and LogManager.DisableLog...

How to avoid duplicating column headers in nlog CSVLayout?

I'm using a nlog's CSV layout file for data logging. <target xsi:type="File" [...]> <layout xsi:type="CSVLayout"> <column name="Value1" layout="${event-context:item=Value1}"/> [...] I'm getting column headers appended to the file every time I run the logging application. Is there a way to only get the column headers created ...

NLog not logging messages on XP SP3 with .NET 3.5 Client Profile

I'm writing a program that is targeting the .NET 3.5 Client Profile and using NLog. I configure my logger programmatically on start up (no config file.) It works perfectly on Vista and Windows 7, but when running on a fresh install of XP SP3 with the .NET Client Profile installed, it will not log any of the variables in the layout stri...

Which versions of NLog work with VS2010 RTM?

Taking a look at NLog, it's unclear what version works with VS2010. It says that NLog 1.0 Refresh works with VS2010 beta but nothing else is indicated. There's an NLog 2.0 that is pre-beta that I'd rather not use if I didn't have to but it clearly does work with VS2010. So I'm wondering if I'm able to use 1.0 Refresh or do I need to go ...

Proper implementation of NLog and Prism

What would be the best way to implement NLog in my Prism / CAL WPF application. This might be an amateur question, I am a bit new to the whole Prism framework :) I thought about putting the reference to the NLog dll in the Infrastructure module and make a wrapper singleton class e.g. MyLogger. My thinking was to be able to have the refe...