开发者

Force NLog to create a new log folder for year, month and day

How can I force NLog to write logfiles using this pattern "${yyyy}/${MM}/${dd}/开发者_如何学Clog${yyMMdd}.${####}.txt"?

Create a new directory for each year, month, day and have the filenames contain the time and a running nummer (4 digits wide), for example log192412.0001.txt if a file size is exceeded (before a new day starts).


Found it myself:

<target xsi:type="File" name="fileTarget" 
  fileName="${basedir}/${date:format=yyyy}/${date:format=MM}/${date:format=dd}/log${date:format=yyMMdd}.log"
  archiveFileName="${basedir}/${date:format=yyyy}/${date:format=MM}/${date:format=dd}/log${date:format=yyMMdd}.{####}.log"
  archiveAboveSize="1000000" /> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜