Apache logging services logo

Apache log4net™ Release Notes


Breaking Changes

Attention: Starting with 3.0.0 we only support the following target frameworks

  • net462
  • netstandard2.0
The reasoning for this change can be found in Dropping support for older runtimes

Removed obsolete classes and members - obsolete since 1.2.14 - 2015

  • log4net.Appender.BufferingAppenderSkeleton.OnlyFixPartialEventData
  • log4net.Appender.ColoredConsoleAppender.ctor(ILayout)
  • log4net.Appender.ColoredConsoleAppender.ctor(ILayout, bool)
  • log4net.Appender.ConsoleAppender.ctor(ILayout)
  • log4net.Appender.ConsoleAppender.ctor(ILayout, bool)
  • log4net.Appender.DebugAppender.ctor(ILayout)
  • log4net.Appender.EventLogAppender.ctor(ILayout)
  • log4net.Appender.FileAppender.ctor(ILayout, string)
  • log4net.Appender.FileAppender.ctor(ILayout, string, bool)
  • log4net.Appender.MemoryAppender.OnlyFixPartialEventData
  • log4net.Appender.SmtpAppender.LocationInfo
  • log4net.Appender.TextWriterAppender.ctor(ILayout, Stream)
  • log4net.Appender.TextWriterAppender.ctor(ILayout, TextWriter)
  • log4net.Appender.TraceAppender.ctor(ILayout)
  • log4net.Config.DOMConfigurator
  • log4net.Config.AliasDomainAttribute
  • log4net.Config.DomainAttribute
  • log4net.Config.DOMConfiguratorAttribute
  • log4net.Core.LoggerManager.GetLoggerRepository
  • log4net.Core.LoggerManager.CreateDomain
  • log4net.Core.LoggingEventData.TimeStamp
  • log4net.Core.LoggingEvent.GetExceptionStrRep
  • log4net.Core.LoggingEvent.FixVolatileData
  • log4net.LogManager.GetLoggerRepository
  • log4net.LogManager.CreateDomain

Removed obsolete classes and members - obsolete since 2.0.6 - 2016

  • log4net.Util.SystemInfo.ProcessStartTime

Changed members

  • log4net.Util.ReadOnlyPropertiesDictionary.InnerHashtable is now Dictionary<string, object?> (instead of System.Collections.Hashtable before) The reason is an optimization as part of Add support for nullable annotations
  • log4net.Appender.MemoryAppender.m_eventsList (protected field) is now List<LoggingEvent> (instead of System.Collections.ArrayList before) The reason is an optimization as part of Add support for nullable annotations

Sealed classes - the following classes are now sealed

  • log4net.Config.AliasRepositoryAttribute
  • log4net.Config.RepositoryAttribute
  • log4net.Config.XmlConfiguratorAttribute

Apache log4net 3.0.0 addresses reported issues:

Bug fixes


Apache log4net 2.0.17 addresses reported issues:


Attention: .NET 3.5 Client Profile is no longer supported. I'm really sorry, I've tried to keep as many of the legacy targets available as possible, but after spending another 4 or so hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware, this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you. Apache log4net 2.0.15 addresses reported issues:

Bug fixes

  • Improper usage of xml namespacing for netfx targets after a netstandard update ( LOG4NET-685, related LOG4NET-683)
  • Locking hashtables during write in RenderMap calls to make them thread-safe ( LOG4NET-646)
  • An issue where RollingFilAppender would sometimes overwrite files instead of rolling them ( LOG4NET-672)



Apache log4net 2.0.14 is a minor release to address some reported issues and accept a pull request provided by a community member:

Bug fixes

  • Pull request by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
  • Community request to correctly handle null data in ReadOnlyPropertiesDictionary
  • Pull request by @erikma to use the numeric thread id for .net worker pool threads (LOG4NET-680)
  • Pull request by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName() (LOG4NET-671)


Apache log4net 2.0.13 is a minor release to address some reported issues and accept some pull requests provided by community members:

Bug fixes

  • Addresses issue [LOG4NET-583] with proposed solution by Emmo Emminghaus, namely to provide an unique mutex identifier for the file rolling logic.
  • Accepts pull request 76 by @dschwartzni to allow the netstandard2.0 library to be used within net472 web services
  • Accepts pull request 18 by @dmarlow to update the xml layout mimicking log4j


Apache log4net 2.0.12 is a minor fix release to address reported issues on non-windows platforms.

Bug Fixes

  • Addresses the issues reported in [LOG4NET-652] and [LOG4NET-653] whereby logging could throw a PlatformNotSupported exception when the username is required within logs on non-Windows platforms. The implemented behavior is to fall back, where possible, on Environment.UserName or provide text that the facility is not supported.


Apache log4net 2.0.11 fixes incorrect version strings within the released binaries and contains some minor fixes to correctly dispose of StreamWriters used during log flushing, thanks to community member @NicholasNoise


Apache log4net 2.0.10 improves netstandard2.0 support thanks to community member @NicholasNoise.

Bug Fixes

  • [LOG4NET-575] Addresses CVE-2018-1285 by cherry-picking the fix from Dominik Psenner, reported by Karthik Balasundaram, as it already existed in the the develop branch


Apache log4net 2.0.9 adds netstandard2.0 support and restructures the project to enable easier build as well as build at AppVeyer. Project files have been updated to the modern Sdk format.

Bug Fixes

  • [LOG4NET-559] Add null checkes to avoid issues thrown by custom appenders
  • [LOG4NET-563] Site styling copied from log4j


Apache log4net 2.0.8 fixes a LockRecursionException that could happen inside the FileAppender under certain circumstances. It also adds support for LogicalThreadContext to the .NET Standard build based on AsyncLocal rather than CallContext.

Bug Fixes

  • [LOG4NET-466] - "LockRecursionException: A read lock may not be acquired with the write lock held in this mode." exception
  • [LOG4NET-550] - Logging recursively from an Appender not supported for NET_4_0 and MONO_4_0
  • [LOG4NET-551] - LockRecursionException when using File Appenders
  • [LOG4NET-554] - LogicalThreadContext was removed in .NETStandard

New Features

  • [LOG4NET-553] - DebugAppender configuration should give the possibility to disable outputting loggerName as category


Apache log4net 2.0.7 fixes a glitch in nuget packaging and is otherwise identical to 2.0.6 (apart from the copyright year and assembly version). If you are not using the nuget package there is no reason to upgrade.

Bug Fixes

  • [LOG4NET-540] - nuget dependencies for .NET Standard leak into net46


The Apache log4net team is now responsible for the nuget package, we've changed the version number of this release to align the version numbers. Release 2.0.6 is supposed to be compatible with 1.2.15.

The binary distributions no longer contain assemblies built for the .NET Framework 1.x or Mono 1.x - you can build those yourself using the source distribution.

Starting with 2.0.6 .NET Core - or more precisely .NET Standard 1.3 - has become a supported platform. Please note that several features of log4net are not available when using the .NET Core version, see framework support for details.

Bug Fixes


  • [LOG4NET-530] - Use UTC internally to avoid ambiguous timestamps

New Features

  • [LOG4NET-467] - Is .NET Core, will be supported in the near future, or not
  • [LOG4NET-511] - API to flush appenders
  • [LOG4NET-526] - Add appSetting conversion pattern to PatternString


Bug Fixes

  • [LOG4NET-462] - ReadOnlyPropertiesDictionary not thread safe
  • [LOG4NET-488] - Fix tests build
  • [LOG4NET-489] - AdoNetAppender fails after upgrade to 2.0.4
  • [LOG4NET-490] - InterProcessLock Tests fail
  • [LOG4NET-493] - Log4net 1.2.14/ADO.NET appender throws exception when starting (1.2.13 with same config works fine)
  • [LOG4NET-494] - ArgumentOutOfRange with SQLite
  • [LOG4NET-495] - Error when BufferSize is >1, parameter already defined


Bug Fixes

  • [LOG4NET-408] - Correction on InterProcessLock
  • [LOG4NET-443] - Logger.CallAppenders
  • [LOG4NET-447] - MemoryAppender class is not thread safe
  • [LOG4NET-455] - LogicalThreadContext does not flow correctly through async/await
  • [LOG4NET-479] - Cannot compile log4net.vs2008
  • [LOG4NET-484] - System.ObjectDisposedException with FileAppender+InterProcessLock
  • [LOG4NET-485] - RollingFileAppender cannot be used by multiple process
  • [LOG4NET-486] - Rolling File Appender with 'maxSizeRollBackups' and 'datePattern' does not detect existing logs initially


  • [LOG4NET-456] - Include debug symbol files in release packages
  • [LOG4NET-457] - SMTP Appender should trim leading and trailing separators from address fields

New Features

  • [LOG4NET-473] - Option for file extension in SmtpPickupDirAppender


Bug Fixes

  • [LOG4NET-132] - Environment variables are mistakenly case sensitive on windows
  • [LOG4NET-376] - Race condition in AbsoluteTimeDateFormatter
  • [LOG4NET-393] - Using dynamic methods with log4net causes NullReferenceException in StackFrameItem
  • [LOG4NET-399] - Does not build for Compact Framework 2.0
  • [LOG4NET-404] - assemblies for .NET 3.5 are missing ILogExtensions
  • [LOG4NET-405] - SmtpAppender encoding changes


  • [LOG4NET-394] - Lambda-based ILog-Extensions should catch errors


The binary distributions no longer contain assemblies built for the Compact Framework 2.0 - you can build those yourself using the source distribution.

Bug Fixes

  • [LOG4NET-148] - ThreadContext uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic] variables.
  • [LOG4NET-178] - Log4Net stops logging after appdomain recycle of ASP.NET2.0 application
  • [LOG4NET-202] - AdoNetAppenderParameter.Size Property is not optional
  • [LOG4NET-218] - Test StringFormatTest.TestFormatString fails
  • [LOG4NET-220] - multiple users overwrite existing log file when RollingFileAppender is rolling over date and minimal locking is used
  • [LOG4NET-228] - log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in System.Net.Dns.GetHostName(). The exception should be ignored.
  • [LOG4NET-266] - AdoNetAppender does not work on a IIS 7 website using Windows authentication
  • [LOG4NET-277] - Registering a custom Object Renderer in configuration file
  • [LOG4NET-284] - In a multithreaded application, duplicate messages are output.
  • [LOG4NET-294] - Exception rendering object type [System.OutOfMemoryException]
  • [LOG4NET-317] - LogicalThreadContext sometimes doesn't follow CallContext's logical thread
  • [LOG4NET-322] - Conditional compilation symbols for .net4 Release
  • [LOG4NET-323] - AbsoluteTimeDateFormatter caches string representation of now too aggressively
  • [LOG4NET-331] - AdoNetAppender errors when writing Asp.net item when Request object is null
  • [LOG4NET-335] - Lost the ability to monitor changes to logger config files when you call ConfigureAndWatch multiple times with different Config File Names - worked fine on
  • [LOG4NET-341] - RemotingAppender Error
  • [LOG4NET-343] - ArgumentOutOfRangeException in log4net hierarchy on "." logger name
  • [LOG4NET-347] - Log4net not working in an ASP.Net environment with medium trust
  • [LOG4NET-348] - System.IndexOutOfRangeException when StackFrameLevel is greater then StackFrames length
  • [LOG4NET-352] - CS0419 during build with Mono >2.6
  • [LOG4NET-360] - EventLogAppender can corrupt the event log on Windows Vista and higher if the string is longer than 31839 bytes
  • [LOG4NET-361] - RollingLogFileAppender does not correctly initialize the backup index when style is date or composite
  • [LOG4NET-369] - preserveLogFileNameExtension is not considered when rolling over time after an application restart
  • [LOG4NET-370] - RemoteSyslogAppender doesn't properly handle newline in log message
  • [LOG4NET-371] - Log with formatting doesn't call custom renderers (IObjectRenderer)
  • [LOG4NET-375] - typo / misspelling in log message
  • [LOG4NET-378] - Rolling log file is overwritten when application is restarted
  • [LOG4NET-379] - NullReferenceException in FileAppender when file is not filled.
  • [LOG4NET-382] - TargetInvocationException occurs because MESSAGE_SIZE fields in EventLogAppender are initialized in wrong order


  • [LOG4NET-222] - [PATCH] Improve AnsiColorTerminalAppender to support marking colors as Light
  • [LOG4NET-223] - [PATCH] Improve AnsiColorTerminalAppender to support marking colors as Light
  • [LOG4NET-232] - Use ReaderWriterLockSlim instead of ReaderWriterLock.
  • [LOG4NET-259] - Log4Net does not create a new tab in Chainsaw
  • [LOG4NET-283] - OnlyOnceErrorHandler is not subclass-friendly
  • [LOG4NET-292] - Managed ColoredConsoleAppender for .NET2/Mono.
  • [LOG4NET-315] - SmtpAppender - Add support for ignoring certificate errors
  • [LOG4NET-316] - Provide a Layout Pattern that is re-evaluated on each use
  • [LOG4NET-318] - log4net doesn't pass verification
  • [LOG4NET-334] - Appender Faill over
  • [LOG4NET-354] - E-mail encoding configuration setting for SmtpAppender
  • [LOG4NET-362] - [PATCH] SystemInfo.AssemblyLocationInfo throws unhandled ArgumentException "Absolute path required" when exe is started via UNC path
  • [LOG4NET-386] - Can't access ThreadContext properties

New Features

  • [LOG4NET-290] - Add Lambda-based ILog-Extensions (embedded log.IsEnabled)
  • [LOG4NET-342] - Add a way to prevent silent failure


log4net 1.2.11 is not only a bugfix release, it also adds support for Microsoft® .NET 4.0 as well as the client profiles of .NET 3.5 and .NET 4.0.

Starting with this release log4net uses a new strong name key but we also provide a binary distribution using the "old" strong name key of log4net 1.2.10 and earlier. See the FAQ for details.

The binary distributions no longer contain assemblies built for the Compact Framework 1.0 or the Shared Source CLI - you can build those yourself using the source distribution.

Breaking Changes

The signature of ILoggerFactory.CreateLogger has changed.

Bug Fixes

  • [LOG4NET-76] - TextWriterAdapter is not thread safe
  • [LOG4NET-79] - SecurityException thrown in LogicalThreadContextProperties GetProperties
  • [LOG4NET-81] - LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with EventArgs.Empty instead of passing through its EventArgs parameter.
  • [LOG4NET-93] - Typos for node name in tutorial, excess quote, invalid XML
  • [LOG4NET-94] - Incorrect config file for ..\examples\net\1.0\Tutorials\ConsoleApp
  • [LOG4NET-95] - Level.CompareTo() may result a wrong Value -> sorting of Levels does not work
  • [LOG4NET-113] - SystemInfo.GetTypeFromString() raises NotSupportedException
  • [LOG4NET-123] - EnvironmentPatternConverter does not expand User or System level environment variables under Windows
  • [LOG4NET-126] - Links on the log4net Examples page do not work, including the overview link explaining why the other links do not work
  • [LOG4NET-128] - Either documentation is incorrect or a bug in SmtpAppender
  • [LOG4NET-129] - EventLogAppender EventID parsing does not handle Active Properties properly
  • [LOG4NET-135] - Bad example code in documentation
  • [LOG4NET-137] - log4net.Filter.LevelMatchFilter does not work anymore
  • [LOG4NET-143] - Invalid Repository Config Uri composition from "log4net.Config" application setting
  • [LOG4NET-146] - System.NullReferenceException on FindAndRender object
  • [LOG4NET-158] - XMLConfigurator.ConfigureAndWatch() leaks resources if called multiple times
  • [LOG4NET-167] - ArrayOutOfBounds Exception in MemoryAppender.getEvents()
  • [LOG4NET-212] - Threading bug in the PatternConverter.cs
  • [LOG4NET-214] - EventLogAppender should also use config file to set EventId
  • [LOG4NET-215] - Exception on Convert for return %class{1} name
  • [LOG4NET-229] - Japanese characters get garbled with log4net.Layout.XmlLayoutSchemaLog4j
  • [LOG4NET-241] - Issue tracking page does not link to project
  • [LOG4NET-242] - Download page does not have link to KEYS file
  • [LOG4NET-243] - broken link on http://logging.apache.org/log4net/release/example-apps.html
  • [LOG4NET-244] - SmtpAppender.To Property has incorrect delimiter
  • [LOG4NET-257] - Visual Studio 2010 .NET 4.0 Application does not copy log4net lib to bin directory
  • [LOG4NET-265] - RemoteFileAppender Tests fail on Windows 7
  • [LOG4NET-274] - log4net doesn't log when running a .Net 4.0 Windows application built in Release mode
  • [LOG4NET-297] - AppenderSkeleton.RequiresLayout docs and implementation don't match
  • [LOG4NET-300] - FilterTest doesn't compile for .Net 2.0
  • [LOG4NET-301] - Unit tests fail on a clean checkout on .NET 2.0 using NAnt
  • [LOG4NET-310] - EventLogAppender's ActivateOptions throws SecurityException on Vista/Win2k3 and later when not run as administrator
  • [LOG4NET-311] - MinimalLock and AppendToFile=false don't work together in trunk's FileAppender


  • [LOG4NET-31] - Allow user to pass in additional parameters to <converter> node via some kind of <property> tag
  • [LOG4NET-38] - EventLogAppender: Add support for setting the Category on Event Log messages.
  • [LOG4NET-66] - PreserveFileExtension with StaticFileName
  • [LOG4NET-77] - A small improvement of log4net.Layout.Pattern.ExceptionPatternConverter - added 'Option' propery support
  • [LOG4NET-88] - support .NET 2.0 connectionStrings configuration section
  • [LOG4NET-96] - Expose the Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler.
  • [LOG4NET-97] - Make Hierarchy's ILoggerFactory aware of the repository's LevelMap
  • [LOG4NET-98] - Update header comment in files to be compliant with new Apache header requirements: http://www.apache.org/legal/src-headers.html for 11/1/2006 deadline
  • [LOG4NET-100] - IPAddressConverter improvement for .NET 2 or .NET 3
  • [LOG4NET-106] - TraceAppender : Add switch to disable using logger name as trace category
  • [LOG4NET-112] - Add support to the UdpAppender for IP v6 remote addresses
  • [LOG4NET-131] - Add Cc and Bcc support to SmtpAppender
  • [LOG4NET-141] - Add CreateConnection method to AdoNetAppender to allow subclasses to have control of IDbConnection.
  • [LOG4NET-153] - Make it easier to configure multiple appenders in code using BasicConfigurator
  • [LOG4NET-157] - FAQ for getting the fully-qualified name of a class
  • [LOG4NET-164] - using a named mutex for file appenders
  • [LOG4NET-170] - Documentation improvement re: fixing and active properties
  • [LOG4NET-246] - Make it possible to choose whether or not to watch configuration files specified using the "log4net.Config" appsetting key

New Features

  • The various static Configure methods of the Configurator classes now return collections of configuration messages rather than void.
  • [LOG4NET-59] - add the ability to roll files based on universal time (UTC).
  • [LOG4NET-64] - add the ability to preserve the log file name extension when rolling the log file.
  • [LOG4NET-87] - Support ASP.Net related PatternConverters to allow items from the HttpContext.Current.Session, Cache, Request, etc. to be captured.
  • [LOG4NET-92] - Build for Compact Framework 2.0
  • [LOG4NET-107] - Added ExceptionEvaluator
  • [LOG4NET-115] - Expand UserAppDataPath in filename
  • [LOG4NET-116] - allow smtp to ssl authenticate and with certificates.
  • [LOG4NET-154] - Add a StackTracePatternConverter to display method calls leading up to log message
  • [LOG4NET-155] - Add TimeEvaluator
  • [LOG4NET-168] - New property ReplyTo address for the SmtpAppender required
  • [LOG4NET-176] - Buildable with VS 2008 and .NET FW 3.5
  • [LOG4NET-233] - Support .NET 4.0 including Client Profile


Bug Fixes

  • [LOG4NET-21] - RemotingAppender fails once NDC becomes empty
  • [LOG4NET-22] - XmlLayout allows output of invalid control characters
  • [LOG4NET-23] - example-apps.html links are off by one folder level
  • [LOG4NET-25] - RollingFileAppender can fail if RollOverIfDateBoundaryCrossing required
  • [LOG4NET-28] - AdoNetAppender does not support inserting NULL into columns
  • [LOG4NET-29] - LevelMatchFilter should return Neutral when no match is found
  • [LOG4NET-32] - AdoNetAppender losing first entry
  • [LOG4NET-35] - Exception rendering ThreadContextStack if null value pushed into stack
  • [LOG4NET-36] - System.Diagnostics.Trace may throw exception if AppDomain does not have config file
  • [LOG4NET-40] - RollingFileAppender does not limit files to MaxSizeRollBackups when CountDirection is 1
  • [LOG4NET-41] - RollingFileAppender roll over date fail
  • [LOG4NET-42] - Serialised LoggingEvent does not preserve the Fix flags
  • [LOG4NET-43] - Specifying an empty string as a property in the config file results in an error
  • [LOG4NET-44] - XmlLayout emits all properties under a node named global-properties, rather than just properties.
  • [LOG4NET-49] - CountingQuietTextWriter does not count strings written with WriteLine
  • [LOG4NET-50] - Process.StartTime hangs on some systems
  • [LOG4NET-60] - Bug in RollingFileAppender.cs causing failure to timely roll files on monthly interval
  • [LOG4NET-63] - Documentation typos
  • [LOG4NET-65] - Unhandled SecurityException exception for FileIOPermission while loading configuration file
  • [LOG4NET-67] - CVE-2006-0743 Security vulnerability in LocalSyslogAppender
  • [LOG4NET-69] - Exception thrown when *Format methods are given a malformed format string
  • [LOG4NET-70] - CoreDll.dll referenced with different capitalisation
  • [LOG4NET-73] - ADONetAppender.ActivateOptions() leaks database connection when called multiple times

New Features

  • [LOG4NET-11] - Add Flush command to API
  • [LOG4NET-24] - Programmatic flush of BufferingAppenderSkeleton buffer
  • [LOG4NET-37] - Allow the RepositorySelector type to be specified using the AppSettings config
  • [LOG4NET-46] - Support appenders that can output multiple events efficiently
  • [LOG4NET-51] - WmiAppender


  • [LOG4NET-3] - Support per event patterns in FileAppender File name
  • [LOG4NET-13] - Allow SMTPAppender to have replaceable parameters in Subject
  • [LOG4NET-15] - Email high "importance" priority setting with SmtpAppender
  • [LOG4NET-17] - Line-wrapping Appender Layouts
  • [LOG4NET-33] - Ability to use global property to point to log4net configuration file
  • [LOG4NET-34] - Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
  • [LOG4NET-45] - PluginAttribute does not allow plugin type to be specified as a Type, only as a string
  • [LOG4NET-52] - Allow XML configurator to set properties of type Object
  • [LOG4NET-53] - Allow repository properties to be set in the config file
  • [LOG4NET-56] - Support rendering IEnumerator objects as well as ICollections
  • [LOG4NET-58] - Support clean build on .NET 2.0
  • [LOG4NET-72] - Performance of ILog.xxxFormat methods
  • [LOG4NET-74] - Change MemoryAppender member variables to protected

1.2.9 Beta

Breaking Changes

Renamed namespaces

Renamed namespace log4net.spi to log4net.Core . Renamed namespace log4net.helpers to log4net.Util .

Renamed config classes and attributes

In the log4net.Config namespace the DOMConfigurator , DOMConfiguratorAttribute, DomainAttribute, and AliasDomainAttribute have been marked as obsolete. These types are still available and functional in this release.

The XmlConfigurator and XmlConfiguratorAttribute types replace DOMConfigurator and DOMConfiguratorAttribute. The RepositoryAttribute and AliasRepositoryAttribute types replace DomainAttribute and AliasDomainAttribute.

Fixed pascal casing of type names

Renamed AdoNetAppender, AspNetTraceAppender, SmtpAppender, Iso8601DateFormatter, MdcFilter, and NdcFilter. Note that the config file type resolver is case insensitive so this is only a breaking change for code that programmatically creates a type that has been renamed.

Layouts changed to stream their output to a TextWriter

Layouts have been changed to format their output to a TextWriter rather than return a string. This increases performance and reduces temporary object creation.

C style string escapes no longer supported by config parser

The XML config parser no longer supports decoding C style escape sequences in strings. Previously sequences like \n and \\ where decoded. Instead use the appropriate XML encodings as required.

New Features

New CLI build

A new log4net assembly is built that targets all CLI 1.0 compatible runtimes. This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds. It is built using the MS .NET 1.0 compiler and libraries but does not use any platform specific APIs.

This build is only available in release configuration and can be found at bin\cli\1.0\release.

Logging contexts

Logging contexts can be used to record contextual data that is relevant to the current process. Logging contexts are both an extension of the concepts embodied in the MDC and NDC and a replacement for them. The MDC and NDC have been reimplemented to use the ThreadContext as storage.

The logging contexts provide a single unified view that cuts across different scopes within an application. The contexts are layered in the following order of narrowing scope: GlobalContext, ThreadContext, LogicalThreadContext, and LoggingEvent. Context values specified in a narrower scope hide the matching value in a wider scope.

PatternLayout customization and long pattern names

The PatternLayout now supports long pattern names. These pattern names are significantly more readable than the single character patterns.

The PatternLayout now supports custom patterns. New patterns can be defined in the config file:

              <layout type="log4net.Layout.PatternLayout">

              <name value="myConverter" />
              <type value="TestApp.MyPatternConverter, TestApp" />

              <conversionPattern value="%-5level %logger - %myConverter - %message%newline" />

The above config defines a custom pattern called myConverter which is bound to the TestApp.MyPatternConverter, TestApp type. This type must extend the log4net.Util.PatternConverter base class. The custom pattern can then be used in the pattern string.

PatternString for pattern based configuration

A new pattern based type, PatternString, can be used in the config file to set string properties using a pattern syntax. For example the File property of the FileAppender could be set as follows:

              <file type="log4net.Util.PatternString">

              <name value="folder" />
              <type value="TestApp.SpecialFolderPatternConverter,TestApp" />

              <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" />

The code for the SpecialFolderPatternConverter is as follows:

              public class SpecialFolderPatternConverter : log4net.Util.PatternConverter
              override protected void Convert(System.IO.TextWriter writer, object state)
              Environment.SpecialFolder specialFolder =
              (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true);


Loading configuration from a URI

The XmlConfigurator methods now support loading the configuration data from a URI. Config can be loaded from any URI supported by the System.Net.WebRequest class.

Support for No-Touch deployment

Log4net supports configuring No-Touch deployment applications using the XmlConfiguratorAttribute. If a relative config file or extension is specified then this is resolved relative to the deployment URI.

Config file parser enhancements

The config file parser has been enhanced to support specifying the property subtype, or intermediate type, directly on the property element, for example:

              <layout type="log4net.Layout.PatternLayout" value="%message%newline"

Implicit conversion will be attempted between the value string and the type specified, and then again between the type and the target property type.

.NET string formatting syntax

Added .NET String.Format style formatting syntax methods to the ILog interface. The new methods are: DebugFormat, InfoFormat, WarnFormat, ErrorFormat and FatalFormat.

Customizable levels

Levels are defined by the repository LevelMap. The defined levels, the relative ordering of levels and level display names can be configured on a per-repository basis.

Per-appender security contexts

Appenders that interact with controlled platform resources, e.g. files, can be configured to use a separate security context when accessing these resources. The calling thread may not have appropriate privileges to access the resource a custom SecurityContext can be used to elevate the privileges of the appender. The WindowsSecurityContext is used to specify alternative credentials on the Windows platform.

Added new appenders


The AnsiColorTerminalAppender writes events to the application's ANSI terminal window. It can be configured to specify the text and background colors for different level events. Note that Console applications running on Windows do not have an ANSI terminal window and should use the ColoredConsoleAppender instead.


Logs events to a local syslog service. This appender uses the POSIX libc syslog library functions. If these functions are not available on the local system then this appender will not work!


The RemoteSyslogAppender uses the BSD syslog protocol to log to a syslog daemon. The syslogd listens for for messages on UDP port 514.


The TelnetAppender accepts socket connections and streams logging messages back to the client. The output is provided in a telnet-friendly way so that a log can be monitored over a TCP/IP socket. This allows simple remote monitoring of application logging.

Added new LoggerMatchFilter filter

Added LoggerMatchFilter which matches a string against the event's logger name.

Pluggable file locking models for the FileAppender

The FileAppender (and by extension the RollingFileAppender) now support pluggable file locking models. The default model, ExclusiveLock, maintains the current exclusive file locking behavior. An alternative model, MinimalLock, can be used to support writing to a single output file from multiple processes.

RollingFileAppender roll once

The RollingFileAppender now supports a new rolling style, Once. In this mode the appender will roll the file once per run.

SmtpAppender authentication

On the .NET 1.1 platform only, the SmtpAppender supports authenticating against the mail server using either username and password or integrated NTLM authentication.

AdoNetAppender ReconnectOnError

Added new configuration property to AdoNetAppender. Setting ReconnectOnError to true will force the appender to attempt to reconnect to the database if the connection is lost.

UdpAppender hostname support

The UdpAppender config property RemoteAddress can now be specified as a DNS hostname string. The hostname is resolved to an IP address.

Other Changes

FxCop compliance

Updates to bring the internal code in line with the current FxCop rules.

Separate NUnit tests

Moved the NUnit tests into a separate project, log4net.Tests.

Bug Fixes


Sends events from a ThreadPool thread rather than the calling thread to prevent transfer, and potential loss, of the CallContext.


Fixed date rolling period detection for non UTC timezones.


Updated to support writing more than 30,000 chars in a single message. Fixed background color overspill if the console window needs to scroll the contents.


Changed assembly name to log4net

The build output is now log4net.dll for all frameworks. This is a breaking change.

To resolve cross platform and cross version issues we have changed the log4net assembly to use a common name for all frameworks. The assembly friendly name is now log4net. The builds for each framework can now be differentiated by the assembly title. This includes the name of the framework that the assembly was built on.

Combined Release and ReleaseStrong builds

The Release and ReleaseStrong builds have been consolidated into a single build called Release. This Release build is strongly named.

New Appender: ColoredConsoleAppender

The ColoredConsoleAppender writes events to the application's console. It can be configured to specify the text and background colors for different level events.

New Appender: SmtpPickupDirAppender

The SmtpPickupDirAppender generates SMTP compliant messages and writes them to a local directory. These files can then be read by an SMTP agent (e.g. the IIS SMTP Agent) and delivered.

New Layout: XmlLayoutSchemaLog4j

This new layout formats the logging events as XML which complies with the Apache log4j™ event dtd. This can be used to transfer log event from log4net to log4j. Currently the only appender that can communicate directly with log4j is the UdpAppender.

New PatternLayout conversion characters

Added support for capturing the current thread principal name and the app domain friendly name for each logging event.

Used to output the friendly name of the AppDomain where the logging event was generated.
Used to output the user name for the currently active user (Principal.Identity.Name).

Types specified in the config file are now loaded ignoring case

All types specified in the configuration files are now loaded using a case insensitive method.

Fine grained fixing for buffered events

The LoggingEvent now supports fine grained fixing of data that needs to be accessed outside the append context, e.g. when an event is buffered. The new Fix property takes a combination of the FixFlags enumeration values.

Code updated inline with FxCop 1.21

In line with the FxCop 1.21 guidelines: Sealed utility classes. Added serialization security demand to GetObjectData. Renamed parameters.

EventLogAppender 32K Limit

There is a limit of 32K characters in an EventLog message. Added a check that only logs the first 32000 characters from the rendered message.

Updated to support the Microsoft .NET Framework 1.1 Final

Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).

Features document

Added a new document that covers the main features of log4net. See the features document for more information.

Hierarchy disabled until it is configured

The Hierarchy is now disabled until it has been configured. All messages logged to the Hierarchy before it has been configured will be ignored without an error message being written to the console.

If you are configuring log4net programmatically (i.e. not using one of the built-in configurators) you must set the ILoggerRepository.Configured property to true once you have configured the repository.

The no appenders defined for a logger message will no longer be displayed on the console by default. This message will only be displayed if internal debugging is enabled.

New examples in VisualBasic.NET, JScript and Managed C++

New examples in VisualBasic.NET, JScript and Managed C++. TODO Link to document about examples.

Code and Documentation Updates

Code fixes. Documentation and manual updates. See the ChangeLog for more information.

Added document with example appender configurations

See the Example Appender Configuration document for more information.

Added support for multiple frameworks

log4net 1.2.0 beta 6 adds support for the the following frameworks:

Framework Website
Microsoft .NET Framework 1.1 Final Beta (1.1.4322) http://msdn.microsoft.com/net
Microsoft .NET Compact Framework 1.0 (1.0.5000) http://msdn.microsoft.com/vstudio/device/compactfx.asp
Mono 0.23 http://www.go-mono.org
Microsoft Shared Source CLI 1.0 http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp

Not all frameworks are created equal and some features have been excluded from some of the builds. See the Framework Support document for more information.

New build system using NAnt

The new build system allows log4net to be built for all supported frameworks and in all build configurations in one go.

New source code & distribution layout

The source code & distribution layout has been updated to support the new build environment and multiple target frameworks.

Removed DomainAttribute.UseDefaultDomain property

Updated default behavior of DefaultRepositorySelector. Assemblies are now by default placed into the default domain. To specify another domain, the DomainAttribute must be used. This is the opposite behavior to what was previously available. If you were previously specifying the DomainAttribute.UseDefaultDomain property then you should remove it, and if the default behavior is now sufficient, you do not need to specify the DomainAttribute at all.

Updated configuration file parser

Updated config file parser to use the element name as the property to set. Also removed <object> tag, the type attribute can now be specified on the property element directly.

For example:

            <param name="Evaluator">
            <object type="log4net.spi.LevelEvaluator">
            <param type="log4net.spi.Level" value="DEBUG"/>


            <evaluator type="log4net.spi.LevelEvaluator">
            <threshold value="DEBUG"/>

Support for event ID

The EventLogAppender now supports setting the event ID in the event log, this is taken from the EventID property from the per event Properties map on the LoggingEvent.

Updated ADONetAppender

  • Added support for prepared statements and stored procedures
  • Added RawTimeStampLayoutto correctly convert the timestamps into database date time format
  • Added ExceptionLayout to render the exception data

Support for front-end extension

This allows the logging API to be wrapped or adapted for specific purposes. Two extension samples are included in the distribution:

Extension Description
log4net.Ext.Trace Adds trace logging methods
log4net.Ext.EventID Adds additional eventId parameter to all methods

Added ForwardingAppender

Forwards events to multiple sub appenders after applying filter rules.

Added BufferingForwardingAppender

Forward events to sub appenders after buffering them.

Added ASPNetTraceAppender

Logs events to the ASP.NET trace system.

Added NetSendAppender

Delivers logging events using the Windows Messenger service.

Added UdpAppender

Sends logging events as connectionless UDP datagrams to a remote host or a multicast group.

Removed obsolete methods

Lots of updates to improve our compliance with FxCop

Improved SDK documentation

Fixed Exception thrown when DOM Configurator called with a null XML Element.

This occurred if the configuration file did not have a log4net section defined.

Made level lookup case insensitive

Prevented the Hierarchy's Threshold level from being set to a null reference

Added event specific properties to the logging event object

Appenders can add additional information to the events they are logging. The RemotingAppender and the SMTPAppender both add a 'hostname' property to the events. These properties can be accessed using the PatternLayout with the %P{name} syntax.

Added a plugin framework

An IPlugin interface can be attached to any repository.

A new RemoteLoggingServerPlugin plugin acts as the server for the RemotingAppender

Updated the core log4net framework to work in an environment with no permissions

Specific appenders still require additional permissions to log correctly

Added support for domain aliasing using the AliasDomainAttribute

This allows a parent assembly to take control of the logging domain for child assemblies.

Added events for repository creation, configuration change, configuration reset and repository shutdown

Added LevelMap to the ILoggerRepository interface

The mapping from level name to level object is now repository specific, therefore each repository can have independent mappings.

Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class

This is controlled by the Hierarchy object and allows for better encapsulation.

Added OnlyFixPartialEventData property to the buffered appenders

This setting causes slow settings to be ignored. This significantly improves the performance of the buffered appenders.

XML entity references are supported in the XML config file.

Added support for expanding environment variables in <param> values

The environment variables must be specified as ${FOO} where FOO is the name of the variable to expand.

Upgraded to use NUnit 2.0

File appenders can specify the encoding to use for the file

Added strong named configuration

Added log4net.Ext.Trace extension

This is a separate assembly that adds a trace level to log4net.

The default log file output directory is now the application base directory not the current directory

Added MemoryAppender

Stores all the logging events in an in-memory buffer.

Moved the Hierarchy implementation into a separate namespace

The log4net.Repository.Hierarchy namespace now contains all the code that is specific to the Hierarchy implementation.

Refactored the DOMConfigurator and BasicConfigurator

The Hierarchy specific data schema and implementation could be has now been moved to the log4net.Repository.Hierarchy namespace. The bootstrap code for these configurators remains in the log4net.Config namespace.

Replaced the DOMConfiguratorAttribute UseExecutableDomain property with UseDefaultDomain

This change to the implementation of the DOMConfiguratorAttribute should allow the configuration of multiple assemblies to be accomplished more easily, especially when developing web applications (ASP.NET).

A few good bug fixes!

Added ADONetAppender

Thanks to TechnologyOneCorp.com.

Added TraceLogAssembly extensibility example

Lots of bug fixes

Added 6 new examples

Split Category class into Logger and LogManager classes

The instance methods from Category have moved to the Logger class. The static methods from Category have moved to the LogManager class. The Category class still exists but for backward compatibility only. Changed interface ICategoryFactory to ILoggerFactory and the implementation class DefaultCategoryFactory to DefaultLoggerFactory .

Replaced Priority class with Level class

The Priority class has been replaced by the Level class. The Priority class still exists for backward compatibility only. The Level class implements a static pool of Level objects. The Level class is sealed and serializable.

Added ILoggerRepository interface implemented by Hierarchy

The Hierarchy class implements the ILoggerRepository interface. This interface is used by the LogManager class and therefore allows different implementations of ILoggerRepository to be used.

Enhanced NUnit tests

All the NUnit tests can be run using a single TestSuite: NUnitGUI log4net.LogManager+AllTests,log4net.dll.

Added support for serializing LoggingEvents

The LoggingEvent class is serializable. All local state is captured before serialization occurs. This now allows LoggingEvent objects to be serialized between applications or machines.

Added RemotingAppender

Delivers LoggingEvents to a remote interface. This can be used to collect distributed logging into a single log file. There is an example remoting sink that receives the logging events, see examples\net\remoting\RemotingServer for details.

Added support for rendering composite objects

The IObjectRenderer interface method DoRender now takes a RendererMap argument. This allows the renderer to use the appropriate renderer from the RendererMap to render any nested objects.

Added support for rendering exceptions

The DefaultRenderer now has support for rendering exceptions to a string. This includes nested exceptions. The RendererMap is now used to render exceptions in the LoggingEvent. This allows the rendering of specific exceptions to be enhanced by specific renderers.

Added ITriggeringEventEvaluator interface

This interface is used by SMTPAppender and RemotingAppender to determine if a LoggingEvent meets a set of user defined criteria. These appenders use the interface to determine whether or not to deliver the current buffer of events to their listener. The interface is implemented by the LevelEvaluator class, which triggers above a set level.

Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter

The MDCFilter, NDCFilter and StringMatchFilter can now be configured to use regex matches in addition to substring matches. Set the RegexToMatch property to use this feature.

Added XMLLayout

emits an XML element for each LoggingEvent. This allows logging events to be stored and manipulated as XML. The DTD for the XML emitted is in the log4net-events.dtd

Added support for <logger> and <level> elements in the DOMConfigurator

As the Category and Priority classes have been replaced by the Logger and Level classes. The DOMConfigurator has been updated to allow the <logger> and <level> elements to be used in place of the <category> and <priority> elements. The old elements are still accepted for backward compatibility.

Added Threshold property to Hierarchy

Changed DisableXXX() methods on Hierarchy to a Threshold property.

Added support for logging domains

The LogManager supports multiple logging domains. The LogManager uses an instance of the IRepositorySelector class to map from domains to ILoggerRepository instances. The default implementation is to have a separate ILoggerRepository for each domain. When a call is made to the static methods on LogManager the domain can be specified (as a string) or the domain can be inferred automatically from the calling assembly. The default behavior is for each assembly loaded into the process to have its own domain and ILoggerRepository. These can each be configured separately. This allows standalone assemblies to use log4net without conflicting with other modules in the process. The domain for the assembly is configured using metadata attributes defined on the assembly.

DOMConfigurator can set params to arbitrary objects

Using a new <object> element, params can now be set to any creatable object.