Skip to content

Commit 2bf5519

Browse files
authored
Merge pull request #610 from ckadluba/607-exception-auditto-shared-sqlconnection
Fixed concurrency issue #607
2 parents ce7b2ee + e0cb12a commit 2bf5519

File tree

20 files changed

+69
-291
lines changed

20 files changed

+69
-291
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 8.1.1
2+
* Fixed concurrency issue #607 in audit sink
3+
14
# 8.1.0
25
* Implemented #542: Column option `ResolveHierarchicalPropertyName` to force non-hierarchical handling
36
* Removed unnecessary exception handlers and let Serilog Core do the SelfLog()

serilog-sinks-mssqlserver.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2828
Directory.Build.props = Directory.Build.props
2929
Directory.Packages.props = Directory.Packages.props
3030
.github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md
31+
.github\workflows\perftests.yml = .github\workflows\perftests.yml
3132
.github\workflows\pr-analysis-codeql.yml = .github\workflows\pr-analysis-codeql.yml
3233
.github\workflows\pr-analysis-devskim.yml = .github\workflows\pr-analysis-devskim.yml
3334
.github\workflows\pr-validation.yml = .github\workflows\pr-validation.yml
3435
README.md = README.md
3536
.github\workflows\release.yml = .github\workflows\release.yml
3637
RunPerfTests.ps1 = RunPerfTests.ps1
37-
.github\workflows\perftests.yml = .github\workflows\perftests.yml
3838
EndProjectSection
3939
EndProject
4040
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetStandardDemoLib", "sample\NetStandardDemo\NetStandardDemoLib\NetStandardDemoLib.csproj", "{8E69E31B-61C7-4175-B886-9C2078FCA477}"

src/Serilog.Sinks.MSSqlServer/Configuration/Extensions/Hybrid/LoggerConfigurationMSSqlServerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Serilog Contributors
1+
// Copyright 2025 Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

src/Serilog.Sinks.MSSqlServer/Configuration/Extensions/Microsoft.Extensions.Configuration/LoggerConfigurationMSSqlServerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Serilog Contributors
1+
// Copyright 2025 Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/MSSqlServerAuditSink.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Serilog Contributors
1+
// Copyright 2025 Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -30,8 +30,6 @@ public class MSSqlServerAuditSink : ILogEventSink, IDisposable
3030
{
3131
private readonly ISqlLogEventWriter _sqlLogEventWriter;
3232

33-
private bool _disposedValue;
34-
3533
/// <summary>
3634
/// Construct a sink posting to the specified database.
3735
///
@@ -115,15 +113,7 @@ public void Dispose()
115113
/// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
116114
protected virtual void Dispose(bool disposing)
117115
{
118-
if (!_disposedValue)
119-
{
120-
if (disposing)
121-
{
122-
_sqlLogEventWriter.Dispose();
123-
}
124-
125-
_disposedValue = true;
126-
}
116+
// This class needn't to dispose anything. This is just here for sink interface compatibility.
127117
}
128118

129119
private static void ValidateParameters(MSSqlServerSinkOptions sinkOptions, ColumnOptions columnOptions)

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/MSSqlServerSink.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Serilog Contributors
1+
// Copyright 2025 Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -152,7 +152,6 @@ protected virtual void Dispose(bool disposing)
152152
if (disposing)
153153
{
154154
_sqlBulkBatchWriter.Dispose();
155-
_sqlLogEventWriter.Dispose();
156155
}
157156

158157
_disposedValue = true;
Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
// Copyright 2024 Serilog Contributors
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
14-
15-
using Serilog.Events;
1+
using Serilog.Events;
162

173
namespace Serilog.Sinks.MSSqlServer.Output
184
{
@@ -21,4 +7,4 @@ internal interface IXmlPropertyFormatter
217
string GetValidElementName(string name);
228
string Simplify(LogEventPropertyValue value, ColumnOptions.PropertiesColumnOptions options);
239
}
24-
}
10+
}

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Output/JsonLogEventFormatter.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
// Copyright 2024 Serilog Contributors
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
14-
151
using System;
162
using System.Collections.Generic;
173
using System.Data;

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Platform/ISqlCommandFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace Serilog.Sinks.MSSqlServer.Platform
44
{
55
internal interface ISqlCommandFactory
66
{
7-
ISqlCommandWrapper CreateCommand(ISqlConnectionWrapper sqlConnection);
87
ISqlCommandWrapper CreateCommand(string cmdText, ISqlConnectionWrapper sqlConnection);
98
}
109
}

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Platform/ISqlLogEventWriter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Threading.Tasks;
43
using Serilog.Events;
54

65
namespace Serilog.Sinks.MSSqlServer.Platform
76
{
8-
internal interface ISqlLogEventWriter : IDisposable
7+
internal interface ISqlLogEventWriter
98
{
109
void WriteEvent(LogEvent logEvent);
1110

0 commit comments

Comments
 (0)