Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use the custom Logger when explicitely running a build task #448

Conversation

maxime-rainville
Copy link
Contributor

@maxime-rainville maxime-rainville commented Mar 9, 2022

The logger is echoing build info statement when building the schema on-demand

Parent issues

@maxime-rainville maxime-rainville changed the title Only use the custom Logger when explicitely running a build task WIP Only use the custom Logger when explicitely running a build task Mar 9, 2022
_config/dev.yml Outdated Show resolved Hide resolved
_config/logging.yml Show resolved Hide resolved
@@ -42,15 +44,8 @@ public function build(HTTPRequest $request)
echo "<div class=\"build\">";
}
$clear = true;
$verbosity = strtoupper($request->getVar('verbosity') ?? 'INFO');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to remove the verbosity because the default logger doesn't support this. Since the scope where Logger is used has been substantially curtail by this PR, this seems reasonable.

Copy link
Member

Choose a reason for hiding this comment

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

Verbosity is currently explicitly mentioned in the docs as something that can be controlled, so I think that section in the docs needs to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a related PR to fix the doc silverstripe/silverstripe-framework#10279

src/Dev/Clear.php Outdated Show resolved Hide resolved
src/Dev/DevelopmentAdmin.php Show resolved Hide resolved
src/Extensions/DevBuildExtension.php Outdated Show resolved Hide resolved
src/Schema/BulkLoader/BulkLoaderSet.php Show resolved Hide resolved
src/Schema/Schema.php Show resolved Hide resolved
src/Schema/Storage/CodeGenerationStore.php Show resolved Hide resolved
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Looks good

src/Dev/Clear.php Outdated Show resolved Hide resolved
src/Dev/Clear.php Outdated Show resolved Hide resolved
@maxime-rainville maxime-rainville changed the title WIP Only use the custom Logger when explicitely running a build task Only use the custom Logger when explicitely running a build task Apr 11, 2022
@GuySartorelli
Copy link
Member

Lots of deprecation warnings in the PHP8.0 travis run

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

I think I probably need a bit more context around what this is trying to solve? It's not super clear to me what the problem is and therefore I can't properly judge if this approach a) is appropriate and b) actually does what it needs to do.

_config/logging.yml Outdated Show resolved Hide resolved
src/Dev/DevelopmentAdmin.php Show resolved Hide resolved
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
@maxime-rainville
Copy link
Contributor Author

Answered everyone's feedback.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Tested locally in both dev and live modes, looks good to me.
Logging during dev/build and dev/graphql/build both with CLI and in browser works the same as it did before the PR.
Logging during a schema build on first request used to output the logs into the HTTP response which caused errors on the front-end - now logs using the Psr\Log\LoggerInterface.errorhandler logger defined in Framework instead.

@GuySartorelli GuySartorelli linked an issue Apr 12, 2022 that may be closed by this pull request
1 task
@GuySartorelli
Copy link
Member

GuySartorelli commented Apr 12, 2022

@maxime-rainville Do you think it might be worth writing a test to ensure the logged output doesn't sneak into http responses on on-demand builds?

@maxime-rainville
Copy link
Contributor Author

I think it's a bit too meta to test. To test that properly I would need something that nukes the GraphQL folder and rerun a request ... the logging is just as likely to break because it gets captured by PHPUnit instead of being captured in the response.

@maxime-rainville maxime-rainville merged commit 969307e into silverstripe:master Apr 19, 2022
@maxime-rainville maxime-rainville deleted the pulls/master/clean-out-logging branch April 19, 2022 03:30
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.

Logging warning in "ondemand" GraphQL v4 schema build
3 participants