其中,企业库4.1记录,日志? [英] where enterprise library 4.1 logger, logs?

查看:94
本文介绍了其中,企业库4.1记录,日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来使用记录。

我已经做了使用配置向导的配置,但我不明白的地方是日志消息。我甚至看到app.config文件,但找不到任何记录源。

I have done its configurations using configuration wizard but I couldn't understand where it is logging messages. I even see app.config file but couldn't find any logging source.

请指引我在哪里,它的日志,我该如何检查日志。

Please guide me where it does logs and how I can check that log.

下面是我的配置文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
      <add fileName="C:\Users\Administrator\Desktop\EAMS\trace.log"
        header="----------------------------------------" footer="----------------------------------------"
        formatter="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        traceOutputOptions="LogicalOperationStack" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        name="FlatFile TraceListener" />
      <add source="Enterprise Library Logging" formatter="Text Formatter"
        log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        traceOutputOptions="LogicalOperationStack" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        name="Formatted EventLog TraceListener" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Formatted EventLog TraceListener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Formatted EventLog TraceListener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=YAWARLAPTOP;Initial Catalog=EAMS;Integrated Security=true"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>



感谢

thanks

推荐答案

您需要配置一个或多个跟踪听众的。另请参见配置概述

You need to configure one or more Trace Listeners. Also see Configuration Overview

修改1
感谢您的一个例子配置文件。您登录您的信息应用程序事件日志。请打开这个事件日志的平时一样,你就可以看到你的信息在那里

Edit 1 Thank you for an example of you config file. You are logging your messages into Application Event Log. Please open this Event Log as you normally do and you'll be able to see your messages in there.

编辑2
在你原来的问题,你问哪里的消息记录。这个答案已经提供给你。当你写一个问题,这是更好地指定的前期,什么是你想要的目的。要登录到一个平面文件中,你配置你需要这个监听器添加到你的源代码参考平面文件侦听器后。看看它是如何与你的榜样事件日志跟踪侦听器完成,遵循相同的模式。

Edit 2 In your original question you asked where the messages are logged. This answer has been provided to you. When you write a question, it's better to specify upfront, what are you trying to achieve. To log into a flat file, after you configured a flat file listener you need to add reference to this listener to your sources. See how it's done with the Event Log trace listener in your example and follow the same pattern.

这篇关于其中,企业库4.1记录,日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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