Skip to content

Commit c84d13e

Browse files
committed
Update the CHANGELOG
1 parent 75b8bd2 commit c84d13e

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

CHANGELOG.md

+52-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,53 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
- The formatting of the `message` XML element has changed. If a log event is coming from `Microsoft.Extensions.Logging`, then the message is now formatted by switching off quoting of strings. The formatting of properties remain unchanged.
10+
11+
Before (1.2.0)
12+
13+
```xml
14+
<event logger="Microsoft.EntityFrameworkCore.Database.Command" timestamp="2003-01-04T15:09:26.535+01:00" level="INFO">
15+
<properties>
16+
<data name="elapsed" value="10" />
17+
<!-- ... -->
18+
<data name="EventId.Id" value="20101" />
19+
<data name="EventId.Name" value="Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted" />
20+
</properties>
21+
<message>Executed DbCommand ("10"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']"
22+
""SELECT COUNT(*) FROM \"sqlite_master\" WHERE \"type\" = 'table' AND \"rootpage\" IS NOT NULL;"</message>
23+
</event>
24+
```
25+
26+
After (Unreleased)
27+
28+
```xml
29+
<event logger="Microsoft.EntityFrameworkCore.Database.Command" timestamp="2003-01-04T15:09:26.535+01:00" level="INFO">
30+
<properties>
31+
<data name="elapsed" value="10" />
32+
<!-- ... -->
33+
<data name="EventId.Id" value="20101" />
34+
<data name="EventId.Name" value="Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted" />
35+
</properties>
36+
<message>Executed DbCommand (10ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
37+
SELECT COUNT(*) FROM "sqlite_master" WHERE "type" = 'table' AND "rootpage" IS NOT NULL;</message>
38+
</event>
39+
```
40+
41+
- The message formatting behaviour can be configured with the new `UseMessageFormatter()` method of the options' builder. For example, all log events with the `UppercaseMessage` property set to `true` can have their messages uppercased.
42+
43+
```csharp
44+
var formatter = new Log4NetTextFormatter(options => options.UseMessageFormatter((logEvent, formatProvider) =>
45+
{
46+
if (logEvent.Properties.TryGetValue("UppercaseMessage", out var up) && up is ScalarValue { Value: true })
47+
{
48+
return logEvent.RenderMessage(formatProvider).ToUpperInvariant();
49+
}
50+
return logEvent.RenderMessage(formatProvider);
51+
}));
52+
```
53+
754
## [1.2.0][1.2.0] - 2024-09-10
855

956
- Add support for .NET 8 and mark `Serilog.Formatting.Log4Net` as [trimmable](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) for [AOT compatibility](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/).
@@ -40,20 +87,20 @@ Serilog.Formatting.Log4Net.Log4NetTextFormatter::Log4JFormatter, Serilog.Formatt
4087
- Converted the `LineEndingExtensions` class from public to internal
4188
- Improve log4j compatibility mode: don't write the `xmlns:log4j` attribute to be [exactly compatible](https://github.com/apache/log4j/blob/v1_2_17/src/main/java/org/apache/log4j/xml/XMLLayout.java#L137-L145) with log4j
4289

43-
Before (1.0.0-rc.2):
90+
Before (1.0.0-rc.2)
4491

4592
```xml
4693
<log4j:event timestamp="1041689366535" level="INFO" xmlns:log4j="http://jakarta.apache.org/log4j/">
4794
<log4j:message><![CDATA[Hello from Serilog]]></log4j:message>
48-
</log4j:event>
95+
</log4j:event>
4996
```
5097

5198
After (1.0.0-rc.3)
5299

53100
```xml
54101
<log4j:event timestamp="1041689366535" level="INFO">
55102
<log4j:message><![CDATA[Hello from Serilog]]></log4j:message>
56-
</log4j:event>
103+
</log4j:event>
57104
```
58105

59106
## [1.0.0-rc.2][1.0.0-rc.2] - 2021-03-25
@@ -62,7 +109,7 @@ After (1.0.0-rc.3)
62109
- The `Log4NetTextFormatterOptionsBuilder` constructor is now internal
63110
- Include the index in the property name when formatting a SequenceValue
64111

65-
Before (1.0.0-rc.1):
112+
Before (1.0.0-rc.1)
66113

67114
```xml
68115
<log4net:data name="Args" value="--first-argument" />
@@ -88,7 +135,7 @@ Still trying to figure out how to make everything fit together with [MinVer](htt
88135

89136
- Implement log4j compatibility mode.
90137

91-
[Unreleased]: https://github.com/serilog-contrib/serilog-formatting-log4net/compare/1.1.0...HEAD
138+
[Unreleased]: https://github.com/serilog-contrib/serilog-formatting-log4net/compare/1.2.0...HEAD
92139
[1.2.0]: https://github.com/serilog-contrib/serilog-formatting-log4net/compare/1.1.0...1.2.0
93140
[1.1.0]: https://github.com/serilog-contrib/serilog-formatting-log4net/compare/1.0.2...1.1.0
94141
[1.0.2]: https://github.com/serilog-contrib/serilog-formatting-log4net/compare/1.0.1...1.0.2

0 commit comments

Comments
 (0)