-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conditional logging #15965
Conditional logging #15965
Conversation
|
I used the internal |
Awesome stuff, logfiles often are so big and this really helps |
nice idea 👍 |
753c2db
to
023734c
Compare
rebased after merge of #15958 |
@MorrisJobke unit tests are broken
|
023734c
to
0ad6ba7
Compare
I added a unit test for the app condition. |
@LukasReschke @nickvergessen @rullzer @Xenopathic Do you want to review? |
"want" |
* debug specific requests, users or apps | ||
* | ||
* Supported conditions: | ||
* - ``secret``: if a request parameter with the name `log_secret` is set to |
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.
shared_secret
?
* remove duplicate code from child classes
0ad6ba7
to
0d3fea2
Compare
Do we want to use a header or not? |
BTW: all the other comments are addressed. |
* Defaults to an empty array. | ||
*/ | ||
'log.condition' => [ | ||
'secret' => '57b58edb6637fe3059b3595cf9c41b9', |
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.
Erm? 🙈
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.
Now doc and content is not the same anymore 🙈
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.
Oh ... forgot that one
* Log condition for log level increase based on conditions. Once one of these conditions is met, the required log level is set to debug. This allows to debug specific requests, users or apps * Supported conditions (setting `log_condition` in `config.php`): - `shared_secret`: if a request parameter with the name `log_secret` is set to this value the condition is met - `users`: if the current request is done by one of the specified users, this condition is met - `apps`: if the log message is invoked by one of the specified apps, this condition is met * fix unit test and add app log condition test
0d3fea2
to
e79c255
Compare
A new inspection was created. |
Refer to this link for build results (access rights to CI server needed): |
@LukasReschke @nickvergessen @rullzer @Xenopathic Ready for review :) |
Working very nice! As mentioned on IRC the call_user_func stuff makes me cry. But also that should be addressed in another PR. 👍 ! |
@@ -39,10 +39,7 @@ public static function init() { | |||
* @param int $level | |||
*/ | |||
public static function write($app, $message, $level) { | |||
$minLevel = min(OC_Config::getValue("loglevel", OC_Log::WARN), OC_Log::ERROR); | |||
if ($level >= $minLevel) { |
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.
why was this removed? @MorrisJobke THX
👍 |
Conditional logging
Log condition for log level increase based on conditions. Once one of these conditions is met, the required log level is set to debug. This allows to debug specific requests, users or apps
Supported conditions (setting
log_condition
inconfig.php
):-
secret
: if a request parameter with the namelog_secret
is set to this value the condition is met-
users
: if the current request is done by one of the specified users, this condition is met-
apps
: if the log message is invoked by one of the specified apps, this condition is metThis would be really helpful to debug bigger installations where enabling a higher log level isn't a option because of the huge amount of log messages. cc @felixboehm @butonic
cc @nickvergessen @PVince81 @rullzer @Xenopathic @Raydiation @DeepDiver1975