log4net的并不在IIS 6.0中写 [英] log4net does not write in IIS 6.0

查看:117
本文介绍了log4net的并不在IIS 6.0中写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下log4net的配置:

I have the following log4net configuration:

<log4net>
<appender name="Console" type="log4net.Appender.ConsoleAppender">
  <layout type="log4net.Layout.PatternLayout">
    <!-- Pattern to output the caller's file name and line number -->
    <conversionPattern value="%date [%thread] %-5level %ndc - %message%newline" />
  </layout>
</appender>

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
  <file value="C:/logs/mysystem.log" />
  <appendToFile value="true" />
  <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
  <maximumFileSize value="1024MB" />
  <maxSizeRollBackups value="30" />

  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level - %message%newline" />
  </layout>
</appender>

<root>
  <level value="DEBUG" />
  <appender-ref ref="Console" />
  <appender-ref ref="RollingFile" />
</root>

在本地机器上它工作正常,但是当我部署网站到远程服务器(IIS 6.0)并不尽管该系统运行的事实创建日志文件。

in the local machine it works fine, but when I deploy the web site to the remote server (IIS 6.0) it does not create the log file despite the fact that the system is running.

该程序池标识配置为网络服务。

The AppPool identity is configured to "Network Service".

任何想法?

推荐答案

您可以授予访问通过创建一个使用的机器名称为原则的文件夹上一个ACE网络服务访问日志文件夹。更改池标识为本地系统可以有不良的影响,所以我会避免。

You can grant access "Network Service" access to the logs folder by create a ACE on the folder using the machines name as the principle. Changing the pool identity to "Local System" can have undesirable effects so I would avoid that.

另一种方法是创建一个域用户,并将此用户添加到机器IIS_WPG组。更改池标识使用这个用户。然后,您可以授予该用户相应的文件夹访问权限。

Another approach is to create a domain user and add this user to the machine IIS_WPG group. Change the pool identity to use this user. You can then grant appropriate folder access to this user.

这篇关于log4net的并不在IIS 6.0中写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆