I have a program that uses log4net. It logs directly in the exe folder.
Now, when passing to station with Windows > XP (Vista, Seven) I observed that the logs are not always created, due I suppose to the user privileges and other security stuff...
Could I redirect logs to the user folder? Say
\\Username\MyProgram\Logs
In your case, the log file will be in bin\Debug\netcoreapp3.
RollingFileAppender means the system creates a log file based on your filters, this way you can have log files based on dates (one file each day), or get the file splitted into small chunks when it hits certain size.
Example of config.xml
:
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="${USERPROFILE}\MyProgramName\Logs\rolling-log-" />
<appendToFile value="true" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="100KB" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd.'log'" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<header value="[Log opening] " />
<footer value="[Log closing] " />
<conversionPattern value="%date %-5level %logger - %message%newline" />
</layout>
</appender>
remark the ${USERPROFILE}
environment variable.
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