Open Source .NET Development [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Open Source .NET Development [Electronic resources] - نسخه متنی

Brian Nantz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Levels


After obtaining a Logger and writing a log message, the first check on the message is whether it is loggable based on the Level of the message and the threshold of the logging in your application. Not including the generic log method, there are five logging Levels that correspond to the five methods required by ILog to exist in all Loggers (see Table 8.2). In addition, there are two special log Levels to turn logging off or to turn it on full-blast.

Table 8.2. Logging Levels

Level

Description

OFF

Log no messages.

DEBUG

Developer-oriented messages, usually used during development of the product.

INFO

Useful information messages such as state changes, client connection, user login, etc.

WARN

A problem or conflict has occurred, but it may be recoverable; then again, it could be the start of the system failing.

ERROR

A problem has occurred, but it is not fatal. The system will still function.

FATAL

Something caused the whole system to fail. This indicates that an administrator should restart the system and try to fix the problem that caused the failure.

ALL

Log all messages.

The default Level inherited from the root Logger if no Level is specified is the DEBUG Level. New levels can be added to the map on the Hierarchy. Unfortunately, these new levels cannot be used through the ILog interface. A new interface would need to be written to utilize the new levels.

TIP


See the TraceLog extension for an example of defining new levels and using them in a new interface.

The Levels are cumulative in that they allow all messages at their Level and at any Level less strict than themselves. Figure 8-2 demonstrates which messages will be logged in a given Level.

Figure 8-2. Logging Levels.

[View full size image]

For example, if your application's logging Level is set to WARN (left axis of the graph) and your logging code is

_logger.Info("Informational message");

then the message will not be logged because the top axis of the graph shows that in WARN, only WARN, ERROR, and FATAL messages are logged. This is the first Filter of the message. Additional, more powerful Filters can be set using the Filter class. If the message passes through the Level check, it is then passed to any configured Appenders.


    / 275