-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix handling of logger calls in lib/private/Log.php #40844
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
Conversation
dea6860
to
40ae632
Compare
I don't see any unit tests for |
Should we write a crash log if we can't write in the log file? Although it's a weird case that shouldn't happen, if it happens I don't think we'll notice. |
💥 Acceptance tests pipeline cliBackground-maria10.2-php7.4 failed. The build has been cancelled. |
if the logger object has no Do I just add and |
eb05455
to
dc9ac6f
Compare
We can try to throw an exception and see how it behaves. If the exception is unhandled, it should end up in the crash log (https://github.com/search?q=repo%3Aowncloud%2Fcore%20crashlog&type=code). |
dc9ac6f
to
5965fd9
Compare
I added an
If I adjust the code locally so that that happens, then I get this output:
That works for |
Kudos, SonarCloud Quality Gate passed! |
Confirmed fixed in 10.13.0-rc.1 |
Description
Try to run a background job with verbose output.
Before this PR:
Errors are logged to
owncloud.log
and the verbose output is not displayed.After this PR:
The verbose output is displayed and no errors are written to
owncloud.log
Some things pass a real
OCP\ILogger
class to the "old"lib/private/Log.php
OCP\ILogger
does not have methodswriteExtra
orwrite
, so it fails when trying to callwrite
This PR adds more logic so that it calls the
log
method if that exists.This should be backward-compatible with whatever currently calls
lib/private/Log.php
and haswriteExtra
andwrite
methods.Related Issue
I noticed this because I was looking at owncloud/files_antivirus#378
How Has This Been Tested?
See fixed command output above.
Added an acceptance test for the
background:queue:execute
command (there was not one yet)Types of changes
Checklist: