问题描述
|
有谁知道我在哪里可以查看Microsoft Practice Enterprise Library 5.0的记录日志?
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<configuration>
<configSections>
<section name=\"loggingConfiguration\" type=\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,Microsoft.Practices.EnterpriseLibrary.Logging,Version=5.0.414.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35\" requirePermission=\"true\" />
<section name=\"exceptionHandling\" type=\"Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings,Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,PublicKeyToken=31bf3856ad364e35\" requirePermission=\"true\" />
</configSections>
<loggingConfiguration name=\"\" tracingEnabled=\"true\" defaultCategory=\"General\">
<listeners>
<add name=\"Event Log Listener\" type=\"Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener,PublicKeyToken=31bf3856ad364e35\"
listenerDataType=\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData,PublicKeyToken=31bf3856ad364e35\"
source=\"Enterprise Library Logging\" formatter=\"Text Formatter\"
log=\"\" machineName=\".\" traceOutputoptions=\"None\" />
</listeners>
<formatters>
<add type=\"Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.textformatter,PublicKeyToken=31bf3856ad364e35\"
template=\"Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}\"
name=\"Text Formatter\" />
</formatters>
<categorySources>
<add switchValue=\"All\" name=\"General\">
<listeners>
<add name=\"Event Log Listener\" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue=\"All\" name=\"All Events\" />
<notProcessed switchValue=\"All\" name=\"Unprocessed Category\" />
<errors switchValue=\"All\" name=\"Logging Errors & Warnings\">
<listeners>
<add name=\"Event Log Listener\" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<exceptionHandling>
<exceptionPolicies>
<add name=\"DividedByZeroEx\">
<exceptionTypes>
<add name=\"DivideByZeroException\" type=\"System.DivideByZeroException,mscorlib,Version=2.0.0.0,PublicKeyToken=b77a5c561934e089\"
postHandlingAction=\"NotifyRethrow\">
<exceptionHandlers>
<add name=\"Logging Exception Handler\" type=\"Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler,Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging,PublicKeyToken=31bf3856ad364e35\"
logCategory=\"General\" eventId=\"100\" severity=\"Error\" title=\"Enterprise Library Exception Handling\"
formatterType=\"Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter,PublicKeyToken=31bf3856ad364e35\"
priority=\"0\" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
</configuration>
我已经在事件查看器中检查了应用程序日志,但其中没有任何内容...请帮助!
解决方法
由于您正在登录Windows事件日志,因此必须在操作系统上注册事件源,然后才能成功使用它进行日志。通常,.NET框架会在您首次使用事件源时自动创建事件源,但是创建事件源需要管理员权限。您可以以管理员身份运行一次该应用程序并进行注册,也可以在MSDN中搜索“注册事件源”。