The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
JP O'Gorman
 |
| 09/12/2008 1:05 PM |
|
Hello
I configured the RollingLogFileAppender in my application .config file hoping that it would write my log file into the windows users local app data directory.
What I did not realize is that ${LOCALAPPDATA} is a Vista only environmental key and it's failure to resolve on XP machines caused unexplainable performance issues.
Can another tell me if there is a recommended way to get the RollingLogFileAppender to write the log file to the user's local app data directory?
Many thanks, John Paul O'Gorman
|
|
|
|
|
David Abrames
 |
| 09/19/2008 4:34 PM |
|
Dear John,
I use the following in my log4net.xml file:
<appender name="File" type="log4net.Appender.RollingFileAppender"> <file value="${APPDATA}\MyApp\Logs\MyApp_log.txt"/> <appendToFile value="false" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10MB" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d %c {%t} [%-5p] %M(%L)-%m%n"/> </layout> </appender>
This resolves to "/Documents and Settings/MyLoginUser/Application Data/MyApp/Logs" on XP and to "/Users/MyLoginUser/AppData/Roaming/MyApp/Logs on Vista.
'MyLoginUser' is the user name of the logged in User and normally these folders are hidden by default so the User has to change their folder view settings to display hidden folders to 'SEE' these folders.
One issue we have run into and I am working on is that for non-admin users the 'Logs' folder is not created by log4net on Vista. I am working on my this and how to work around it.
David
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|