私のプログラムの中には、30ヶ月のローテーションが予想されるものがあります。他のプログラムでは、私は1日分のログファイルしか持っていませんが、ログファイルは合計30個しかありません。私が持っていたいのは、過去30日間のログファイルエントリと30ログファイルだけです。私は何が欠けているのか分からないと思う。NLogアーカイブの設定
昨日私のログファイルが上書きされ、プログラムのバックアップが開始されたので、何が起こったのかを示すデータが失われました。次に、私の2番目の質問は、アーカイブはパターンに適合しないファイルを単に削除するのか、それとも実際にログファイルを取り込んでどこかに置くのでしょうか?本当にアーカイブは何ですか?ここに私のnlog.configがあります:
<?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">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<variable name="LogDir" value="${specialfolder:folder=MyDocuments}/MyApp/Log"/>
<variable name="LogDay" value="${date:format=dd}"/>
<targets async="true">
<!-- add your targets here -->
<target name="LogTarget1"
xsi:type="File"
fileName="${LogDay}.log"
encoding="utf-8"
maxArchiveFiles="30"
archiveNumbering="Sequence"
archiveAboveSize="52428800"
archiveFileName="${LogDay}.{#######}.log"
layout="${date:format=MM/dd/yyyy HH\:mm\:ss}|${level:uppercase=true}|${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<logger name="*" minlevel="Trace" writeTo="LogTarget1" />
</rules>
</nlog>