Quantcast

Is anyone using NLog with SharePoint?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is anyone using NLog with SharePoint?

Shawn
I've been loving NLog in my other applications, and now I'm trying to use it in my SharePoint (MOSS 2007) web parts.  The problem is, I can't seem to get any output from it.  Knowing that SharePoint plays around with the locations of files, etc., I've gone down the list of locations where NLog looks for configuration information, but none of them seem to make any difference.

Can anybody out there confirm that this combination actually works, or should I stop beating my head against the wall?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

Claus Rathje
Hi Shawn,

It does work in MOSS 2007. I've attached a version of NLog.config that I'm using. I placed it next to the web.config for the site.

And remember to put the NLog assembly in the GAC (or install NLog).

You can also try to enable logging of NLog like below and see if that gives you any hints:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
<b>      throwExceptions="true"
      internalLogFile="C:\NLog.txt" >

Claus


NLog.config
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

Shawn
Thanks for the confirmation.  I've got most of this already (including the internalLogFile - which produces nothing), but I'll double-check.  (Particularly, I'm only assuming my installer correctly put the NLog DLL in the GAC.)

When you say "web.config for the site", could you specify exactly where that is - just to verify I'm looking at the same place?  I'm assuming that means "Inetpub/wwwroot/wss/VirtualDirectories/my.sharepoint.local80"?

And this is working for you from Web Part code?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

Claus Rathje
Yes, the web.config is in Inetpub/wwwroot/wss/VirtualDirectories/my.sharepoint.local80.

And yes, this is also working from our WepParts.


Claus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

Shawn
Thanks for the tips :-)  The NLog assembly wasn't getting installed - and I'm used to getting an ugly ASP.NET stack trace when that happens.  I added the NLog and another support assembly to the .wsp and everything's working fine now.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

GiUmaTo
Hello all.

By any chance, could you please have a look at this topic I've posted?

http://nlog-forum.1685105.n2.nabble.com/Getting-NLog-up-and-running-with-SharePoint-2010-td6199785.html

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is anyone using NLog with SharePoint?

W0ut
In reply to this post by Shawn
I am it works great.  See here for a small overview
http://lawo.wordpress.com/2011/04/27/logging-in-sharepoint-log4net-versus-nlog/
Loading...