1

我使用 RollingFileAppender,但遇到了一个奇怪的问题:有时我的服务会停止生成日志文件,并且如果文本编辑器打开它,则会停止写入日志文件。

我做错了什么?

这是我如何配置

PatternLayout layout = new PatternLayout
    {ConversionPattern = "%date %-5level [%logger] [%-4thread]: %exception%message%newline"};
layout.ActivateOptions();
RollingFileAppender fileAppender = new RollingFileAppender {
   AppendToFile = append,
   File = traceFileName,
   MaxSizeRollBackups = maxSizeRollBackups,
   DatePattern = "_dd.MM.yyyy",
   LockingModel = new FileAppender.MinimalLock(),
  Layout = layout,
  RollingStyle = RollingFileAppender.RollingMode.Date,
};
fileAppender.ActivateOptions();
log4net.Config.BasicConfigurator.Configure(fileAppender);
4

0 回答 0