Log4net Study manual One of the features of Apache log4net?

Source: Internet
Author: User
Tags compact syslog log4net

the content is the Apache Log4net official website Technical document to be translated by Google

Http://logging.apache.org/log4net/release/features.html

Overview

Log4net is a tool that helps programmers output various output targets for log reports. In the event of a problem, an application that helps enable logging, such problems can be found. With Log4net, you can enable logging at run time without modifying the application's binary files. The Log4net package is designed so that log statements can remain in the shipping code without generating high performance costs. This shows that the speed of recording (or, rather, not recording) is crucial.
At the same time, the log output can be so voluminous that it quickly becomes overwhelming. One of the log4net's distinctive features is the concept of a layered recorder. Using these loggers, you can selectively control which log statements are output at any granular level.
Log4net is designed with two different goals in mind: speed and flexibility

Product Features
    • Supports multiple frameworks
    • Output to multiple log destinations
    • Logging of hierarchical schemas
    • XML configuration
    • Dynamic configuration
    • Login context
    • Proven architecture
    • Modular and scalable Design
    • High performance and flexibility

Supports multiple frameworks

The log4net runs in all ECMA CLI1.0 compatible operating environments. Log4net with a specific version of the following framework:

    • Microsoft®.net Framework 1.0
    • Microsoft. NET Framework 1.1
    • Microsoft. NET Framework 2.0
    • Microsoft. NET Framework 3.5
    • Microsoft. NET Framework 4.0
    • Microsoft. NET Framework 3.5 Client Profile
    • Microsoft. NET Framework 4.0 Client profile
    • Microsoft. NET Compact Framework 1.0*
    • Microsoft. NET Compact Framework 2.0*
    • Mono 1.0
    • Mono 2.0
    • Microsoft Shared Source CLI 1.0*
    • CLI 1.0 Compatible
Output to multiple log destinations

The log4net comes with the following additional destinations (not all frames):

Log type Type description
Log4net. Appender.adonetappender Write to the event log using either a prepared statement or a stored procedure database.
Log4net. Appender.ansicolorterminalappender Write color highlighting events logged to an ANSI terminal window.
Log4net. Appender.aspnettraceappender Writes a logging event to the ASP trace context. These can then be rendered at the end of the ASP page or on the ASP trace page.
Log4net. Appender.coloredconsoleappender The write color highlight event is logged to the application's Windows console.
Log4net. Appender.consoleappender Write logged events to the application's console. This event may be targeted to our standard stream or standard error stream.
Log4net. Appender.debugappender Write logged events to. NET System.
Log4net. Appender.eventlogappender Write the log logging event to the Windows event log.
Log4net. Appender.fileappender Writes a record event to a file in the file system.
Log4net. Appender.localsyslogappender Write the event log to the local syslog service (Unix only).
Log4net. Appender.memoryappender Stores a buffer that records events in memory.
Log4net.Appender.NetSendAppender Write logged events to the Windows Messenger service. This information is displayed in a dialog box for a user terminal.
Log4net. Appender.outputdebugstringappender The debugger that writes log events. If the application does not debug, the system debugger displays the string. If the application does not have debugging and the system debugger is inactive, the message is ignored.
Log4net. Appender.remotesyslogappender Writes a log event to the remote Syslog service using a UDP network.
Log4net. Appender.remotingappender Write to the event log for use. NET Remoting a remote receiver.
Log4net. Appender.rollingfileappender Writes a record event to a file in the file system. Rollingfileappender can be configured to log on to multiple files based on a date or file size constraint.
Log4net. Appender.smtpappender The e-mail address to which the event is logged.
Log4net. Appender.smtppickupdirappender Events are logged to an e-mail address, but the message is written to the configuration directory instead of sending them directly through SMTP.
Log4net. Appender.telnetappender The client connects to the receive logging event via Telnet.
Log4net. Appender.traceappender Write logged events to. NET tracking system.
Log4net. Appender.udpappender Send a logged event without a connected UDP datagram to a remote host or to a multicast group using UdpClient.

Special log4net. Appender.forwardingappender can be used to package other add-ons, such as additional filters.

Logging of hierarchical schemas

Hierarchical logging is more appropriate than component-based development. Each component has its own recorder. When tested separately, the performance of these recorders can be set for developers. When combined with other components, the logger inherits the attributes determined by the integral of the part. One can selectively increase the record to take precedence over one component without affecting the other components. This is useful when you need just a single part to keep track of the information in detail without crowding the trace files with other components. All this can be done through a configuration file, and there is no need to modify the code.

XML configuration

The log4net is configured using an XML configuration file. The configuration information can be embedded in other XML configuration files (such as the application's. config file), or in a separate file. Configuration is very easy to read and update, while preserving the flexibility to express all configurations.
In addition, the log4net can be programmed by programming.

Dynamic configuration

Log4net can monitor the configuration file for its changes and dynamically apply the changes made by the configuration. Logging levels, appends, layouts, and almost everything can be adjusted at run time. In many cases, you may not terminate the problem in the process to diagnose the application. This can be a very valuable tool in investigating issues with deploying applications.

Record context

Log4net can be used to collect recorded contextual data in a way that is transparent to the developer at the point of recording. The Globalcontext and Threadcontext allow application storage to attach to the log message context data. For example, in a Web service, once the caller is authenticated, the caller's user name can be stored in a Threadcontext property. This property is automatically logged as part of every subsequent log message that is made from the same thread.

A mature architecture

Log4net is based on the very successful apache™ log4j log library, which has evolved since 1996 to this popular and mature architecture that has so far been ported to 12 languages.

Log4net Study manual One of the features of Apache log4net?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.