-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Constrain APOLLO_ROUTER_LOG and --log global levels to the router (#3477
) It would be nice if users could specify just a log level and the router applied the required filtering to constrain the logging to the `apollo_router` module. It would also be nice if, for advanced users, you could exercise the full power of a logging filter. This PR enables both these use cases. If you set a filter using `RUST_LOG`, it is used as is. If you set it using `APOLLO_ROUTER_LOG` or `--log`, then any "global" scope levels are constrained to `apollo_router`. Thus: ``` RUST_LOG=apollo_router=warn --log warn APOLLO_ROUTER_LOG=warn ``` are equivalent with all three statements resulting in `warn` level logging for the router. For more details, read the logging configuration documentation. fixes: #3474 <!-- start metadata --> **Checklist** Complete the checklist (and note appropriate exceptions) before a final PR is raised. - [ ] Changes are compatible[^1] - [x] Documentation[^2] completed - [ ] Performance impact assessed and acceptable - Tests added and passing[^3] - [x] Unit Tests - [ ] Integration Tests - [ ] Manual Tests **Exceptions** *Note any exceptions here* **Notes** [^1]. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]. Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]. Tick whichever testing boxes are applicable. If you are adding Manual Tests: - please document the manual testing (extensively) in the Exceptions. - please raise a separate issue to automate the test and label it (or ask for it to be labeled) as `manual test` --------- Co-authored-by: Bryn Cooke <BrynCooke@gmail.com>
- Loading branch information
Showing
3 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### Constrain APOLLO_ROUTER_LOG and --log global levels to the router ([Issue #3474](https://github.com/apollographql/router/issues/3474)) | ||
|
||
`APOLLO_ROUTER_LOG` and `--log` now implicitly set a filter constraining the logging to the `apollo_router` module, simplifying the debugging experience for users. | ||
|
||
For advanced users `RUST_LOG` can be used for standard log filter behavior. | ||
|
||
Thus: | ||
|
||
``` | ||
RUST_LOG=apollo_router=warn | ||
--log warn | ||
APOLLO_ROUTER_LOG=warn | ||
``` | ||
|
||
are equivalent with all three statements resulting in `warn` level logging for the router. | ||
|
||
For more details, read the logging configuration documentation. | ||
|
||
By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/3477 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters