Skip to content

Releases: serilog/serilog

v4.2.0

06 Dec 04:13
0e316b7
Compare
Choose a tag to compare

What's Changed

  • #2141 β€” stabilize and fully implement dotted identifiers in message templates (@nblumhardt)
  • #2028 β€” use RuntimeHelpers.GetHashCode() in message template cache comparer (@sungam3r)
  • #2138 β€” update to .NET 9 SDK, GitHub Actions build, net9.0 TFM (@nblumhardt)
  • #2132 β€” support capturing of multidimensional arrays (@sungam3r, @WAcry)
  • #2136 β€” fix documentation for ILogEventSink (@erichiller)

New Contributors

Full Changelog: v4.1.0...v4.2.0

v4.1.0

22 Oct 03:34
467cfd8
Compare
Choose a tag to compare

Important note

IBatchedLogEventSink batch retry scheduling has changed in this version. The default configuration still tries failed batches for approximately ten minutes, but the BufferingTimeLimit no longer implicitly causes the retry time to be extended or reduced. If you need a specific retry time, set BatchingOptions.RetryTimeLimit, which reliably controls retry time.

v4.0.2

28 Sep 21:25
4c9a312
Compare
Choose a tag to compare
  • #2094 - remove boxing and string allocations in output template formatting (@epeshk)
  • #2103 - don't capture properties with private get accessors (@nblumhardt)
  • #2095 - remove junk file (@Numpsy)
  • #2116 - fall back to IDisposable in Log.CloseAndFlushAsync() when the target logger is not IAsyncDisposable (@nblumhardt)

v4.0.1

25 Jul 02:52
0664815
Compare
Choose a tag to compare
  • #2090 β€” when capturing structured values, reuse HashSet instances, reduce LINQ usage, avoid reallocating string[] to improve performance and cut GC pressure (@nblumhardt)
  • #2089 - allow capturing of non-anonymous structured values when trimming (@nblumhardt)
  • #2083 - use Major.Minor.0.0 assembly versioning (@nblumhardt)

v4.0.0

01 Jun 06:21
573a628
Compare
Choose a tag to compare

What's new in Serilog 4.0.0?

If you're deploying to .NET Framework, note that Serilog's assembly version number has been unpinned from the long-running historical 2.0.0 default, and now matches the package version precisely. If you encounter issues, ensure your build is generating valid assembly binding redirects.

Simple, robust, built-in batching support

Sinks that need batching functionality can now be easily written, without any additional package dependencies, by implementing IBatchedLogEventSink:

class MyBatchedSink: IBatchedLogEventSink
{
    public Task EmitBatchAsync(IReadOnlyCollection<LogEvent> batch)
    {
        // Send a batch of log events...
    }
}

Batched sinks can be added using WriteTo.Sink(IBatchedLogEventSink, ...) - they're given first-class consideration just like regular un-batched sinks.

The built-in batching implementation is based on System.Threading.Channels and draws on the original Serilog.Sinks.PeriodicBatching package (now in maintenance-mode), to provide a full-featured, efficient, async-native batching implementation.

Experimental dotted name capturing

By setting an experimental AppContext switch, message templates can be used to capture dotted names, which are required when using some logging schemas.

AppContext.SetSwitch("Serilog.Parsing.MessageTemplateParser.AcceptDottedPropertyNames", true);

Log.Information("Running as {user.name}", Environment.UserName);
// Captures {"user.name": "nblumhardt"}

While currently experimental and unsupported, this flag is intended to help the ecosystem evaluate and prepare for dotted name support in a future Serilog release.

Changes

v3.1.1

10 Nov 12:43
999d686
Compare
Choose a tag to compare
  • #1977 - don't stack overflow when disposing ReusableStringWriter with large renderings (@nblumhardt)

This is a bugfix for release 3.1.0.

v3.1.0

09 Nov 06:15
765a046
Compare
Choose a tag to compare

Built-in trace and span id support

This release adds two new first-class properties to LogEvent: TraceId and SpanId. These are set automatically in Logger.Write() to the corresponding property values from System.Diagnostics.Activity.Current.

The major benefit of this change is that sinks, once updated, can reliably propagate trace and span ids through to back-ends that support them (in much the same way that first-class timestamps, messages, levels, and exceptions are used today).

The sinks maintained under serilog/serilog, along with formatting helpers such as Serilog.Formatting.Compact and Serilog.Expressions, are already compatible with this change or have pending releases that add compatibility.

Dropped .NET Core 2.1 and 3.0 support

On .NET Core 2.1 and 3.0, projects targeting Serilog 3.1+ will fail to build, with:

/project/packages/system.runtime.compilerservices.unsafe/6.0.0/buildTransitive/netcoreapp2.0
/System.Runtime.CompilerServices.Unsafe.targets(4,5): error : System.Runtime.CompilerServices.Unsafe
doesn't support netcoreapp2.1. Consider updating your TargetFramework to netcoreapp3.1 or later.

Affected consumers should continue to use Serilog 3.0 or earlier. See #1983 for a discussion of this issue.

Technical breaking changes

Trace and span id placeholders

Trace and span id collection includes support for {TraceId} and {SpanId} placeholders in output templates (commonly used when formatting text log files). Where previously these names resolved to user-defined properties, they now resolve to the built-in LogEvent.TraceId and LogEvent.SpanId values, respectively.

Impact is expected to be low/zero, because the trace and span id values in any user-added properties are almost certainly identical to the built-in ones.

nint and nuint (IntPtr and UIntPtr) handling

These integer types were previously logged as structures. They're now correctly logged as scalars.

v3.0.1

21 Jun 21:48
5e93f0d
Compare
Choose a tag to compare

v3.0.0

19 Jun 23:01
7c395b6
Compare
Choose a tag to compare

What's new in 3.0.0?

Target framework changes - Serilog no longer targets netstandard1.x or .NET Framework versions earlier than .NET 4.6.2. Users on affected frameworks should continue to target Serilog 2.12.x.

Removed obsolete APIs - Many deprecated/obsolete types and functions have been removed. Notably, JsonFormatter can no longer be subclassed (either port to JsonValueFormatter, use Serilog.Expressions, or copy the original JsonFormatter code into your project).

Added APIs - LevelAlias.Off is now provided as an equivalent to Microsoft.Extensions.Logging's LogLevel.Off; Destructure.AsDictionary<T>() can now be used to mark dictionary types.

Fewer allocations on many hot paths - A lot of work has gone into avoiding heap allocations wherever possible.

Changes

Read more

v2.12.0

13 Sep 04:20
9f86301
Compare
Choose a tag to compare

Highlights of 2.12.0

Improved and expanded <Nullable>enable</Nullable> support

A huge number of commits have gone into completing and refining non-null reference type annotations, which now cover the entire public Serilog API. The Serilog project itself now builds with non-null reference type checking globally enabled πŸŽ‰

IAsyncDisposable support

Sinks that need to flush changes using asynchronous APIs can now implement IAsyncDisposable and prevent the possibility of deadlocking while waiting for tasks to complete.

To drive this, Logger can now be disposed via using async:

await using var log = new LoggerConfiguration().CreateLogger();

and the Log class provides Log.CloseAndFlushAsync():

await Log.CloseAndFlushAsync();

DateOnly and TimeOnly support

The DateOnly and TimeOnly types introduced in .NET 6 are now correctly handled as scalar values when capturing.

Merged PRs