本文介绍了在Windows Server 2012中部署后,log4net eventlogappender不会记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在wcf服务中实现了log4net并使用了eventlogappender,它在开发区域都很好用,当我部署到测试环境时,eventlogappender不能正常工作,但是smtp appender在测试环境中工作正常。我在网上搜索解决方案并遇到了权限问题,我给了网络服务,匿名登录,IIS工作进程HKEY_LOCAL_MACHINE \SYSTEM\CurrentControlSet \ Services.\\Eventlog文件夹的完整权限。但仍然没有记录



我跟踪了log4net内部日志记录。

I have implemented log4net in wcf service and using eventlogappender, its all working good in development region, when I deploy to test environment, eventlogappender is not working, but smtp appender is working fine in test environment. I searched online for solution and came across permission problem, I gave Network Service, Anonymous Logon, IIS worker process full rights to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog folder. But still it not logging

I followed log4net internal logging.

<appsettings>
        <add key="log4net.Internal.Debug" value="true" />
    </appsettings>

<system.diagnostics>
        <trace autoflush="true">
            <listeners>
                <add>
                    name="textWriterTraceListener" 
                    type="System.Diagnostics.TextWriterTraceListener" 
                    initializeData="C:\tmp\log4net.txt" />
            </add></listeners>
        </trace>
    </system.diagnostics>





当我使用更新的配置部署到测试系统时。它从未写入该文件。我也对该文件赋予了相同的权限。



When I deployed to test system with updated config. it never wrote to that file. I also gave same permissions to that file.

推荐答案


这篇关于在Windows Server 2012中部署后,log4net eventlogappender不会记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 20:46