Last updated: 2006-09-18

This website is based on NLog v20060918. Click here to view the documentation for other versions.

Release Notes

2006-09-18NLog 1.0 has been released.!

After 2 years of work, we're proud to announce the availability of NLog 1.0. NLog is a logging library designed with simplicity and flexibility in mind. See http://www.nlog-project.org for more information about NLog.

Source, binary packages and installer packages are available for download from: http://www.nlog-project.org/download.html

Tutorial and reference documentation are available at: http://www.nlog-project.org/documentation.html

The following people have contributed to NLog by submitting code or bug reports:

  • Jaroslaw Kowalski <jaak at jkowalski dot net>
  • Marcin Krupinski <yoszek at gmail dot com>
  • Inez Korczynski <korczynski at gmail dot com>
  • Rafal Gwizdala <gwrafal at poczta dot onet dot pl>
  • Yuri Mamrukov <yvm at att dot net>
  • Maciej Figatowski <mfigatow at sav dot net>
  • Perry Rapp <lifelines_3_0_18 at hotmail dot com>
  • Maarten Claes <m.claes at farcourier dot com>

The focus of this relase is future compatibility. Code has been added to ensure that the development of NLog will progress without breaking existing code. The following paragraphs describe changes that made after 1.0 RC1 release.

Breaking API changes:

  • Added NLog.ILayout which Layout implements to allow other layout types (such as CSV-escaped, HTML-colored, XML-escaped, ANSI-colored) to be implemented.
  • NLog.Layout became sealed.
  • FileTarget.KeepFileOpen is back to the default of false. we now have <default-target-parameters /> so this default can be easily overriden.
  • Added NLog.TargetWithLayout, removed Layout and CompiledLayout from NLog.Target
  • Removed CSVFile target, converted examples to File + CsvLayout
  • Removed LogEventInfo.Empty and replaced with LogEventInfo.CreateNullEvent()
  • Changed the default value of FileTarget.OpenFileCacheTimeout to -1

Packaging changes:

  • Added publisher policy generation and established NLog versioning policy. See http://blog.jkowalski.net/?p=55 for more information about NLog versioning policy.
  • Build number is synchronized with SVN number.
  • Added VJSharp and Web item templates. Updated the installer to support VWD Express 2005.
  • Synchronized Visual Studio solutions to source code directories. Now part of the build process.
  • New NLog.Benchmark that uses code generation and compilation to create more "clean" environment.

Changes to the logging infrastructure:

  • Added <targets><default-target-parametes /></targets> that specifies default values for all targets in the section
  • Added Initialize() and Close() to the LayoutRender class
  • Added optimized CurrentTimeGetter which is way faster than DateTime.Now
  • Fixed LayoutRenderer.ApplyPadding() null handling
  • Added infrastructure to create your own logger types inheriting from Logger:
    
    
    LogManager.GetLogger(string name, Type type) 
    LogManager.GetCurrentClassLogger(Type type) 
    LogFactory.GetLogger(string name, Type type) 
    LogFactory.GetCurrentClassLogger(Type type)
  • Added PopulateLayouts() method to ILayout
  • Added ${event-context} layout renderer that extracts information from LogEventInfo.Context
  • Added LogManager<LoggerType> that manages logger instances of LoggerType where LoggerType : Logger
  • Added support for nested layout renderers. Used in ${file-contents}:
    
    
    ${file-contents:fileName=${basedir}/aaa.txt}
  • Added support for DEFAULT nested layout parameters. You can now write:
    
    
    ${file-contents:${basedir}/file.txt} 
    ${rot13:URYYB}
  • Added pluggable layouts (CSV, Log4JXml), LayoutFactory and LayoutAttribute. The syntax is:
    <target xsi:type="File"> 
      <layout xsi:type="CSVLayout"> 
        <column name="message" layout="${message}"/> 
        <column name="level" layout="${level}"/> 
      </layout> 
    </target> 
    

    Of course the old syntax is still supported for simple layouts:

    <target xsi:type="File" layout="${message}"/> 
    
  • Added ILayoutWithHeaderAndFooter for layouts that support header/footer (such as CSV Layout, more to come)
  • Enhanced XSD Schema generation by properly generating abstract and layout properties.
  • Added FilterResult.IgnoreFinal and FilterResult.LogFinala which suppress processing of further rules if the filter matches.
  • Added NLogConfigurationException which is thrown instead of CLR exceptions when the configuration fails
  • Simplified XmlLoggingConfiguration by splitting large methods and moving common functionality to PropertyHelper
  • Added [DefaultParameter] attribute which allows for nameless parameters to layout renderers:
    ${aspnet-application} 
    ${aspnet-request} 
    ${aspnet-session} 
    ${date} 
    ${environment} 
    ${file-contents} 
    ${gdc} 
    ${mdc} 
    ${process-info} 
    ${special-folder} 
    ${asp-application} 
    ${asp-request} 
    ${asp-session} 
    
  • Moved the implementation of LogManager to a reusable LogFactory while maintaining its public interface. You can now easily have a private LogManager for an assembly.

New additions:

  • Added MaxMessageSize (default: 65000) and OnOverflow (default:Split) to the Network target
  • Implemented headers and footers for the File target. CAUTION NLog automatically writes footers for files that have not been written for 2 days (48 hours). This is done do conserve memory for long-running processes that create lots of log files.
  • Enabled DatabaseTarget.ConnectionString to include layouts.
  • Added eventID and categoryID parameters to EventLog targets.
  • Added ${file-contents} layout renderer which inserts file contents.
  • Added MailTarget.AddNewLines to insert new lines between header/lines/footer
  • Added FormControl target that logs to Text property of any Windows.Forms.Control
  • Added RichTextBox target with row- and word coloring that logs to RichTextBox
  • Added ${tempdir} and ${specialfolder}
  • Added ${gc} which can be used to get the GC statistics (very limited)
  • Added ${processinfo} which can be used to extract the performance information about the current process (possibly others in the future as well)
  • Added ImpersonatingWrapper which temporarily changes the credentials for the duration of the write.
  • Added NLog_Init() and NLog_InitLocal() APIs to NLogC

Bug fixes:

  • Fixed File target for Windows 98
  • Fixed Network target to work properly with IPV6
  • Changed RichTextBox Target to be thread safe. Uses delegate to log to RichTextBox

Documentation updates:

  • Added examples of inheriting from Logger class and wrapping it
  • Added missing code documentation
  • Added example ${rot13} layout renderer - that demonstrates how wrapper layout renderers can be written.
  • Added proper camelCasing to the web build process
  • Fix for multiple email addresses being passed in To,CC and BCC fields under .NET 2.0 (reported by Pawel Parzychowski)
2006-06-27

NLog 1.0 Release Candidate 1 is available!

After 2 years of work, we're proud to announce the availability of NLog 1.0 Release Candidate 1.

Packaging changes:

  • Separate compilation of NLog for all supported frameworks. Starting with NLog v1.0 there will be releases for each supported platform (currently 7!), both debug and release.
  • Merged NLog.Win32.dll, NLog.DotNet.dll, NLog.Unix.dll and NLog.Mono.dll into one assembly NLog.dll
  • Added generation of NLog.xsd schema for Visual Studio Intellisense.
  • Prepared ready-to-run example projects for VS2005 that describe most targets.
  • Compilation, schema generation a and website building are supported on Linux/Mono. All unit tests pass.
  • Added support for VC#Express and VBExpress to the installer.
  • Added VS2005 C# and VB.NET code snippet (nlogger) to quickly insert logger creation statement
  • Added VS2005 item templates for NLog configuration. NLog now looks for "NLog.config" in addition to other config file names.

Changes to the logging infrastructure:

  • BREAKING CHANGE - Completely restructured the way File target works. The new structure is based on Streams instead of StreamWriters and enables archiving (kind of similar to "rolling file appender" from log4net world, but supporting multiple files at a time!). It also speeds up things a lot.
  • Refactored file watching - should speed up non-logging by 100%
  • BREAKING CHANGE - removed some properties which accepted strings. Replaced with enums for type safety.
  • Added attributes which mark support for particular runtimes and OSes. They are used for generating documentation and disabling particular targets/layout renderers at runtime.
  • Optimization to defer calling String.Format() until it's really needed.
  • Added LayoutRenderer.IsAppDomainFixed() and an optimization to turn such things into literals. So if you use "${basedir}/log.txt" this gets converted into a literal which takes no time to recalculate.
  • Added LoggingConfiguration.GetConfiguredNamedTargets() API
  • Added Layout.Escape() which escapes ${ with ${literal:text=${}
  • Added Logger.Log(LogEventInfo) overload
  • Added Logger.Log(Type,LogEventInfo) overload - useful for wrapping NLog.Logger
  • Added LoggerReconfiguredDelegate and Logger.LoggerReconfigured events
  • Added InternalLogger.LogToConsoleError and their config file and environment variable counterparts to send log output to Console.Error.
  • Added support for flags-type enumerations.
  • Added <include file="..." ignoreErrors="true|false" />
  • Fixed autoReload to keep monitoring the file if the reloaded file has an error
  • Added <default-wrapper /> that wraps all targets in <targets /> section with the specified wrapper. The usage is:
    <targets> 
      <default-wrapper type="AsyncWrapper"/> 
      <target name="f" type="File"/> 
      <target name="n" type="Network"/> 
    </targets> 
    
    This creates "f" which is actually a AsyncWrapper(File) and "n" which is AsyncWrapper(Network). Note that the original target names are renamed as "f_wrapped" and "n_wrapped" respectively.

New additions:

  • Implemented AsyncWrapper for .NET CF using the Timer class
  • Added WebService target supporting SOAP 1.1, SOAP 1.2, HTTP GET and HTTP POST web service calls.
  • Added CSVFile target which does proper CSV (comma-separated values) formatting (multi-line and special character quoting). This enables you to analyze your log files in MS Excel.
  • Added caching to File target to optimize the number file open/close operations.
  • Added an option for multiple processes to append to the same OPEN file in a synchronized manner. Unixes get this for free, but Win32 requires you to use mutexes to synchronize file access. This gives a nice performance boost.
  • Added deleteOldFileOnStartup to the File target
  • Added replaceFileContentsOnEachWrite to the File target
  • Added FileTarget.LineEnding
2006-02-20

NLog 0.95 has been released!

Major changes:

  • Added new Trace level, more verbose than the Debug level.
  • Added a new conditions language which lets you write powerful filtering conditions while keeping the syntax natural and readable
  • BREAKING CHANGE: Renamed Target.Append() method to Target.Write()
  • Added Target.Write(LogEvent[] manyEvents) for cases where the target can optimize group writes
  • Added global log threshold and configurability at the config level (<nlog globalThreshold="..." />)
  • Added support for <variable name="" value="" /> configuration element. Details are here.
  • Added infrastructure for compound targets and wrapper targets.
  • Added detailed documentation with examples for many targets, both on the website and in the help file

Bugs fixed:

  • Fixed the filter configuration bug as reported by Ron Grabowski
  • Fixed a serious reentrancy bug which caused all sorts of problems when formatted message included a parameter where ToString did the logging itself. More details here.
  • Fixed a nullref exception when no config file was present.
  • Fixed support for CC field in the Mail target
  • Fixed Close() behaviour for unnamed targets (like the ones configured by SimpleConfigurator)
  • Typos in the code prevented Chainsaw target from working properly.
  • ${callsite} not working with database parameters
  • ${callsite} doesn't work with MethodCall target and NLogViewer target
  • Connection string builder omits ; after Server parameter
  • Fixed the Trace target in Release mode by defining TRACE symbol
  • Fixed VS.NET Compact Framework project file
  • Fixed the Trace target in Release mode by defining TRACE symbol
  • Fixed bugs related to ${asp-request:cookie} and ${aspnet-request:cookie}
  • Fixes for case-insensitive parsing of the config files.
  • fixed CompactFramework build

New additions:

  • Added <when condition="..." action="..." /> filter which uses condition expressions
  • Added ${aspnet-sessionid} to access (guess!) ASP.NET session ID
  • Added ${processname}, ${processid} layout renderers
  • Added ASPNetBufferingWrapper target which buffers and post-processes the entire ASP.NET request (requires you to use the NLogHttpModule)
  • Added PostFilteringWrapper target which is able to filter log events based on a buffer as a whole. Details are here.
  • Added GDC (Global Diagnostics Context) and ${gdc} layout renderer which is a global (as opposed to per-thread) version of MDC and ${mdc}
  • Added authentication options to the Mail target (thanks Ron).
  • Added support for caching layout results per logEvent which makes them transportable across threads
  • Added ${log4jxmlevent} which renders log4j-compatible XML event
  • Added wrapper targets: AsyncWrapper, AutoFlushWrapper, BufferingWrapper, RepeatingWrapper, RetryingWrapper
  • Added compound targets (fallback, randomize, roundrobin, split)
  • Added ${windows-identity} layout renderer.
  • Added MSMQ target (Message Queue)
  • Added EventLog target
  • Added ${pc} - Performance Counter layout renderer
  • Added SimpleConfigurator.ConfigureForTargetLogging() and SimpleConfigurator.ConfigureForFileLogging()
  • Added Debugger target
  • Added ${logger:shortname=true} option.
  • Added ${stacktrace} layout renderer, 3 different logging formats. Details are here.
  • Added ${newline} layout renderer.
  • Added IgnoreCase option to filters

Other changes:

  • Project web site has been moved to http://www.nlog-project.org/
  • Patch by Yuri Mamrukov to simplify InternalLogger configuration from environment variables and/or App.config settings. Fixes some nasty bug there. More details are available here.
  • Excluded NLogViewer from build and project. It will become be a separate project here.
  • Added batch NLogC compilation, added installer and nlogc binary snapshot.
  • Added some minimal VB.NET test code
  • Added some meaningful error message when a named target is not defined.
  • Added many unit tests
2005-06-09

NLog 0.9 has been released!

Major changes:

  1. API redesign/rename.
  2. "Appender" has been renamed as "Target" and "LayoutAppender" as "LayoutRenderer". This should make it easier for people to understand the basic concepts ("layout appender" wasn't a good idea). Old configuration file format is still supported. Old extension code should require nothing more than a search/replace and a recompile.

  3. Improved logging and non-logging speed by removing most abstraction from the Logger class.
  4. A single non-logging operation takes only 7 nanoseconds which means 140.000.000 logs/second). Logging API should remain the same.

  5. Changed the way the configuration file is parsed. Now elements are processed top-down and you can change the order of the sections as well as the elements you reference have been processed before.

Bugs fixed:

  1. Fixed an old bug where appenders were incorrectly combined into a chain.

New additions:

  1. Network target (capable of sending messages over TCP and UDP, HTTP to be supported)
  2. Preliminary NLogViewer target and a sketchy, but already usable viewer application. "Chainsaw" target should probably be added as well.
  3. Added LogManager.GlobalThreshold
  4. API documentation, target, layout renderer and filter documentation is generated from source code comments using NDoc.
  5. 100% of public methods are commented in the source code.
  6. Reworked the tutorial and howtos
  7. Reworked the website.

Last updated: 2006-09-18 14:32:45

Webwww.nlog-project.org