blob: 4fb5fd29b9813d38868709e755214a26751d3959 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Generated by Apache Maven Doxia at 2020-08-26 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache log4net &#x2013; Apache log4net: Features - Apache log4net</title>
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/site.css" type="text/css" />
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/prettify.min.js"></script>
<script type="text/javascript" src="../js/site.js"></script>
<meta name="author" content="Nicko Cadell" />
<meta name="Date-Revision-yyyymmdd" content="20200826" />
<meta http-equiv="Content-Language" content="en" />
<meta name="keywords" content="log4net features, log4net" />
</head>
<body class="composite">
<a href="https://logging.apache.org/">
<img class="logo-left" src="../images/ls-logo.jpg" alt="Apache logging services logo" />
</a>
<!--img class="logo-right" src="../images/logo.png" alt="Apache log4net logo" /-->
<div class="clear"></div>
<div class="navbar">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="http://logging.apache.org/log4net/">Apache log4net &trade;</a>
<ul class="nav">
<li>
<a href="https://wiki.apache.org/logging" class="external" target="_blank" title="Logging Wiki">Logging Wiki</a>
</li>
<li>
<a href="https://www.apache.org/" class="external" target="_blank" title="Apache">Apache</a>
</li>
<li>
<a href="https://logging.apache.org/" class="external" target="_blank" title="Logging Services">Logging Services</a>
</li>
<li>
<a href="https://github.com/apache/logging-log4net/" class="external" target="_blank" title="GitHub">GitHub</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<table class="layout-table">
<tr>
<td class="sidebar">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-home"></i>Apache log4net</li>
<li class="none">
<a href="../index.html" title="About">About</a>
</li>
<li class="none">
<a href="../download_log4net.cgi" title="Download">Download</a>
</li>
<li class="none">
<a href="../release/security-reports.html" title="Security Reports">Security Reports</a>
</li>
<li class="none">
<a href="../release/release-notes.html" title="Release Notes">Release Notes</a>
</li>
<li class="none">
<a href="../license.html" title="License">License</a>
</li>
</ul>
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-file"></i>Documentation</li>
<li class="none active">
<a href="../release/features.html" title="Features">Features</a>
</li>
<li class="none">
<a href="../release/framework-support.html" title="Supported Frameworks">Supported Frameworks</a>
</li>
<li class="none">
<a href="../release/example-apps.html" title="Example Apps">Example Apps</a>
</li>
<li class="none">
<a href="../release/config-examples.html" title="Config Examples">Config Examples</a>
</li>
<li class="none">
<a href="../release/building.html" title="Building">Building</a>
</li>
<li class="none">
<a href="../release/faq.html" title="FAQ">FAQ</a>
</li>
<li class="none">
<a href="../release/howto/index.html" title="How Tos">How Tos</a>
</li>
<li class="none">
<a href="../release/sdk/index.html" title="SDK Reference">SDK Reference</a>
</li>
</ul>
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-book"></i>Manual</li>
<li class="none">
<a href="../release/manual/introduction.html" title="Introduction">Introduction</a>
</li>
<li class="none">
<a href="../release/manual/configuration.html" title="Configuration">Configuration</a>
</li>
<li class="none">
<a href="../release/manual/contexts.html" title="Contexts">Contexts</a>
</li>
<li class="none">
<a href="../release/manual/plugins.html" title="Plugins">Plugins</a>
</li>
<li class="none">
<a href="../release/manual/repositories.html" title="Repositories">Repositories</a>
</li>
<li class="none">
<a href="../release/manual/internals.html" title="Internals">Internals</a>
</li>
</ul>
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-pencil"></i>For Contributors</li>
<li class="none">
<a href="../mail-lists.html" title="Mailing Lists">Mailing Lists</a>
</li>
<li class="none">
<a href="../issue-tracking.html" title="Issue Tracking">Issue Tracking</a>
</li>
<li class="none">
<a href="../source-repository.html" title="Repository">Repository</a>
</li>
<li class="none">
<a href="../integration.html" title="Continuous Integration">Continuous Integration</a>
</li>
</ul>
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-cog"></i>Project Reports</li>
<li class="none">
<a href="../rat-report.html" title="RAT Report">RAT Report</a>
</li>
</ul>
<ul class="nav nav-list">
<li class="nav-header"><i class="icon-info-sign"></i>Apache</li>
<li class="none">
<a href="http://www.apache.org/" class="external" target="_blank" title="Home">Home</a>
</li>
<li class="none">
<a href="http://www.apache.org/licenses/" class="external" target="_blank" title="License">License</a>
</li>
<li class="none">
<a href="http://www.apache.org/foundation/sponsorship.html" class="external" target="_blank" title="Sponsorship">Sponsorship</a>
</li>
<li class="none">
<a href="http://www.apache.org/foundation/thanks.html" class="external" target="_blank" title="Thanks">Thanks</a>
</li>
<li class="none">
<a href="http://www.apache.org/security/" class="external" target="_blank" title="Security">Security</a>
</li>
<li class="none">
<a href="http://www.apachecon.com" class="external" target="_blank" title="Conferences">Conferences</a>
</li>
</ul>
</div>
<div id="poweredBy">
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="../images/maven-feather.png" />
</a>
</div>
</td>
<td class="content">
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<a name="main"></a>
<div class="section" id="main">
<h2><a name="Apache_log4net_Features"></a>Apache log4net&#x2122; Features</h2>
<a name="overview"></a>
<div class="section" id="overview">
<h2><a name="Overview"></a>Overview</h2>
<p>
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.
</p>
<p>
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.
</p>
<p>
log4net is designed with two distinct goals in mind: speed and flexibility
</p>
</div>
<a name="features"></a>
<div class="section" id="features">
<h2><a name="Features"></a>Features</h2>
<ul>
<li>Support for multiple frameworks</li>
<li>Output to multiple logging targets</li>
<li>Hierarchical logging architecture</li>
<li>XML Configuration</li>
<li>Dynamic Configuration</li>
<li>Logging Context</li>
<li>Proven architecture</li>
<li>Modular and extensible design</li>
<li>High performance with flexibility</li>
</ul>
</div>
<a name="frameworks"></a>
<div class="section" id="frameworks">
<h2><a name="Support_for_multiple_frameworks"></a>Support for multiple frameworks</h2>
<p>
log4net runs on all ECMA CLI 1.0 compatible runtimes.
log4net has specific builds for the following frameworks:
</p>
<ul>
<li>.NET Core 1.0 - using netstandard-1.3</li>
<li>Microsoft&#xae; .NET Framework 1.0<a href="#no-bin-support"><sup>*</sup></a></li>
<li>Microsoft .NET Framework 1.1<a href="#no-bin-support"><sup>*</sup></a></li>
<li>Microsoft .NET Framework 2.0</li>
<li>Microsoft .NET Framework 3.5</li>
<li>Microsoft .NET Framework 4.0</li>
<li>Microsoft .NET Framework 4.5</li>
<li>Microsoft .NET Framework 3.5 Client Profile</li>
<li>Microsoft .NET Framework 4.0 Client Profile</li>
<li>Microsoft .NET Compact Framework 1.0<a href="#no-bin-support"><sup>*</sup></a></li>
<li>Microsoft .NET Compact Framework 2.0<a href="#no-bin-support"><sup>*</sup></a></li>
<li>Mono 1.0<a href="#no-bin-support"><sup>*</sup></a></li>
<li>Mono 2.0</li>
<li>Mono 3.5</li>
<li>Mono 4.0</li>
<li>Microsoft Shared Source CLI 1.0<a href="#no-bin-support"><sup>*</sup></a></li>
<li>CLI 1.0 Compatible<a href="#no-bin-support"><sup>*</sup></a></li>
</ul>
<p>The &quot;Client Profile&quot; builds are stripped down
versions of the &quot;normal&quot; builds that don't contain any
ASP.NET releated code - which for example means the
<tt>%aspnet-*</tt> patterns and the
<tt>AspNetTraceAppender</tt> are not available.</p>
<p style="font-size:smaller">
<a name="no-bin-support"><sup>*</sup></a>Not
supported by the binary release but can be built
from the source release.
</p>
</div>
<a name="appenders"></a>
<div class="section" id="appenders">
<h2><a name="Output_to_multiple_logging_targets"></a>Output to multiple logging targets</h2>
<p>
log4net ships with the following appenders (not on all frameworks):
</p>
<div class="table">
<table border="0" class="bodyTable" cellspacing="0">
<tr class="a">
<th>
Type</th>
<th>
Description</th>
</tr>
<tr class="b">
<td>log4net.Appender.AdoNetAppender</td>
<td>
Writes logging events to a database using either prepared statements or stored
procedures.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.AnsiColorTerminalAppender</td>
<td>
Writes color highlighted logging events to a an ANSI terminal window.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.AspNetTraceAppender</td>
<td>
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.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.ColoredConsoleAppender</td>
<td>
Writes color highlighted logging events to the application's Windows Console.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.ConsoleAppender</td>
<td>
Writes logging events to the application's Console. The events may go to either
the standard our stream or the standard error stream.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.DebugAppender</td>
<td>
Writes logging events to the .NET system.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.EventLogAppender</td>
<td>
Writes logging events to the Windows Event Log.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.FileAppender</td>
<td>
Writes logging events to a file in the file system.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.LocalSyslogAppender</td>
<td>
Writes logging events to the local syslog service (UNIX only).
</td>
</tr>
<tr class="a">
<td>log4net.Appender.MemoryAppender</td>
<td>
Stores logging events in an in memory buffer.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.NetSendAppender</td>
<td>
Writes logging events to the Windows Messenger service. These messages are
displayed in a dialog on a users terminal.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.OutputDebugStringAppender</td>
<td>
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.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.RemoteSyslogAppender</td>
<td>
Writes logging events to a remote syslog service using UDP networking.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.RemotingAppender</td>
<td>
Writes logging events to a remoting sink using .NET remoting.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.RollingFileAppender</td>
<td>
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.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.SmtpAppender</td>
<td>
Sends logging events to an email address.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.SmtpPickupDirAppender</td>
<td>
Sends logging events to an email
address but writes the emails to a
configurable directory rather than
sending them directly via SMTP.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.TelnetAppender</td>
<td>
Clients connect via Telnet to receive logging events.
</td>
</tr>
<tr class="b">
<td>log4net.Appender.TraceAppender</td>
<td>
Writes logging events to the .NET trace system.
</td>
</tr>
<tr class="a">
<td>log4net.Appender.UdpAppender</td>
<td>
Sends logging events as connectionless UDP datagrams to a remote host or a
multicast group using a UdpClient.
</td>
</tr>
</table>
</div>
<p>A special log4net.Appender.ForwardingAppender can
be used to wrap another appender, for example to
attach additional filters.</p>
</div>
<a name="hierarchy"></a>
<div class="section" id="hierarchy">
<h2><a name="Hierarchical_logging_architecture"></a>Hierarchical logging architecture</h2>
<p>
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.
</p>
</div>
<a name="xml-config"></a>
<div class="section" id="xml-config">
<h2><a name="XML_Configuration"></a>XML Configuration</h2>
<p>
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 configurations.
</p>
<p>
Alternatively log4net can be configured programmatically.
</p>
</div>
<a name="dynamic-config"></a>
<div class="section" id="dynamic-config">
<h2><a name="Dynamic_Configuration"></a>Dynamic Configuration</h2>
<p>
log4net can monitor its configuration file for changes and dynamically
apply changes made by the configurator. The logging levels, appenders,
layouts, and just about everything else can be adjusted at runtime.
In many 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.
</p>
</div>
<a name="context"></a>
<div class="section" id="context">
<h2><a name="Logging_Context"></a>Logging Context</h2>
<p>
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 could be
stored in a ThreadContext property. This property would then be automatically
logged as part of each subsequent logging message made from the same thread.
</p>
</div>
<a name="history"></a>
<div class="section" id="history">
<h2><a name="Proven_architecture"></a>Proven architecture</h2>
<p>
log4net is based on the highly successful Apache log4j&#x2122; logging library,
in development since 1996. This popular and proven architecture has
so far been ported to 12 languages.
</p>
</div>
</div>
</td>
</tr>
</table>
</div>
<div class="footer">
<p>Copyright &copy; 2004-2020 <a class="external" href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p>
<p>Apache log4net, Apache, log4net, the Apache feather logo, the Apache Logging Services project logo and the Built by Maven logo are trademarks of The Apache Software Foundation.</p>
<p>Site powered by <a class="external" href="http://getbootstrap.com/">Twitter Bootstrap</a>. Icons from <a class="external" href="http://glyphicons.com/">Glyphicons Free</a>.</p>
</div>
</div>
</body>
</html>