Log4NET在服务器上时未记录日志 [英] Log4NET not logging when on Server

查看:109
本文介绍了Log4NET在服务器上时未记录日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiya

我目前正在使用Log4NET日志记录工具记录我的错误.该代码可在本地计算机上运行,​​但是当我将其传输到主机服务器时,文件未记录.

我用于Log4NET的配置如下:

Hiya

I am currently logging my errors using the Log4NET logging tool. The code works on the local machine, yet when I transfer it to the host server, the files are not logging.

The configuration I am using for Log4NET is below:

<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <param name="File" value="Log4Net.log" />
      <param name="AppendToFile" value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
      </layout>
    </appender>

    <root>
      <level value="All" />
      <appender-ref ref="FileAppender" />
    </root>
  </log4net>



我已使用此网站中找到的教程进行了设置

任何人都可以提供任何指导.它可以与IIS一起使用,但不能在主站点上使用.



I have set it up using the tutorial found at this site

Can anyone offer any guidance. It works with IIS, just not on the main site.

Thanks in advance!

推荐答案

确保使用该日志记录的用户可写Log4Net记录到的文件/目录,并将Log4Net指向完整路径.您可以尝试使每个人都可以访问c:\ temp文件夹,并将web.config更改为
Make sure the file / directory Log4Net is logging to is writeable for the user that uses the logging and point Log4Net to the full path. You could try it to make you''re c:\temp folder read/write accessible for everyone and change the web.config to
<param name="File" value="c:\temp\Log4Net.log" />



问候
Piet



Regards
Piet


这篇关于Log4NET在服务器上时未记录日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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