Skip to content

Commit 161dd08

Browse files
committed
When failed to write to local log file write the original exception that triggered the reason for writing to the local log file to the console
Updated AWSSDK.CloudWatchLogs dependency to version AWS 4.0.8.4
1 parent 5bc6c91 commit 161dd08

13 files changed

Lines changed: 57 additions & 16 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "AWS.Logger.Core",
5+
"Type": "Patch",
6+
"ChangelogMessages": [
7+
"When failed to write to local log file write the original exception that triggered the reason for writing to the local log file to the console",
8+
"Updated AWSSDK.CloudWatchLogs dependency to version 4.0.8.4"
9+
]
10+
},
11+
{
12+
"Name": "AWS.Logger.AspNetCore",
13+
"Type": "Patch",
14+
"ChangelogMessages": [
15+
"Update to latest version of AWS.Logger.Core"
16+
]
17+
},
18+
{
19+
"Name": "AWS.Logger.Log4net",
20+
"Type": "Patch",
21+
"ChangelogMessages": [
22+
"Update to latest version of AWS.Logger.Core"
23+
]
24+
},
25+
{
26+
"Name": "AWS.Logger.SeriLog",
27+
"Type": "Patch",
28+
"ChangelogMessages": [
29+
"Update to latest version of AWS.Logger.Core"
30+
]
31+
},
32+
{
33+
"Name": "NLog.AWS.Logger",
34+
"Type": "Patch",
35+
"ChangelogMessages": [
36+
"Update to latest version of AWS.Logger.Core"
37+
]
38+
}
39+
]
40+
}

samples/AspNetCore/ConsoleSample/ConsoleSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="AWSSDK.Core" Version="4.0.0" />
17+
<PackageReference Include="AWSSDK.Core" Version="4.0.0.32" />
1818
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
1919
</ItemGroup>
2020

samples/Log4net/BasicAWSCredentialsConfigurationExample/BasicAWSCredentialsConfigurationExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="AWSSDK.Core" Version="4.0.0" />
11+
<PackageReference Include="AWSSDK.Core" Version="4.0.0.32" />
1212
<PackageReference Include="log4net" Version="2.0.15" />
1313
</ItemGroup>
1414

src/AWS.Logger.Core/AWS.Logger.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</ItemGroup>
4242

4343
<ItemGroup>
44-
<PackageReference Include="AWSSDK.CloudWatchLogs" Version="4.0.0" />
44+
<PackageReference Include="AWSSDK.CloudWatchLogs" Version="4.0.8.4" />
4545
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4646
</ItemGroup>
4747

src/AWS.Logger.Core/Core/AWSLoggerCore.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,10 @@ void ServiceClientBeforeRequestEvent(object sender, RequestEventArgs e)
678678
{
679679
var userAgentString = $"{_baseUserAgentString} ft/{_logType}";
680680
var args = e as Amazon.Runtime.WebServiceRequestEventArgs;
681-
if (args == null || !args.Headers.ContainsKey(UserAgentHeader) || args.Headers[UserAgentHeader].Contains(userAgentString))
681+
if (args == null)
682682
return;
683683

684-
args.Headers[UserAgentHeader] = args.Headers[UserAgentHeader] + " " + userAgentString;
684+
((Amazon.Runtime.Internal.IAmazonWebServiceRequest)args.Request).UserAgentDetails.AddUserAgentComponent(userAgentString);
685685
}
686686

687687
void ServiceClienExceptionEvent(object sender, ExceptionEventArgs e)
@@ -705,7 +705,7 @@ private void LogLibraryServiceError(Exception ex, string serviceUrl = null)
705705
/// <summary>
706706
/// Write Exception details to the file specified with the filename
707707
/// </summary>
708-
public static void LogLibraryError(Exception ex, string LibraryLogFileName)
708+
public static void LogLibraryError(Exception originalException, string LibraryLogFileName)
709709
{
710710
try
711711
{
@@ -714,13 +714,14 @@ public static void LogLibraryError(Exception ex, string LibraryLogFileName)
714714
w.WriteLine("Log Entry : ");
715715
w.WriteLine("{0}", DateTime.Now.ToString());
716716
w.WriteLine(" :");
717-
w.WriteLine(" :{0}", ex.ToString());
717+
w.WriteLine(" :{0}", originalException.ToString());
718718
w.WriteLine("-------------------------------");
719719
}
720720
}
721721
catch (Exception e)
722722
{
723723
Console.WriteLine("Exception caught when writing error log to file" + e.ToString());
724+
Console.WriteLine("Original Exception attempted to be written to the log file: " + originalException.ToString());
724725
}
725726
}
726727
}

test/AWS.Logger.AspNetCore.Tests/AWS.Logger.AspNetCore.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2727
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
2828
<!-- This needs to be referenced to allow testing via AssumeRole credentials -->
29-
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.0" />
29+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.6" />
3030
</ItemGroup>
3131

3232
</Project>

test/AWS.Logger.Log4Net.FilterTests/AWS.Logger.Log4Net.FilterTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2121
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
2222
<!-- This needs to be referenced to allow testing via AssumeRole credentials -->
23-
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.0" />
23+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.6" />
2424
</ItemGroup>
2525

2626
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">

test/AWS.Logger.Log4Net.Tests/AWS.Logger.Log4Net.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
3838
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
3939
<!-- This needs to be referenced to allow testing via AssumeRole credentials -->
40-
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.0" />
40+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.6" />
4141
</ItemGroup>
4242

4343
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">

test/AWS.Logger.NLog.FilterTests/AWS.Logger.NLog.FilterTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2727
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
2828
<!-- This needs to be referenced to allow testing via AssumeRole credentials -->
29-
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.0" />
29+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.6" />
3030
</ItemGroup>
3131

3232
</Project>

test/AWS.Logger.NLog.Tests/AWS.Logger.NLog.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
4242
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
4343
<!-- This needs to be referenced to allow testing via AssumeRole credentials -->
44-
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.0" />
44+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.6" />
4545
</ItemGroup>
4646

4747
</Project>

0 commit comments

Comments
 (0)