In my app.config I put
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="%programdata%/log-file.txt"/>
but it didn't work. Any ideas?
The log4net syntax for expanding environment variables is "${Variable}" e.g.
<file value="${LOCALAPPDATA}\GojiSoft\GojiLog\log.txt" />
Resurrecting an old thread here, but I encountered the same issue and thought I'd share.
${PROGRAMDATA}, as discussed in the comment thread of the other answer, didn't work for me (same as for OP). However, I saw a comment somewhere about it being case sensitive. Tried ${ProgramData} and sure enough, it worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With