zoukankan      html  css  js  c++  java
  • Enterprise Library:日志处理步骤

    An overview of the logging process and the objects in the Logging block

    Ff953185.56cf3e74-bacb-4bc5-a77d-87246ef38e98-thumb(en-us,PandP.50).png

    Stage

    Description

    Creating the Log Entry

    The user creates a LogWriter instance, uses it to create a new LogEntry, and passes it to the Logging block for processing. Alternatively, the user can create a new LogEntry explicitly, populate it with the required information, and use a LogWriter to pass it to the Logging block for processing.

    Filtering the Log Entry

    The Logging block filters the LogEntry (based on your configuration settings) for message priority, or categories you added to the LogEntry when you created it. It also checks to see if logging is enabled. These filters can prevent any further processing of the log entries. This is useful, for example, when you want to allow administrators to enable and disable additional debug information logging without requiring them to restart the application.

    Selecting Trace Sources

    Trace sources act as the link between the log entries and the log targets. There is a trace source for each category you define in the logging block configuration; plus, there are three built-in trace sources that capture all log entries, unprocessed entries that do not match any category, and entries that cannot be processed due to an error while logging (such as an error while writing to the target log).

    Selecting Trace Listeners

    Each trace source has one or more trace listeners defined. These listeners are responsible for taking the log entry, passing it through a separate log formatter that translates the content into a suitable format, and passing it to the target log. Several trace listeners are provided with the block, and you can create your own if required.

    Formatting the Log Entry

    Each trace listener can use a log formatter to format the information contained in the log entry. The block contains log message formatters, and you can create your own formatter if required. The text formatter uses a template containing placeholders that makes it easy to generate the required format for log entries.

  • 相关阅读:
    方法的封装与调用(十)
    适配器设计模式及GenericServlet(九)
    错误页设置,设置HTTP状态码404,500(八)
    设置默认首页(七)
    ServletContext接口(六)
    javax.servlet.ServletConfig接口(五)
    C语言第2天基本运算
    再议extern和include的作用
    C语言中的++和--
    C语言培训第一天
  • 原文地址:https://www.cnblogs.com/happyframework/p/2997319.html
Copyright © 2011-2022 走看看