Releases: FantasticFiasco/serilog-sinks-http
Release v9.0.0
⚡ Added
-
#311 [BREAKING CHANGE] Support specifying
levelSwitch
when creating the sink, thus adding the support to dynamically change the log level at runtime (contribution by @yuriy-millen)Migration guide
The parameter
levelSwitch
has been introduced to the methodsHttp
,DurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
. Please verify that the arguments pass by you to these methods still align with your intentions.To automatically mitigate this kind of new parameter issue in the future, move from using positional arguments to named arguments.
-
#262 [BREAKING CHANGE] Support specifying
flushOnClose
when creating the sink, thus adding the support to suppress sending unsent log events to the log server before closing the sink (proposed by @murlidakhare, @julichan, @janichirag11 & @prasadpaul53)Migration guide
The parameter
flushOnClose
has been introduced to the methodsHttp
,DurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
. Please verify that the arguments pass by you to these methods still align with your intentions.To automatically mitigate this kind of new parameter issue in the future, move from using positional arguments to named arguments.
-
Support for .NET Framework 4.6.2
💫 Changed
- #262 [BREAKING CHANGE] A new argument of type
CancellationToken
has been added to thePostAsync
method of interfaceIHttpClient
.
💀 Removed
- #253 [BREAKING CHANGE] Remove support for .NET Framework 4.5, aligning with the .NET Framework support policy
- [BREAKING CHANGE] Remove support for .NET Framework 4.6.1, aligning with the .NET Framework support policy
Release v9.0.0-beta.2
⚡ Added
-
Support for .NET Framework 4.6.2
-
#262 [BREAKING CHANGE] Support specifying
flushOnClose
when creating the sink, thus adding the support to suppress sending unsent log events to the log server before closing the sink (proposed by @murlidakhare, @julichan, @janichirag11 & @prasadpaul53)Migration guide
The parameter
flushOnClose
has been introduced to the methodsHttp
,DurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
. Please verify that the arguments pass by you to these methods still align with your intentions.To automatically mitigate this kind of new parameter issue in the future, move from using positional arguments to named arguments.
💫 Changed
- #262 [BREAKING CHANGE] A new argument of type
CancellationToken
has been added to thePostAsync
method of interfaceIHttpClient
.
💀 Removed
- #253 [BREAKING CHANGE] Remove support for .NET Framework 4.5, aligning with the .NET Framework support policy
- [BREAKING CHANGE] Remove support for .NET Framework 4.6.1, aligning with the .NET Framework support policy
Release v9.0.0-beta.1
⚡ Added
-
#311 [BREAKING CHANGE] Support specifying
levelSwitch
when creating the sink, thus adding the support to dynamically change the log level at runtime (contribution by @yuriy-millen)Migration guide
The parameter
levelSwitch
has been introduced to the methodsHttp
,DurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
. Please verify that the arguments pass by you to these methods still align with your intentions.To automatically mitigate this kind of new parameter issue in the future, move from using positional arguments to named arguments instead.
Release v8.0.0
⚡ Added
-
#116 [BREAKING CHANGE] Support specifying
batchSizeLimitBytes
when creating the sink, thus limiting the size of the payloads sent to the log server (proposed by @michaeltdaniels)Migration guide
The parameter
batchSizeLimitBytes
has been introduced to the methodsHttp
,DurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
. Please verify that the arguments pass by you to these methods still align with your intentions.To automatically mitigate this kind of new parameter issue in the future would be to move from using positional arguments to use named arguments.
-
#166 Support for content encoding Gzip using HTTP client
JsonGzipHttpClient
(contribution by @vaibhavepatel, @KalininAndreyVictorovich and @AntonSmolkov) -
#166 Support for specifying
HttpClient
when creatingJsonHttpClient
andJsonGzipHttpClient
💫 Changed
-
#166 [BREAKING CHANGE] Interface
IHttpClient
has changed to accommodate for different HTTP content typesMigration guide
You'll have to migrate your code if you've implemented your own version of
IHttpClient
. The signature of methodIHttpClient.PostAsync
has changed fromTask<HttpResponseMessage> PostAsync(string, HttpContent)
toTask<HttpResponseMessage> PostAsync(string, Stream)
.// Before migration public class MyHttpClient : IHttpClient { // Code removed for brevity... public async Task<HttpResponseMessage> PostAsync(string requestUri, HttpContent content) { // Here you probably have some code updating the content, // and then you send the request return await httpClient.PostAsync(requestUri, content) } } // After migration public class MyHttpClient : IHttpClient { // Code removed for brevity... public async Task<HttpResponseMessage> PostAsync(string requestUri, Stream contentStream) { using (var content = new StreamContent(contentStream)) { content.Headers.Add("Content-Type", "application/json"); // Here you probably have some code updating the content, // and then you send the request return await httpClient.PostAsync(requestUri, content) } } }
-
#162 [BREAKING CHANGE] Deprecated dependency Serilog.Sinks.RollingFile has been removed (discovered by @tipasergio)
Migration guide
You'll have to migrate your code if you're using
DurableHttpUsingTimeRolledBuffers
, i.e. use the durable HTTP sink with a rolling behavior defined by a time interval. The parameterbufferPathFormat
has been renamed tobufferBaseFileName
, and the parameterbufferRollingInterval
has been added.Given you are configuring the sink in code you should apply the following changes.
// Before migration log = new LoggerConfiguration() .WriteTo.DurableHttpUsingTimeRolledBuffers( requestUri: "https://www.mylogs.com", bufferPathFormat: "MyBuffer-{Hour}.json") .CreateLogger(); // After migration log = new LoggerConfiguration() .WriteTo.DurableHttpUsingTimeRolledBuffers( requestUri: "https://www.mylogs.com", bufferBaseFileName: "MyBuffer", bufferRollingInterval: BufferRollingInterval.Hour) .CreateLogger();
Given you are configuring the sink in application configuration you should apply the following changes.
// Before migration { "Serilog": { "WriteTo": [ { "Name": "DurableHttpUsingTimeRolledBuffers", "Args": { "requestUri": "https://www.mylogs.com", "bufferPathFormat": "MyBuffer-{Hour}.json" } } ] } } // After migration { "Serilog": { "WriteTo": [ { "Name": "DurableHttpUsingTimeRolledBuffers", "Args": { "requestUri": "https://www.mylogs.com", "bufferBaseFileName": "MyBuffer", "bufferRollingInterval": "Hour" } } ] } }
-
#206 [BREAKING CHANGE] Argument
bufferFileSizeLimitBytes
to extension methodsDurableHttpUsingFileSizeRolledBuffers
andDurableHttpUsingTimeRolledBuffers
no longer accepts0
as value -
#203, #245 [BREAKING CHANGE] Non-durable sink has changed from having its maximum queue size defined as number of events into number of bytes, making it far easier to reason about memory consumption. It's importance to the behavior of the sink was also the reasoning for promoting it from being optional to being mandatory. (proposed by @seruminar)
Given you are configuring the sink in code you should do the following changes.
// Before migration log = new LoggerConfiguration() .WriteTo.Http( requestUri: "https://www.mylogs.com", queueLimit: 1000) .CreateLogger(); // After migration log = new LoggerConfiguration() .WriteTo.Http( requestUri: "https://www.mylogs.com", queueLimitBytes: 50 * ByteSize.MB) .CreateLogger();
Given you are configuring the sink in application configuration you should do the following changes.
// Before migration { "Serilog": { "WriteTo": [ { "Name": "Http", "Args": { "requestUri": "https://www.mylogs.com", "queueLimit": 1000 } } ] } } // After migration { "Serilog": { "WriteTo": [ { "Name": "Http", "Args": { "requestUri": "https://www.mylogs.com", "queueLimitBytes": 52428800 } } ] } }
-
#171 [BREAKING CHANGE] Move maximum log event size configuration from batch formatter to sink configuration, and change it's default value from 256 kB to
null
Migration guide
Given that you're depending on the default maximum log event size configuration in
DefaultBatchFormatter
orArrayBatchFormatter
, or have defined your own limit when instantiating these classes, you should apply the following changes.// Before migration log = new LoggerConfiguration() // Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers // and DurableHttpUsingTimeRolledBuffers .WriteTo.Http( requestUri: "https://www.mylogs.com", batchFormatter: new ArrayBatchFormatter(ByteSize.MB)) .CreateLogger(); // After migration log = new LoggerConfiguration() .WriteTo.Http( requestUri: "https://www.mylogs.com", logEventLimitBytes: ByteSize.MB, batchFormatter: new ArrayBatchFormatter()) .CreateLogger();
-
#171 [BREAKING CHANGE] Rename sink configuration argument
batchPostingLimit
tologEventsInBatchLimit
Migration guide
Given tha you're defining the maximum number of log events in a single batch, you should apply the following changes.
// Before migration log = new LoggerConfiguration() // Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers // and DurableHttpUsingTimeRolledBuffers .WriteTo.Http( requestUri: "https://www.mylogs.com", batchPostingLimit: 100, .CreateLogger(); // After migration log = new LoggerConfiguration() .WriteTo.Http( requestUri: "https://www.mylogs.com", logEventsInBatchLimit: 100, .CreateLogger();
Given you are configuring the sink in application configuration you should apply the following changes.
// Before migration // Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers // and DurableHttpUsingTimeRolledBuffers { "Serilog": { "WriteTo": [ { "Name": "Http", "Args": { "requestUri": "https://www.mylogs.com", "batchPostingLimit": 100 } } ] } } // After migration { "Serilog": { "WriteTo": [ { "Name": "Http", "Args": { "requestUri": "https://www.mylogs.com", "logEventsInBatchLimit": 100 } } ] } }
-
[BREAKING CHANGE] Method
IHttpClient.Configure
on a custom HTTP client implementation is no longer called unless sink is provided an instance ofIConfiguration
💀 Removed
- #182 [BREAKING CHANGE] Extension method
DurableHttp
which was marked as deprecated in v5.2.0 - #215 [BREAKING CHANGE] Remove support for .NET Standard 1.3, aligning with the cross-platform targeting library guidance
...
Release v8.0.0-beta.11
- #203, #245 [BREAKING CHANGE] Non-durable sink has changed from having its maximum queue size defined as number of events into number of bytes, making it far easier to reason about memory consumption. It's importance to the behavior of the sink was also the reasoning for promoting it from being optional to being mandatory. (proposed by @seruminar)
Given you are configuring the sink in code you should do the following changes.
// Before migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
queueLimit: 1000)
.CreateLogger();
// After migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
queueLimitBytes: 50 * ByteSize.MB)
.CreateLogger();
Given you are configuring the sink in application configuration you should do the following changes.
// Before migration
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"queueLimit": 1000
}
}
]
}
}
// After migration
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"queueLimitBytes": 52428800
}
}
]
}
}
Release v8.0.0-beta.10
💫 Changed
- #171 [BREAKING CHANGE] Move maximum log event size configuration from batch formatter to sink configuration, and change it's default value from 256 kB to
null
Migration guide
Given that you're depending on the default maximum log event size configuration in DefaultBatchFormatter
or ArrayBatchFormatter
, or have defined your own limit when instantiating these classes, you should apply the following changes.
// Before migration
log = new LoggerConfiguration()
// Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers
// and DurableHttpUsingTimeRolledBuffers
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
batchFormatter: new ArrayBatchFormatter(ByteSize.MB))
.CreateLogger();
// After migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
logEventLimitBytes: ByteSize.MB,
batchFormatter: new ArrayBatchFormatter())
.CreateLogger();
- #171 [BREAKING CHANGE] Rename sink configuration argument
batchPostingLimit
tologEventsInBatchLimit
Migration guide
Given tha you're defining the maximum number of log events in a single batch, you should apply the following changes.
// Before migration
log = new LoggerConfiguration()
// Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers
// and DurableHttpUsingTimeRolledBuffers
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
batchPostingLimit: 100,
.CreateLogger();
// After migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
logEventsInBatchLimit: 100,
.CreateLogger();
Given you are configuring the sink in application configuration you should apply the following changes.
// Before migration
// Changes are also applicable to DurableHttpUsingFileSizeRolledBuffers
// and DurableHttpUsingTimeRolledBuffers
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"batchPostingLimit": 100
}
}
]
}
}
// After migration
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"logEventsInBatchLimit": 100
}
}
]
}
}
- #203 [BREAKING CHANGE] Non-durable sink has changed from having its maximum queue size defined as number of events into number of bytes, making it far easier to reason about memory consumption.
Given you are configuring the sink in code you should do the following changes.
// Before migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
queueLimit: 1000)
.CreateLogger();
// After migration
log = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "https://www.mylogs.com",
queueLimitBytes: 50 * ByteSize.MB)
.CreateLogger();
Given you are configuring the sink in application configuration you should do the following changes.
// Before migration
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"queueLimit": 1000
}
}
]
}
}
// After migration
{
"Serilog": {
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "https://www.mylogs.com",
"queueLimitBytes": 52428800
}
}
]
}
}
- #178 [BREAKING CHANGE] Batch formatter
DefaultBatchFormatter
was removed whenArrayBatchFormatter
was promoted to default batch formatter.
Migration guide
You'll have to migrate your code if you used DefaultBatchFormatter
, either implicitly by not specifying a batch formatter, or explicitly by specifying DefaultBatchFormatter
when configuring the sink.
Given that you wish to continue using DefaultBatchFormatter
as your batch formatter you should copy its implementation from the wiki into your own codebase.
Given that you decide to migrate into using ArrayBatchFormatter
instead of DefaultBatchFormatter
, you should verify that your log server is capable of receiving the new JSON payload format.
💀 Removed
- #215 [BREAKING CHANGE] Remove support for .NET Standard 1.3, aligning with the cross-platform targeting library guidance
💉 Fixed
- #220 - Text formatters
NamespacedTextFormatter
,NormalRenderedTextFormatter
andNormalTextFormatter
should write the timestamp in UTC
Release v8.0.0-beta.9
💀 Removed
- #196 [BREAKING CHANGE] Overloaded method
IBatchFormatter.Format(IEnumerable<LogEvent>, ITextFormatter, TextWriter)
has been removed in favour of keepingIBatchFormatter.Format(IEnumerable<string>, TextWriter output)
Migration guide
You'll have to migrate your code if you've implemented your own version of IBatchFormatter
.
// Before migration
public class MyBatchFormatter : IBatchFormatter
{
public void Format(IEnumerable<LogEvent> logEvents, ITextFormatter formatter, TextWriter output)
{
// Your implementation accepting a sequence of log events
}
public void Format(IEnumerable<string> logEvents, TextWriter output)
{
// Your implementation accepting a sequence of serialized log events
}
}
// After migration
public class MyBatchFormatter : IBatchFormatter
{
public void Format(IEnumerable<string> logEvents, TextWriter output)
{
// Your implementation accepting a sequence of serialized log events
}
}
Release v8.0.0-beta.8
💉 Fixed
- #208 Transient dependency conflict for package Microsoft.Extensions.Configuration on ASP.NET Core 2.x (contribution by @AntonSmolkov)
Release v8.0.0-beta.7
💉 Fixed
- #193 Fix Gzip HTTP request footer by using
Dispose()
instead ofFlushAsync()
(contribution by @AntonSmolkov)
Release v8.0.0-beta.6
💉 Fixed
- #190 Add data flushing from GzipStream to underlying stream (contribution by @AntonSmolkov)