Skip to content

Commit db805ae

Browse files
authored
Log warning when ServiceUrl and RegionEndpoint are set at the same time (#3732)
* Log warning when ServiceUrl and RegionEndpoint are set at the same time
1 parent d40e23a commit db805ae

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"core": {
3+
"changeLogMessages": [
4+
"Log a warning when ServiceUrl and Region Endpoint are set at the same time. The SDK will log whichever of the two is used."
5+
],
6+
"type": "patch",
7+
"updateMinimum": true
8+
}
9+
}

sdk/src/Core/Amazon.Runtime/ClientConfig.cs

+6
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ public RegionEndpoint RegionEndpoint
271271
}
272272
set
273273
{
274+
if (!string.IsNullOrEmpty(this.serviceURL))
275+
Logger.GetLogger(GetType()).InfoFormat($"RegionEndpoint and ServiceURL are mutually exclusive. Since " +
276+
$"RegionEndpoint was set last, RegionEndpoint: {value} will be used to make the request and ServiceUrl: {this.serviceURL} has been set to null.");
274277
this.defaultConfigurationBackingField = null;
275278
this.serviceURL = null;
276279
this.regionEndpoint = value;
@@ -373,6 +376,9 @@ public string ServiceURL
373376
}
374377
set
375378
{
379+
if (regionEndpoint != null)
380+
Logger.GetLogger(GetType()).InfoFormat($"RegionEndpoint and ServiceURL are mutually exclusive. Since " +
381+
$"ServiceUrl was set last, ServiceUrl: {value} will be used to make the request and RegionEndpoint: {this.regionEndpoint} has been set to null.");
376382
this.regionEndpoint = null;
377383
this.probeForRegionEndpoint = false;
378384

0 commit comments

Comments
 (0)