Skip to content

Commit 800758c

Browse files
Danthardependabot-preview[bot]chrisbarker
authored
Release 1.3.11 (#80)
* Upgrade build system to fix CI (#66) * Targets net462 for all projects * Adds build-system template which contains yaml files for azure devops builds * Updates build.fsx to fix some bugs and tweak some stuff * Bump FluentAssertions from 5.3.0 to 5.9.0 (#60) Bumps [FluentAssertions](https://github.com/fluentassertions/fluentassertions) from 5.3.0 to 5.9.0. - [Release notes](https://github.com/fluentassertions/fluentassertions/releases) - [Commits](fluentassertions/fluentassertions@5.3.0...5.9.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump Akka.TestKit.Xunit2 from 1.3.9 to 1.3.15 Bumps [Akka.TestKit.Xunit2](https://github.com/akkadotnet/akka.net) from 1.3.9 to 1.3.15. - [Release notes](https://github.com/akkadotnet/akka.net/releases) - [Changelog](https://github.com/akkadotnet/akka.net/blob/1.3.15/RELEASE_NOTES.md) - [Commits](akkadotnet/akka.net@v1.3.9...1.3.15) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump Serilog from 2.7.1 to 2.8.0 Bumps [Serilog](https://github.com/serilog/serilog) from 2.7.1 to 2.8.0. - [Release notes](https://github.com/serilog/serilog/releases) - [Changelog](https://github.com/serilog/serilog/blob/dev/CHANGES.md) - [Commits](serilog/serilog@v2.7.1...v2.8.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump Akka from 1.3.9 to 1.3.15 Bumps [Akka](https://github.com/akkadotnet/akka.net) from 1.3.9 to 1.3.15. - [Release notes](https://github.com/akkadotnet/akka.net/releases) - [Changelog](https://github.com/akkadotnet/akka.net/blob/1.3.15/RELEASE_NOTES.md) - [Commits](akkadotnet/akka.net@v1.3.9...1.3.15) Signed-off-by: dependabot-preview[bot] <[email protected]> * Update RELEASE_NOTES.md * Update common.props * Update RELEASE_NOTES.md * Bump Serilog from 2.8.0 to 2.9.0 (#68) Bumps [Serilog](https://github.com/serilog/serilog) from 2.8.0 to 2.9.0. - [Release notes](https://github.com/serilog/serilog/releases) - [Changelog](https://github.com/serilog/serilog/blob/dev/CHANGES.md) - [Commits](serilog/serilog@v2.8.0...v2.9.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * Update RELEASE_NOTES.md * Bump Akka.TestKit.Xunit2 from 1.3.15 to 1.3.16 (#72) Bumps [Akka.TestKit.Xunit2](https://github.com/akkadotnet/akka.net) from 1.3.15 to 1.3.16. - [Release notes](https://github.com/akkadotnet/akka.net/releases) - [Changelog](https://github.com/akkadotnet/akka.net/blob/1.3.16/RELEASE_NOTES.md) - [Commits](akkadotnet/akka.net@1.3.15...1.3.16) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump Akka from 1.3.15 to 1.3.16 (#73) Bumps [Akka](https://github.com/akkadotnet/akka.net) from 1.3.15 to 1.3.16. - [Release notes](https://github.com/akkadotnet/akka.net/releases) - [Changelog](https://github.com/akkadotnet/akka.net/blob/1.3.16/RELEASE_NOTES.md) - [Commits](akkadotnet/akka.net@1.3.15...1.3.16) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump Akka from 1.3.16 to 1.3.17 (#75) * Bump Akka.TestKit.Xunit2 from 1.3.16 to 1.3.17 (#74) * Bump FluentAssertions from 5.9.0 to 5.10.0 (#77) Bumps [FluentAssertions](https://github.com/fluentassertions/fluentassertions) from 5.9.0 to 5.10.0. - [Release notes](https://github.com/fluentassertions/fluentassertions/releases) - [Commits](fluentassertions/fluentassertions@5.9.0...5.10.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * Fix issue where ActorPath is used as SourceContext rather than ClassName as is normal in Serilog (#79) In Serilog the SourceContext property is Class.FullName. Features like minimum overrides work with this expectation. Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Chris Barker <[email protected]>
1 parent a8e51d9 commit 800758c

File tree

5 files changed

+56
-15
lines changed

5 files changed

+56
-15
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
#### 1.3.11 February 05 2020 ####
2+
3+
* Breaking change [Fixed: SourceContext should be set consistent with Serilog expectations](https://github.com/akkadotnet/Akka.Logger.Serilog/issues/78)
4+
15
#### 1.3.10 October 05 2019 ####
2-
* Upgraded to Serilog v2.8.0
6+
* Upgraded to Serilog v2.9.0
37
* Upgraded to Akka 1.3.15
48

59
#### 1.3.9 August 23 2018 ####

src/Akka.Logger.Serilog.Tests/Akka.Logger.Serilog.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
1010
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
1111
<PackageReference Include="xunit" Version="$(XunitVersion)" />
12-
<PackageReference Include="Akka.TestKit.Xunit2" Version="1.3.15" />
13-
<PackageReference Include="FluentAssertions" Version="5.9.0" />
12+
<PackageReference Include="Akka.TestKit.Xunit2" Version="1.3.17" />
13+
<PackageReference Include="FluentAssertions" Version="5.10.0" />
1414
<PackageReference Include="Serilog.Sinks.ColoredConsole" Version="3.0.1" />
1515
</ItemGroup>
1616

src/Akka.Logger.Serilog.Tests/ForContextSpecs.cs

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Akka.Event;
99
using FluentAssertions;
1010
using Serilog;
11+
using Serilog.Core;
1112
using Serilog.Events;
1213
using Xunit;
1314
using Xunit.Abstractions;
@@ -25,11 +26,11 @@ public class ForContextSpecs : TestKit.Xunit2.TestKit
2526
public ForContextSpecs(ITestOutputHelper helper) : base(Config, output: helper)
2627
{
2728
global::Serilog.Log.Logger = new LoggerConfiguration()
28-
.WriteTo.Sink(_sink)
29-
.MinimumLevel.Information()
30-
.CreateLogger();
29+
.WriteTo.Sink(_sink)
30+
.MinimumLevel.Information()
31+
.CreateLogger();
3132

32-
var logSource = Sys.Name;
33+
var logSource = Sys.Name;
3334
var logClass = typeof(ActorSystem);
3435

3536
_loggingAdapter = new SerilogLoggingAdapter(Sys.EventStream, logSource, logClass);
@@ -113,7 +114,41 @@ public void ShouldPassAlongAdditionalContextWorkaround()
113114
logEvent2.Properties["spanId"].ToString().Should().BeEquivalentTo(spanId.ToString());
114115

115116
}
116-
}
117+
118+
[Fact]
119+
public void ShouldPassAlongClassNameAsSourceContext()
120+
{
121+
var context = _loggingAdapter;
122+
123+
_sink.Clear();
124+
AwaitCondition(() => _sink.Writes.Count == 0);
125+
126+
context.Info( "hi" );
127+
AwaitCondition(() => _sink.Writes.Count == 1);
128+
129+
_sink.Writes.TryDequeue( out var logEvent ).Should().BeTrue();
130+
logEvent.Level.Should().Be(LogEventLevel.Information);
131+
logEvent.Properties.ContainsKey(Constants.SourceContextPropertyName).Should().BeTrue();
132+
logEvent.Properties[Constants.SourceContextPropertyName].ToString().Should().BeEquivalentTo($"\"{typeof(ActorSystem).FullName}\"");
133+
}
134+
135+
[Fact]
136+
public void ShouldPassAlongActorPath()
137+
{
138+
var context = _loggingAdapter;
139+
140+
_sink.Clear();
141+
AwaitCondition(() => _sink.Writes.Count == 0);
142+
143+
context.Info( "hi" );
144+
AwaitCondition(() => _sink.Writes.Count == 1);
145+
146+
_sink.Writes.TryDequeue( out var logEvent ).Should().BeTrue();
147+
logEvent.Level.Should().Be(LogEventLevel.Information);
148+
logEvent.Properties.ContainsKey("ActorPath").Should().BeTrue();
149+
logEvent.Properties["ActorPath"].ToString().Should().BeEquivalentTo($"\"{this.TestActor.Path}\"");
150+
}
151+
}
117152
}
118153

119154

src/Akka.Logger.Serilog/Akka.Logger.Serilog.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Serilog" Version="2.8.0" />
13-
<PackageReference Include="Akka" Version="1.3.15" />
12+
<PackageReference Include="Serilog" Version="2.9.0" />
13+
<PackageReference Include="Akka" Version="1.3.17" />
1414
</ItemGroup>
1515

1616
</Project>

src/Akka.Logger.Serilog/SerilogLogger.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Akka.Dispatch;
1111
using Akka.Event;
1212
using Serilog;
13+
using Serilog.Core;
1314
using Serilog.Core.Enrichers;
1415

1516
namespace Akka.Logger.Serilog
@@ -37,11 +38,12 @@ private static object[] GetArgs(object message)
3738
}
3839

3940
private static ILogger GetLogger(LogEvent logEvent) {
40-
var logger = Log.Logger.ForContext("SourceContext", Context.Sender.Path);
41-
logger = logger
42-
.ForContext("Timestamp", logEvent.Timestamp)
43-
.ForContext("LogSource", logEvent.LogSource)
44-
.ForContext("Thread", logEvent.Thread.ManagedThreadId.ToString().PadLeft(4, '0'));
41+
var logger = Log.Logger
42+
.ForContext(Constants.SourceContextPropertyName, logEvent.LogClass.FullName)
43+
.ForContext("ActorPath", Context.Sender.Path)
44+
.ForContext("Timestamp", logEvent.Timestamp)
45+
.ForContext("LogSource", logEvent.LogSource)
46+
.ForContext("Thread", logEvent.Thread.ManagedThreadId.ToString().PadLeft( 4, '0' ));
4547

4648
var logMessage = logEvent.Message as LogMessage;
4749
if (logMessage != null)

0 commit comments

Comments
 (0)