What kind of value can be used for source in target EventLog

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What kind of value can be used for source in target EventLog

Eric G
I copied from somewhere the code:
 <target xsi:type="EventLog" name="eventLog" source="${appTitle}" ....

The event viewer shows ${appTitle} as the source name. Not the name of the .Net application. But if I fill in any kind of other value like source="MyApp" there will be no event logging at all. Also if I remove the source attribute, there will be no logging at all. So for some reason ${appTitle} is correct but I can't find it here in the documentation wiki.

Can someone tell me what I need to fill-in and eventually where I need to fill-in in Visual Studio 2010 the value for the variable (if a variable is used like ${appTitle})

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: What kind of value can be used for source in target EventLog

Eric G
I just saw that someone defined the variable in the config like:
<variable name="appTitle" value="My Application"/>

But what I already said, it seems that every other value than ${appTitle} will not start the logging. So the above won't work but following does:
<variable name="appTitle" value="${appTitle}"/>

But this is the same as not defining.

Reply | Threaded
Open this post in threaded view
|

Re: What kind of value can be used for source in target EventLog

Eric G
The problem is found. In Windows 7, NLog in Visual Studio 2010 has not the right permissions to create an eventlog source.

By temporarily creating a manifest file with requireAdministrator level (see http://msdn.microsoft.com/en-us/library/bb756929.aspx), NLog can create the eventlog source.