Skip to content

Commit

Permalink
refactor: logging level in warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Oct 16, 2024
1 parent 25f3765 commit f1f6168
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Adaptors/MongoDB/src/Common/MongoCollectionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ await mongoDatabase.CreateCollectionAsync(model.CollectionName,
catch (Exception ex)
{
lastException = ex;
logger.LogDebug(ex,
"Retrying to create Collection {CollectionName}",
model.CollectionName);
logger.LogWarning(ex,
"Retrying to create Collection {CollectionName}",
model.CollectionName);
await Task.Delay(1000 * collectionRetry,
cancellationToken)
.ConfigureAwait(false);
Expand Down Expand Up @@ -171,9 +171,9 @@ await model.InitializeIndexesAsync(session,
catch (Exception ex)
{
lastException = ex;
logger.LogDebug(ex,
"Retrying to Initialize indexes for {CollectionName} collection",
model.CollectionName);
logger.LogWarning(ex,
"Retrying to Initialize indexes for {CollectionName} collection",
model.CollectionName);
await Task.Delay(1000 * indexRetry,
cancellationToken)
.ConfigureAwait(false);
Expand All @@ -195,9 +195,9 @@ await model.ShardCollectionAsync(session,
catch (Exception ex)
{
lastException = ex;
logger.LogDebug(ex,
"Retrying to shard {CollectionName} collection",
model.CollectionName);
logger.LogWarning(ex,
"Retrying to shard {CollectionName} collection",
model.CollectionName);
await Task.Delay(1000 * indexRetry,
cancellationToken)
.ConfigureAwait(false);
Expand All @@ -218,17 +218,17 @@ await model.InitializeCollectionAsync(session,
}
catch (MongoBulkWriteException<TData> e) when (e.WriteErrors.All(error => error.Category == ServerErrorCategory.DuplicateKey))
{
logger.LogDebug(e,
"Values were already present within the collection {CollectionName}",
model.CollectionName);
logger.LogWarning(e,
"Values were already present within the collection {CollectionName}",
model.CollectionName);
break;
}
catch (Exception ex)
{
lastException = ex;
logger.LogDebug(ex,
"Retrying to initialize {CollectionName} collection",
model.CollectionName);
logger.LogWarning(ex,
"Retrying to initialize {CollectionName} collection",
model.CollectionName);
await Task.Delay(1000 * indexRetry,
cancellationToken)
.ConfigureAwait(false);
Expand Down

0 comments on commit f1f6168

Please sign in to comment.