Skip to content

Remove duplicate exception logged to console during startup failure.#1664

Merged
seantleonard merged 4 commits intomainfrom
dev/seantleonard/structuredLogging_ServiceConfig
Sep 18, 2023
Merged

Remove duplicate exception logged to console during startup failure.#1664
seantleonard merged 4 commits intomainfrom
dev/seantleonard/structuredLogging_ServiceConfig

Conversation

@seantleonard
Copy link
Copy Markdown
Contributor

Why make this change?

-Work done as part of structured logging overhaul. #1517

What is this change?

  • Removes one instance where an exception is logged twice:
  1. once automatically by dotnet
  2. second when we manually include the exception message/stacktrace in exception handling. [Remove this instance]

-Adds named parameters in ilogger call while making message generation for the console more concise. ILogger logError() and other ilogger calls allow you to include a parameter for the exception. That is logged automatically in ilogger so we don't have to additionally log the exception message in the logger message manually.

How was this tested?

manual testing:
before:
DupeExceptionLoggingStartup

after:
NoDupeExceptionLoggingStartup

Sample Request(s)

  • put a bad entity rest path (all else okay) to trigger startup failure. i.e. "path": " /pathName"

…uring startup failure to make it easier to parse console messaging.
@abhishekkumams
Copy link
Copy Markdown
Contributor

Can you check if it works for cases where exception is thrown outside Program.cs,

image

To reproduce:

  1. Start the engine with table1 configured in your db and exposed in config file.
  2. now drop that table, and make a query on it.

@seantleonard seantleonard added this to the 0.10rc milestone Sep 6, 2023
@seantleonard seantleonard enabled auto-merge (squash) September 18, 2023 16:22
@seantleonard seantleonard merged commit ef942f6 into main Sep 18, 2023
@seantleonard seantleonard deleted the dev/seantleonard/structuredLogging_ServiceConfig branch September 18, 2023 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants