Commit Graph

69 Commits

Author SHA1 Message Date
Joas Schilling
aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +01:00
Joas Schilling
a5684ea3d2
fix(log): Log exception class when message is empty
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-11-13 12:45:35 +01:00
Robin Appelman
61167e3149
Add optional to add backtrace to log items
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-07-10 15:27:31 +02:00
Côme Chilliet
8ed6086a82
Fix user log.condition feature
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-06-26 10:07:22 +02:00
Robin Appelman
d9fa7b1e28
emit an event when a message is logged
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-06-13 18:45:48 +02:00
Robin Appelman
9f1d497a0b
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in  lib/private to improve code readability.
2023-06-01 23:10:00 +02:00
Robin Windey
1dcc8559cf
Log to error_log in fatal case
Signed-off-by: Robin Windey <ro.windey@gmail.com>
2023-05-23 17:11:52 +02:00
Faraz Samapoor
e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +03:30
Côme Chilliet
f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +01:00
Julius Härtl
cf1bd0eb70
chore: Add typings to Log properties
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-01-16 09:47:31 +01:00
Julius Härtl
00b7575c89
perf(logging): Return early when log level does not match before serializing an exception
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-01-16 09:47:31 +01:00
Arthur Schiwon
2a6f46e689
allow apps to specify methods carrying sensitive parameters
… in order to remove them from logging.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-07-28 23:30:17 +02:00
Thomas Citharel
1e7d924c61
Fix logging data context to file
It was only logged when an exception was provided or when using
logData (which is not being much used).

We make sure the interpolated parameters are not logged.

Only tested with file write logger, but shouldn't work differently.

Crash reporters always had the context.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-05-02 19:29:35 +02:00
Robin Appelman
74f64fa3eb
don't error if we can't load the ExceptionSerializer for early exceptions
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-14 17:12:53 +01:00
Julius Härtl
0f33453610
Diagnostics event logging to Nextcloud log
Signed-off-by: Julius Härtl <jus@bitgrid.net>

Add config samples

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-02-28 11:24:40 +01:00
Christoph Wurst
311b3ffa2e
Interpolate the log message also for logged exceptions
According to PSR-3 the log message can have placeholders that are
replaced from the context object. Our logger implementation did that for
all PSR-3 logger methods. The only exception was our custom `logException`.

Since PsrLoggerAdapter calls logException when an exception key is
present in the context object, log messages were no longer interpolated.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-29 14:29:35 +01:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Roeland Jago Douma
179de95f81
Avoid huge exception argument logging
In some cases it might happen that you have an argument that deep down
somewhere has an array with a lot of entries (think thousands). Now
before we would just happily print them all. Which would fill the log.

Now it will just print the first 5. And add a line that there are N
more.

If you are on debug level we will still print them all.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-12-29 10:50:53 +01:00
Christoph Wurst
244c53dea1
Replace abandoned log normalizer with our fork
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-03 09:44:25 +01:00
Christoph Wurst
caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Arthur Schiwon
e008444887
always require a message paramter for data logging
also ensure it plays well with current log reader

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-01-28 13:00:13 +01:00
Arthur Schiwon
46aaeb4561
log Flow activity
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-01-28 10:58:57 +01:00
Christoph Wurst
5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma
68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Julius Härtl
0a4dd3605b
Do not escape slashes for logged exceptions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-10-15 16:09:23 +02:00
Robin Appelman
2943c18548
catch exceptions that occur during logging
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-19 13:39:40 +02:00
Christoph Wurst
d3a244f9d9
Allow crash reporters to catpture any message
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-05-09 14:06:44 +02:00
Christoph Wurst
ff58732c0d
Add breadcrumb support to crash reporters
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2018-09-05 20:58:39 +02:00
Roeland Jago Douma
8cdd134e7e
Fetch logcondition earlier
Fixes #9693

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-30 14:57:19 +02:00
Roeland Jago Douma
a52d206684
Make sure the log doesn't try to read from PUT if it can't
If a PUT request comes in that is not JSON or from encoded. Then we can
only read it (exactly) once. If that is the case we must assume no
shared secret is set.

If we don't then we either are the first to read it, thus causing the
real read of the data to fail.

Or we are later and then it throws an exception (also failing the
request).

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-30 20:18:19 +02:00
Arthur Schiwon
0e6a317516
revert Log's dependency to SystemConfig to work during Installation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 12:10:53 +02:00
Arthur Schiwon
69592408c4
move IFileBased to public namespace, logreader needs it
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 12:10:52 +02:00
Arthur Schiwon
cfc3ab0119
offer API to create own File log. admin_audit makes use of it
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 12:10:52 +02:00
Arthur Schiwon
5fbf184134
destaticfy Log classes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 12:00:06 +02:00
Arthur Schiwon
38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 10:45:52 +02:00
Robin Appelman
f399e1591f
Log classnames of arguments in exception trace
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-17 13:46:36 +02:00
Robin Appelman
96f14a2e90 log previous exception
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-11 14:35:08 +02:00
Robin Appelman
15815c034f adjust tests to new exception log format
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-11 11:46:36 +02:00
Robin Appelman
b9583c6dce Log exceptions as nested array instead of encoded json
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-10 15:53:43 +02:00
Roeland Jago Douma
6994bce951
Loglevel is an int
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-02-27 10:45:35 +01:00
Roeland Jago Douma
83eb548d23
Typehint Throwable
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-02-27 10:43:34 +01:00
Roeland Jago Douma
4077f16aec
Make ILogger strict
* Make implementations strict
* Add scalar typehints

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-02-27 10:41:46 +01:00
Morris Jobke
132764bff5
Pass log level to log reporters
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-27 16:46:47 +01:00
Christoph Wurst
ad757805ca Pass the exception context to the crash reporter
This should allow better reports as often the app id is passed
as context. While this is not used right now, I'd like to have this
for NC13 as adding it later will break the interface for existing apps

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2017-11-14 14:28:04 +01:00
Christoph Wurst
4c5593998a Add a mechanism to register crach reporters
This adds a crash reporter registry, which is meant for third party apps
to hook into the error logging/reporting chain. This way, external tools
like Sentry can be used to track and aggregate system crashes.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2017-11-14 12:20:05 +01:00
Morris Jobke
0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Johannes Schlichenmaier
4ae7275aeb Added additional methods for removal of sensitive info
Signed-off-by: Johannes Schlichenmaier <johannes@schlichenmaier.info>
2017-10-27 10:36:58 +02:00
Morris Jobke
11c31e94fe
Improve exception handling
If there is an exception in the template handling then a white page is shown.
This improves the handling of this and shows text only about the internal
error.

To test this just setup redis as cache and then disable the php-redis module.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-09-26 13:54:51 +02:00
Joas Schilling
b68609d0cf
Don't log LDAP password when server is not available
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-09-06 16:38:55 +02:00
Joas Schilling
b27819785e
Don't log passwords on dav exceptions
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-06-29 17:20:10 +02:00