gpt4 book ai didi

azure - 在 Azure 中每天记录一个文件

转载 作者:行者123 更新时间:2023-12-03 06:45:34 26 4
gpt4 key购买 nike

这与 Azure 中使用 log4net 的 Sitecore 日志记录相关。

当前行为:

  1. 当天创建了多个文件。
  2. 当天的最后一个文件始终具有不同的格式(我已尝试使用日期标记来解析......但它仍然无法按预期工作)

以下是三个屏幕截图:

log4net相关设置仅适用于azure enter image description here

我目前添加的唯一更改。 enter image description here

为 10 月 20 日(即今天)创建的多个文件以及昨晚的文件,其名称很奇怪。 enter image description here

预期行为:我想每天记录一个文件,无论重新启动/应用程序池回收的次数如何,并在文件名中包含日期。

  1. 只有一个名称中包含日期的文件(例如.azure.log.20221020.084617.txt)

最佳答案

请更新,在我使用以下代码解决后,此错误得到解决:

<appender name="AzureFallbackAppender">
<rollingStyle>
<patch:attribute name="value">Date</patch:attribute>
</rollingStyle>
<maximumFileSize>
<patch:attribute name="value">50MB</patch:attribute>
</maximumFileSize>
<staticLogFileName>
<patch:attribute name="value">false</patch:attribute>
</staticLogFileName>
<preserveLogFileNameExtension>
<patch:attribute name="value">true</patch:attribute>
</preserveLogFileNameExtension>
<file>
<patch:attribute name="value">D:\home\site\wwwroot\App_Data/logs/{machineName}/azure.log.{date}.{time}.txt</patch:attribute>
</file>
<appendToFile>
<patch:attribute name="value">true</patch:attribute>
</appendToFile>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern>
<patch:attribute name="value">%4t %d - %-5p %m%n%n%n</patch:attribute>
</conversionPattern>
</layout>
</appender>

关于azure - 在 Azure 中每天记录一个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74139289/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com