Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .generated.NoMobile.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<Project Path="test/Sentry.Google.Cloud.Functions.Tests/Sentry.Google.Cloud.Functions.Tests.csproj" />
<Project Path="test/Sentry.Hangfire.Tests/Sentry.Hangfire.Tests.csproj" />
<Project Path="test/Sentry.Log4Net.Tests/Sentry.Log4Net.Tests.csproj" />
<Project Path="test/Sentry.Log4Net.V3.Tests/Sentry.Log4Net.V3.Tests.csproj" />
<Project Path="test/Sentry.Maui.CommunityToolkit.Mvvm.Tests/Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" />
<Project Path="test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj" />
<Project Path="test/Sentry.Maui.Tests/Sentry.Maui.Tests.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Linux-NoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.Tests\\Sentry.OpenTelemetry.Exporter.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Linux.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Windows-arm64.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Device.TestApp\\Sentry.Maui.Device.TestApp.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<Project Path="test/Sentry.Google.Cloud.Functions.Tests/Sentry.Google.Cloud.Functions.Tests.csproj" />
<Project Path="test/Sentry.Hangfire.Tests/Sentry.Hangfire.Tests.csproj" />
<Project Path="test/Sentry.Log4Net.Tests/Sentry.Log4Net.Tests.csproj" />
<Project Path="test/Sentry.Log4Net.V3.Tests/Sentry.Log4Net.V3.Tests.csproj" />
<Project Path="test/Sentry.Maui.CommunityToolkit.Mvvm.Tests/Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" />
<Project Path="test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj" />
<Project Path="test/Sentry.Maui.Tests/Sentry.Maui.Tests.csproj" />
Expand Down
1 change: 1 addition & 0 deletions SentryNoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.Tests\\Sentry.OpenTelemetry.Exporter.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions SentryNoSamples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.Log4Net.V3.Tests\\Sentry.Log4Net.V3.Tests.csproj",
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions src/Sentry.Log4Net/Sentry.Log4Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<ItemGroup>
<InternalsVisibleTo Include="Sentry.Log4Net.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net.V3.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 8 additions & 6 deletions src/Sentry.Log4Net/SentryAppender.Structured.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ private static void CaptureStructuredLog(IHub hub, SentryOptions options, Loggin
// against null, so we do too rather than rely on log4net's internals.
if (loggingEvent.GetProperties() is { } properties)
{
foreach (var property in properties)
foreach (var key in properties.GetKeys())
{
if (property is DictionaryEntry { Key: string key, Value: { } value })
if (string.IsNullOrEmpty(key) || key.StartsWith("log4net:", StringComparison.OrdinalIgnoreCase) || Guid.TryParse(key, out _))
{
if (key.Length != 0 && !key.StartsWith("log4net:", StringComparison.OrdinalIgnoreCase) && !Guid.TryParse(key, out _))
{
log.SetAttribute($"property.{key}", value);
}
continue;
}

if (properties[key] is { } value)
Comment thread
jamescrosswell marked this conversation as resolved.
{
log.SetAttribute($"property.{key}", value);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<InternalsVisibleTo Include="Sentry.Hangfire.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net.V3.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui.CommunityToolkit.Mvvm" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui.CommunityToolkit.Mvvm.Tests" PublicKey="$(SentryPublicKey)" />
Expand Down
29 changes: 29 additions & 0 deletions test/Sentry.Log4Net.V3.Tests/Sentry.Log4Net.V3.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LatestTfm)</TargetFrameworks>
<!-- These tests fail on Mono -->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net48</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Sentry.Log4Net.Tests\SentryAppenderTests.cs" Link="SentryAppenderTests.cs" />
<Compile Include="..\Sentry.Log4Net.Tests\SentryAppenderTests.Structured.cs" Link="SentryAppenderTests.Structured.cs">
<DependentUpon>SentryAppenderTests.cs</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<PackageReference Include="log4net" Version="3.4.0" />
<ProjectReference Include="..\..\src\Sentry.Log4Net\Sentry.Log4Net.csproj" />
<ProjectReference Include="..\Sentry.Testing\Sentry.Testing.csproj" />

<Using Include="log4net" />
<Using Include="log4net.Core" />
<Using Include="log4net.Appender" />
<Using Include="log4net.Layout" />
<Using Include="log4net.Repository.Hierarchy" />
<Using Include="Sentry.Log4Net" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions test/Sentry.Testing/Sentry.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<InternalsVisibleTo Include="Sentry.Google.Cloud.Functions.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.GraphQL.Client.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Log4Net.V3.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.NLog.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Profiling.Tests" PublicKey="$(SentryPublicKey)" />
Expand Down
Loading