I have a wpf project which uses trace listeners to record debug information. The tool is used among a number of people and each of them write out the log file in their specific home directory. What I need to achieve is store all log files in a common dir accessible to all users but the file name should be appended with the user name using the tool in that session. For example I tried this:
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="MyListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Z:\commondir\MyTool-logs\"+WindowsIdentity.GetCurrent().Name.ToString()+"toollog.log"/>
<remove name="default"/>
</listeners>
</trace>
</system.diagnostics>
Basically I want to dynamically assign a different name to the log file based on the user name. However the above code gives me a build error saying the namespace prefix is not defined. How do I overcome this?