Apache log4net™ Release Notes
2.0.11
Apachhe 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 @NicholasNoise2.0.10
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
2.0.9
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
2.0.8
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
2.0.7
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
2.0.6
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-508] - NAnt release build is not optimized
- [LOG4NET-512] - Thread safety issue in Hierarchy.cs
- [LOG4NET-527] - broken link on config-examples.html
- [LOG4NET-529] - Possible thread-safety bug in LoggingEvent
- [LOG4NET-536] - Can't build for NETCF-2.0
Improvements
- [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
1.2.15
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
1.2.14
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
Improvements
- [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
1.2.13
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
Improvements
- [LOG4NET-394] - Lambda-based ILog-Extensions should catch errors
1.2.12
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 1.2.10.0
- [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
Improvements
- [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
1.2.11
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.
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
Improvements
- [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
1.2.10
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] - 1.2.9.0 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
Improvements
- [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.
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"> <converter> <name value="myConverter" /> <type value="TestApp.MyPatternConverter, TestApp" /> </converter> <conversionPattern value="%-5level %logger - %myConverter - %message%newline" /> </layout>
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.
For full details see the SDK Reference entry: log4net.Layout.PatternLayout.
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"> <converter> <name value="folder" /> <type value="TestApp.SpecialFolderPatternConverter,TestApp" /> </converter> <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" /> </file>
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); writer.Write(Environment.GetFolderPath(specialFolder)); } }
For full details see the SDK Reference entry: log4net.Util.PatternString.
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
- AnsiColorTerminalAppender
-
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.
- LocalSyslogAppender
-
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!
- RemoteSyslogAppender
-
The RemoteSyslogAppender uses the BSD syslog protocol to log to a syslog daemon. The syslogd listens for for messages on UDP port 514.
- TelnetAppender
-
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.
For full details see the SDK Reference entry: log4net.Appender.FileAppender.LockingModel.
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.
Other Changes
Bug Fixes
- RemotingAppender
-
Sends events from a ThreadPool thread rather than the calling thread to prevent transfer, and potential loss, of the CallContext.
- RollingFileAppender
-
Fixed date rolling period detection for non UTC timezones.
- ColoredConsoleAppender
-
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.
1.2.0 Beta 8
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.
- %a
- Used to output the friendly name of the AppDomain where the logging event was generated.
- %u
- 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.
1.2.0 Beta 7
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.
1.2.0 Beta 6
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:
<appender> <param name="Evaluator"> <object type="log4net.spi.LevelEvaluator"> <constructor> <param type="log4net.spi.Level" value="DEBUG"/> </constructor> </object> </param> </appender>
becomes:
<appender> <evaluator type="log4net.spi.LevelEvaluator"> <threshold value="DEBUG"/> </evaluator> </appender>
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 |
1.2.0 Beta 5
1.2.0 Beta 4
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.
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.
1.2.0 Beta 3
The default log file output directory is now the application base directory not the current directory
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.
1.2.0 Beta 1
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.