Skip to content

Enhance shutdown logs with extra details#1821

Merged
Aniruddh25 merged 5 commits intomainfrom
dev/seantleonard/exceptionlogging
Nov 6, 2023
Merged

Enhance shutdown logs with extra details#1821
Aniruddh25 merged 5 commits intomainfrom
dev/seantleonard/exceptionlogging

Conversation

@seantleonard
Copy link
Copy Markdown
Contributor

@seantleonard seantleonard commented Oct 16, 2023

Why make this change?

What is this change?

How was this tested?

  • existing test validate proper log messages are emitted.

Sample Request(s)

  • add an intentional error to the runtime config to cause config parsing to fail: set global rest path to "/ap/i"
    "rest": {
      "enabled": true,
      "path": "/ap/i",
      "request-body-strict": false
    },

Observe that failure looks like:
image

  • Start dab in a separate console window with command:
dab start -c "<config file path>"

and see failure that elaborates on Kestrel server port unable to bind:
image

…applicationshutdown trigger to stop app. Maintain reduction in dupe log events.
@Aniruddh25
Copy link
Copy Markdown
Collaborator

Adds back a pre 0.8 log message to the console

Did you mean to say pre 0.9 in the PR description above?

Copy link
Copy Markdown
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the quick fix!

@abhishekkumams
Copy link
Copy Markdown
Contributor

@seantleonard , does this also address this issue: #1777

@seantleonard
Copy link
Copy Markdown
Contributor Author

@seantleonard , does this also address this issue: #1777

No, that issue calls out specific behavior of the CLI. This affects how the engine outputs errors and doesn't change CLI return codes. Engine also will return correctly a non-zero integer if startup fails.

Copy link
Copy Markdown
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Aniruddh25 Aniruddh25 enabled auto-merge (squash) November 3, 2023 23:59
@Aniruddh25 Aniruddh25 merged commit d885e59 into main Nov 6, 2023
@Aniruddh25 Aniruddh25 deleted the dev/seantleonard/exceptionlogging branch November 6, 2023 01:08
@Aniruddh25 Aniruddh25 added the port needed Describes if port to release branch is required label Nov 13, 2023
Aniruddh25 added a commit that referenced this pull request Nov 13, 2023
## Why make this change?

- Closes #1763

## What is this change?

- [Startup.cs] Adds an explicit `StopApplication()` call
(https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.ihostapplicationlifetime.stopapplication?view=dotnet-plat-ext-6.0#microsoft-extensions-hosting-ihostapplicationlifetime-stopapplication)
which signals the app to stop, instead of raising an Application
Exception. The exception results in duplication logging of events.
- [Startup.cs] Combines the Startup/DAB engine failure logging message
to explain which log file caused the shutdown.
- [Program.cs] Explicitly catches `TaskCanceledException` which is
raised when `StopApplication()` called. In that catch block, the console
error states that the engine is unable to launch. The reasons will be
emitted in previous log events/exceptions.
- [Program.cs] Adds back a pre 0.9 log message to the console which
includes the full exception. This captures the Kestrel issue expected in
the GitHub issue raised for which this PR addresses.

## How was this tested?

- [x] existing test validate proper log messages are emitted.

## Sample Request(s)

- add an intentional error to the runtime config to cause config parsing
to fail: set global rest path to "/ap/i"
```json
    "rest": {
      "enabled": true,
      "path": "/ap/i",
      "request-body-strict": false
    },
```
Observe that failure looks like: 

![image](https://github.com/Azure/data-api-builder/assets/6414189/7995fe30-abf2-4dcf-990f-6bfb6ac595ce)


- Start dab in a separate console window with command:
```shell
dab start -c "<config file path>"
```
and see failure that elaborates on Kestrel server port unable to bind:

![image](https://github.com/Azure/data-api-builder/assets/6414189/7f5a497c-5071-4387-aaa7-d13c4107704c)

Co-authored-by: Aniruddh Munde <[email protected]>
Aniruddh25 added a commit that referenced this pull request Nov 13, 2023
## Why make this change?

This is simply cherry-picking the following PRs before creating the next
stable 0.9 version:

- #1876
- #1821 
- #1854 
- #1851 
- #1872 
- #1868

---------

Co-authored-by: Sean Leonard <[email protected]>
Co-authored-by: Abhishek  Kumar <[email protected]>
Co-authored-by: neeraj-sharma2592 <[email protected]>
Co-authored-by: Neeraj Sharma (from Dev Box) <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port needed Describes if port to release branch is required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Exception not reported in 0.9.5-rc

4 participants