I am trying to implement a simple log using Nlog Refresh 1.0 for a class Library project. It seems nlog does not create a logfile when it's instantiated from within a dll.
Is there some other way around this ?
my config file looks like this:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true">
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/nlog.txt" />
<target name="console" xsi:type="Console" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="file" />
<logger name="*" minlevel="Info" writeTo="console" />
</rules>
</nlog>
I know there is nothing wrong with this config because it works from within an exe project.
Edit: just to clarify: I have no access to the calling program which uses my dll as a plugin. The calling program is in fact outlook which uses my dll as a plugin. I would want to keep a log which is only relevant to my dll and has nothing to do with outlook itself.
you have to add the nlog.config to the location of the exe file that uses the dll!
Edit: You don't have to modify the exe file just place the nlog.config in the same directory, if that is no option i guess you will have to configure it from code https://github.com/nlog/NLog/wiki/Configuration-API