Commit Graph

84 Commits (jtr/fix-public-exceptions-http-codes)

Author SHA1 Message Date
Joas Schilling 2ec7fa88cc
fix(log): Fix call to normalize function
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-10-27 16:46:10 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Joas Schilling 0ba2913a95
fix(log): Fix log level handling
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-01-27 05:05:17 +07:00
Joas Schilling 63f3309993
fix(logger): Prevent infinite recursion with log.condition => matches
When we need to check the log condition for a user matches,
there is a risk that something on the way checks the log level
and would result in an infinite loop.
So we simply check if it's a nested call and use the default
warning level in that case.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-01-03 10:04:51 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Ferdinand Thiessen 2ec68b1eb9
refactor(Log): Use new in initializer instead of constructor body
PHP 8.1 allows us to now move the `new` into the initializer,
this makes the code a bit nicer (and 3 lines shorter).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-17 18:38:28 +07:00
Joas Schilling 710a69b4b5
feat(log): Allow to combine log.conditions to only log (app&user)
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-07-30 13:18:09 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Ferdinand Thiessen e838aa9514
fix(Logger): Warn on invalid `loglevel` configuration option
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-03-17 20:20:43 +07:00
skjnldsv a47a70790c fix: getLogLevel return type
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2024-03-17 14:09:13 +07:00
Maxence Lange 618aaddff2 fix(core): remove deprecated code
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-03-12 10:19:20 +07:00
Maxence Lange 13412333e6 fix(core): minor syntax update
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-03-12 10:19:20 +07:00
Maxence Lange 2232753b99 add hasListeners()
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-02-14 14:02:28 +07:00
Maxence Lange 9a299ed60b exit log() early if no crashreporter registered
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-02-14 09:40:21 +07:00
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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07: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 +07: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 +07: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 +07: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 +07:00
Arthur Schiwon 46aaeb4561
log Flow activity
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-01-28 10:58:57 +07:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +07: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 +07: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 +07:00
Robin Appelman 2943c18548
catch exceptions that occur during logging
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-19 13:39:40 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Arthur Schiwon 5fbf184134
destaticfy Log classes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 12:00:06 +07:00
Arthur Schiwon 38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 10:45:52 +07:00