Code Coverage by Clover.NET

{registry} renderer

View: New views
2 Messages — Rating Filter:   Alert me  

{registry} renderer

by Szerella :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying to use the {registry} renderer in the target fileName field but i could not get it run.


My config settings are:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <targets>
      <target name="f" xsi:type="File" fileName="${registry:key=HKLM\SOFTWARE\HH\Server:value=LogPath:defaultValue=d\:\temp}\log.txt"/>      
    </targets>
    <rules>
      <logger name="*" writeTo="f"/>
    </rules>
  </nlog>


So the config is quite simple and i don't know what is wrong. I gave default value for the registry value so if the registry key was not available then at least the default value should work. But it doesn't either. The given registry key and value are definitely exist in the registry.

I tried it in several formats, e.g. with doubled "\\" marks, without defaultValue, etc but nothing helped.

I use MS VS 2008 with .NET 3.5 in C#.

Can anybody give me some hints what's wrong?


Thanks in advance!
Cheers

Re: {registry} renderer

by Szerella :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I know now what was the problem. The separator of the subkeys must be "\\" or "/", otherwise the renderer won't work.

fileName="${registry:key=HKLM/SOFTWARE/HH/Server:value=LogPath:defaultValue=d\:/temp}\log.txt"/>


It is strange because otherwise in the filename fields in the config you can use a single "\" char as directory separator.



Good luck!