Windows XP SP3上的Microsoft Enterprise Library 4.1日志记录失败 [英] Microsoft Enterprise Library 4.1 Logging Fails on Windows XP SP3

查看:108
本文介绍了Windows XP SP3上的Microsoft Enterprise Library 4.1日志记录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Ent Lib 4.1日志记录应用程序块的应用程序.该应用程序可在XP SP2 +,Windows Vista和Windows 7上运行.

I have an application that uses the Ent Lib 4.1 logging application block. This application runs on XP SP2+, Windows Vista, and Windows 7.

大多数时候,我的日志记录工作正常. (它通常针对事件日志跟踪侦听器.)有时,并且我不确定是什么触发了它,因此Windows XP计算机将仅停止日志记录.我尝试添加一个平面文件跟踪侦听器,以查看问题是否与事件日志有关,但该平面文件也不起作用.重新启动也无法解决.

Most of the time, my logging works fine. (It typically targets the Event Log trace listener.) Sometimes, and I'm not sure what triggers it, a Windows XP machine will simply stop logging. I've tried adding a flat file trace listener to see if the issue was with the Event Log, but the flat file doesn't work either. Rebooting doesn't fix it either.

在所有发生故障的机器上,它以前一直在工作.它似乎也与Windows XP SP2/SP3隔离.在Vista或7上不会发生这种情况.

On all of the machines where it fails, it had been working previously. It also seems isolated to Windows XP SP2/SP3. It doesn't happen on Vista or 7.

想法?

更新:我尝试删除除平面文件之外的所有跟踪侦听器,并且此方法有效.因此,问题在于事件日志跟踪侦听器,显然发生的任何事情都导致Ent Lib完全无法记录任何内容-包括有关记录过程的错误.

Update: I tried removing all trace listeners except for the flat file, and this worked. So the issue is with the event log trace listener, and apparently whatever is happening is causing the Ent Lib to completely fail to log anything - including errors regarding the logging process.

推荐答案

@RMD,您是对的.引发异常(例如事件日志已满)时,该异常将导致该类别的所有其他跟踪侦听器都不会得到处理.

@RMD, you are right. When an exception is raised (e.g. Event Log is full) then the exception causes all other trace listeners for that category to not be processed.

不会记录任何日志条目 跟踪侦听器.

no log entry will be recorded for any trace listener.

另一方面,这并不完全正确.是的,将不会处理所有常规的跟踪侦听器,但是仍然存在错误特殊来源".我建议将此设置为它自己的文件(以我的经验,EventLog会在权限等方面产生更多问题)以捕获任何日志记录错误:

That, on the other hand, is not entirely true. Yes, all of the regular trace listeners will not be processed but there is still the the errors Special Source. I would recommend setting this to its own file (in my experience the EventLog will give more issues with permissions etc.) to capture any logging errors:

<specialSources>
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
      <add name="Error Flat File Destination" />
    </listeners>
  </errors>
</specialSources>

如果使用适当的权限进行了设置,并且磁盘未满(等等),那么您将在该日志文件中看到错误以及原始信息:

If that was setup with proper permissions and the disk was not full (etc.) then you would have seen the error in that log file along with the original information:

Message: Tracing to LogSource 'Your Event Source' failed. Processing for other sources will continue. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks.

Summary for Enterprise Library Distributor Service:
======================================
[Original Log Entry]

Exception Information Details:
====================================== 
Exception Type: System.ComponentModel.Win32Exception
NativeErrorCode: 1502 
ErrorCode: -2147467259 
Message: The event log file is full 
Data: System.Collections.ListDictionaryInternal
TargetSite: Void InternalWriteEvent(UInt32, UInt16, System.Diagnostics.EventLogEntryType, System.String[], Byte[], System.String) 
HelpLink: NULL 
Source: System

因此,您将获得原始日志信息,您可以提取原始日志信息并将其手动插入到要保存的任何日志历史记录中(例如,报告,分析).另外,作为奖励,您可以获得有关为什么无法写入日志条目的信息,以便可以(希望如此)对其进行补救.

So, you will get your original log information which you may be able to extract and manually insert into any log history that you are saving (e.g. reporting, analysis). Plus as a bonus you get the information about why the log entry could not be written so that it can (hopefully!) be remediated.

这篇关于Windows XP SP3上的Microsoft Enterprise Library 4.1日志记录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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