Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to put the log file in a given path. It is in app.config in a class library project, say I want to save the log in "C:\Test\log.txt" or a network path.

How to do it?
Currently I have
C#
<targets>
    <target  xsi:type="Console"
             name="console"
             layout="${shortdate} ${level} ${message}" />
    <target name="logfile" xsi:type="File"
    fileName="${specialfolder:folder=ApplicationData}/LogFile.txt"/>
  </targets>
Posted
Comments
Sinisa Hajnal 14-May-15 3:54am    
Did you try replacing ${specialfolder:folder=ApplicationData} with C:\Test?
[no name] 15-May-15 9:55am    
I am not sure if I can't do it. As I have not found the document for it. Such as "\\" or single "\" or other style etc.
Sinisa Hajnal 16-May-15 16:23pm    
By the format already in the config: use single slash. If the initial c:/whatever path doesn't fly, try with file:///c:/whatever

1 solution

We can just add the prefix to it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900