aws / aws-logging-dotnet

.NET Libraries for integrating Amazon CloudWatch Logs with popular .NET logging libraries
Apache License 2.0
296 stars 133 forks source link

Prevent monitor from not starting when LogStreamName already exists #257

Closed michaeldimoudis closed 4 months ago

michaeldimoudis commented 4 months ago

Related to issue #244 Description of issue was replied against main issue https://github.com/aws/aws-logging-dotnet/pull/244#issuecomment-2106242792

Description of changes:

With the recent addition of a LogStreamName configuration to allow overriding the generated stream name, it was overlooked that the library will throw an exception if that LogStreamName already exists, defeating the purpose of that added feature.

In addition, with the recent CloudWatch improvement of "removing the requirement of providing a sequence token when calling Amazon CloudWatch Logs PutLogEvents API", which this library has implemented, it's probably a good idea to not throw an exeption and crash the monitor if the LogStreamName already exists for any configuration. However for backwards compatibility, a library log will still get logged if that's the case beyond LogStreamName.

Setting a LogStreamName is unusuable after the first run of the logger, hence this PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

normj commented 4 months ago

Thanks for the PR. I'll make sure we get this PR released quickly.

normj commented 4 months ago

Thanks again for the PR and letting us know about the issue. The PR has been released in the latest versions of the logging packages.

michaeldimoudis commented 4 months ago

Awesome thanks for the quick release @normj 😀