Issue (Question)
NLog version: v4.6.8
NLog.Config:v4.6.8
NLog.Web.AspNetCore:v4.9.0
(ASP.NET Core2)
Current NLog config (xml)
<?xml version="1.0" encoding="utf-8" ?>
<nlog
xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="info"
internalLogFile="C:\Logs\testProject\nlog-internal.txt">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="ALL"
fileName="C:\Logs\testProject\${cached:${date:format=yyyy-MM-dd HH_mm_ss}}.log"
layout="${longdate}|${uppercase:${level}}|${threadid}|${logger}|${message} ${exception:format=ToString}"
maxArchiveFiles="100"
archiveFileName="C:\Logs\testProject\{#}.log"
archiveDateFormat="yyyy-MM-dd HH_mm_ss"
archiveAboveSize="104857600"
archiveNumbering="DateAndSequence"
maxArchiveDays="30"
archiveEvery="Day"
/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="ALL" />
</rules>
```
“ maxArchiveDays” not Working,and the log cannot be generated.
But if "maxArchiveDays" is removed, logs can be generated.
I need to use "maxArchiveDays"
I want to achieve the following:
log file per day.
File maximum 100MB.
Keep max 30 days of logs, automatically deleting older logs.
How can i do?
Thank you so much
Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better!
If you read the documentation:
https://github.com/NLog/NLog/wiki/File-target
Then it says:
Introduced with NLog 4.7
So you have to use NLog 4.7 RC1 or wait for the final release:
If you read the documentation:
https://github.com/NLog/NLog/wiki/File-target
Then it says:
Introduced with NLog 4.7
So you have to use NLog 4.7 RC1 or wait for the final release:
This means:
The version of NLog.Web.AspNetCore has nothing to do with this issue.
I need to upgrade the "NLog" and "NLog.Config" versions.
Thanks for answer
Yes NLog.Web.AspNetCore is "just" a bonus package with additional layout-output-options.