A process running as a non-administrator user does not have rights to write to the program files folder. What is the best way to configure log4net to write to a location that a non-administrator user has rights to?
Ideally there would be:
Related questions:
Why can't you just configure log4net to write to a file in a folder to which you have proper access rights? You do that with a FileAppender:
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="c:/path/log-file.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
The above is taken from here. From the same page:
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="${TMP}\log-file.txt" />
<appendToFile value="true" />
<encoding value="unicodeFFFE" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
You can use an environmental variable to set the path of the file.