-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add conditional smb trace logging for debug purposes #25758
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
|
@butonic, thanks for your PR! By analyzing the annotation information on this pull request, we identified @icewind1991, @blizzz, @jvillafanez and @Xenopathic to be potential reviewers |
| $result = true; | ||
| } catch (ConnectException $e) { | ||
| throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); | ||
| throw $this->leave(__FUNCTION__, new StorageNotAvailableException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave the throw statement as is and add the leave() call right before is like this:
$this->leave(__FUNCTION__);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, because these exceptions are sometimes swallowed, eg. by the availability wrapper: https://github.com/owncloud/core/blob/master/lib/private/Files/Storage/Wrapper/Availability.php#L53.
leave() detects an exception and also logs a stacktrace which is the most interesting thing when debugging this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then:
$e = new exception
This->leave(function, $e)
Throw $e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could do that but it only adds an unnecessary variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and adds more structure to the code. 😉
|
reviewed |
|
@jvillafanez @DeepDiver1975 thx for the quick review! I updated the PR accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also check that the 'password' key exists, so the log won't interfere with the normal flow. If somehow the 'password' key is missing, I guess the log below won't be shown and the expected exception won't be thrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty does not log a warning when an arrey key is not defined: http://stackoverflow.com/questions/20531397/workaround-for-isset-array-key-exists-and-empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine. I'd add a comment because it's confusing for me: I'd expect the code to explode trying to access to a missing index.
If there are no more pending changes let's go with this as it is. Don't bother to add a new commit just for adding a comment 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty() works fine for unset keys however there is kind of a false positive when checking with empty(): it will return true when checking an array key that has been set to 0 or "0". But I can live with that.
|
reviews are in. give me your 👍 pls |
|
👍 |
|
made @DeepDiver1975 happy, lets see if jenkins is still happy |
|
needs backport to 9.1 and 9.0 |
|
@butonic scrutinizer is reporting 24 new issues - mind taking a look? THX |
|
I'll kick jenkins |
|
Scrutinizer does not know where to find the used exceptions. Dunno why he finds those problems now ... not an issue IMO. |
|
👍 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
To debug windows network drive issues we need traces. Unfortunately, installing xdebug is not always an option. being able to swith it on via a command line switch is a big win. We did it for 8.2 while debugging a problem. This PR brings the logging part to master.
The
leave()andswallow()could be pulled up to the Common Storage or moved to the ILogger api. For now, having it in smb should suffice. We can move it to core if it turns out useful in other places.cc @felixboehm @DeepDiver1975