ArticleDirectory
- Support for multiple frameworks
- Output to multiple logging targets
- Hierarchical logging Architecture
- Xml configuration
- Dynamic Configuration
- Logging Context
- Proven Architecture
- Modular and extensible design
- High Performance with flexibility
From: http://logging.apache.org/log4net/index.html
About Apache log4net
Log4net is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent log4j framework to. net runtime. we have kept the framework similar in spirit to the original log4j while taking advantage of new features in. net runtime. for more information on log4net see the features document.
Log4net is part of the Apache logging services project. The logging services project is intended to provide cross-language logging services for purposes of application debugging and auditing.
Log4net features Overview
Log4net is a tool to help the programmer output log statements to a variety of output targets. in case of problems with an application, it is helpful to enable logging so that the problem can be located. with log4net it is possible to enable logging at runtime without modifying the application binary. the log4net package is designed so that log statements can remain in shipped code without incurring a high performance cost. it follows that the speed of logging (or rather not logging) is crucial.
At the same time, log output can be so voluminous that it quickly becomes overwhelming. one of the distinctive features of log4net is the notion of hierarchical loggers. using these loggers it is possible to selectively control which log statements are output at arbitrary granularity.
Log4net is designed with two distinct goals in mind: speed and flexibility
Features
- Support for multiple frameworks
- Output to multiple logging targets
- Hierarchical logging Architecture
- Xml configuration
- Dynamic Configuration
- Logging Context
- Proven Architecture
- Modular and extensible design
- High Performance with flexibility
Support for multiple frameworks
Log4net runs on all ecma cli 1.0 compatible runtimes. log4net has specific builds for the following frameworks:
- Microsoft. NET Framework 1.0 (1.0.3705)
- Microsoft. NET Framework 1.1 (1.1.4322)
- Microsoft. NET Framework 2.0 (2.0.50727)
- Microsoft. NET Compact Framework 1.0
- Mono 1.0
- Mono 2.0
- Microsoft Shared Source CLIs 1.0
- Command Line 1.0 compatible
Note: Due to the. NET frameworks support for backward compatibility log4net will run on future versions of the runtimes listed above.
Output to multiple logging targets
Log4net ships with the following appenders (not on all frameworks ):
Type |
Description |
Log4net. appender. adonetappender |
Writes logging events to a database using either prepared statements or stored procedures. |
Log4net. appender. ansicolorterminalappender |
Writes color highlighted logging events to a an ANSI terminal window. |
Log4net. appender. aspnettraceappender |
Writes logging events 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 |
Writes color highlighted logging events to the application's windows console. |
Log4net. appender. leleappender |
Writes logging events to the application's console. The events may go to either the standard our stream or the standard error stream. |
Log4net. appender. eventlogappender |
Writes logging events to the Windows event log. |
Log4net. appender. fileappender |
Writes logging events to a file in the file system. |
Log4net. appender. localsyslogappender |
Writes logging events to the local Syslog Service (unix only ). |
Log4net. appender. memoryappender |
Stores logging events in an in memory buffer. |
Log4net. appender. netsendappender |
Writes logging events to the Windows Messenger Service. These messages are displayed in a dialog on a users terminal. |
Log4net. appender. outputdebugstringappender |
Writes logging events to the debugger. If the application has no debugger, the system debugger displays the string. If the application has no debugger and the system debugger is not active, the message is ignored. |
Log4net. appender. remotesyslogappender |
Writes logging events to a remote syslog service using UDP networking. |
Log4net. appender. remotingappender |
Writes logging events to a remoting sink using. Net remoting. |
Log4net. appender. rollingfileappender |
Writes logging events to a file in the file system. The rollingfileappender can be configured to log to multiple files based upon date or file size constraints. |
Log4net. appender. smtpappender |
Sends logging events to an email address. |
Log4net. appender. telnetappender |
Clients connect via Telnet to receive logging events. |
Log4net. appender. traceappender |
Writes logging events to the. NET trace system. |
Log4net. appender. udpappender |
Sends logging events as connectionless UDP multicast Rams to a remote host or a multicast group using a udpclient. |
Hierarchical logging Architecture
Hierarchical logging is an ideal fit with component based development. each component has its own of logger. when individually tested, the properties of these loggers may be set as the developer requires. when combined with other components, the loggers inherit the properties determined by the integrator of the components. one can selectively elevate logging priorities on one component without affecting the other components. this is useful when you need a detailed trace from just a single component without crowding the trace file with messages from other components. all this can be done through configuration files; no code changes are required.
Xml configuration
Log4net is configured using an xml configuration file. the configuration information can be embedded within other xml configuration files (such as the application's. config File) or in a separate file. the configuration is easily readable and updateable while retaining the flexibility to express all deployments. alternatively log4net can be configured programmatically.
Dynamic Configuration
Log4net can monitor its configuration file for changes and dynamically apply changes made by the aggregator. the logging levels, appenders, layouts, and just about everything else can be adjusted at runtime. in your cases it is possible to diagnose application issues without terminating the process in question. this can a very valuable tool in investigating issues with deployed applications.
Logging Context
Log4net can be used to collect logging context data in a way that is transparent to the developer at the point of logging. the globalcontext and the threadcontext allow the application to store contextual data that is attached to logging messages. for instance, in a web service, once the caller is authenticated the username of the caller cocould be stored in a threadcontext property. this property wowould then be automatically logged as part of each subsequent logging message made from the same thread.
Proven Architecture
Log4net is based on the highly successful log4j logging library, in development since 1996. This popular and proven architecture has so far been ported to 12 languages ages.
Ref:
Log4net GUI Configuration tool http://www.codeproject.com/KB/cs/Log4netEditor.aspx