Commit Graph

103 Commits

Author SHA1 Message Date
Pierre Goiffon
52820925b1 N°4725 DeprecatedCallsLog::NotifyDeprecatedFile remove throw ConfigException
Those exceptions are handled silently since 3.0.1
2023-06-14 19:01:50 +02:00
Pierre Goiffon
1884596ecd N°6274 Fix log.class.inc.php crashing cause cannot load ItopTestCase class
Now the constant name is defined in approot
2023-05-04 17:34:14 +02:00
Pierre Goiffon
584cfa8cbf N°6274 Fix PHP Notices not caught in ItopDataTestCase PHPUnit
This was caused by the set_error_handler() done in DeprecatedCallsLog during startup

Now we are :
* not registering the handler if a PHPUnit test is running (based on a constant set in ItopTestCase::setUp)
* on registration only do it for the required notices
2023-05-04 17:08:47 +02:00
Pierre Goiffon
740ff8c649 💡 DeprecatedCallsLog phpdoc 2023-04-21 14:58:00 +02:00
Pierre Goiffon
4c626d0782 Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/log.class.inc.php
2023-04-12 10:22:34 +02:00
Pierre Goiffon
1114ed9562 N°6099 DeadLockLog : improve documentation and use existing constants (#441) 2023-04-12 10:21:34 +02:00
Pierre Goiffon
d40cf7fe3b ReOrder LogChannels const 2023-02-23 11:52:19 +01:00
Pierre Goiffon
6997c0fd83 Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/log.class.inc.php
2023-02-23 11:47:49 +01:00
Pierre Goiffon
822922df5c N°5588 - Improve PDF export robustness when AttributeImage dimensions cannot be determined (#350)
Can happen for example on SVG images
Now the export won't crash anymore, and we'll get a log (export channel, warning level) with  the object and attribute causing a problem as context

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2023-02-23 11:45:29 +01:00
Molkobain
3459dc5997 N°5897 - Improve deprecated logs relevance for PHP "trigger_deprecation" 2023-01-17 16:29:25 +01:00
Pierre Goiffon
de7c9d965e 💡 PHPDoc in \DeprecatedCallsLog 2023-01-17 15:37:23 +01:00
Pierre Goiffon
34f03715b6 LogChannel : add missing @since 2022-11-24 17:27:30 +01:00
Eric Espie
104beff158 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Fix log 2022-06-29 15:09:17 +02:00
Benjamin Dalsass
f014ebfeb1 Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/log.class.inc.php
#	setup/modelfactory.class.inc.php
2022-06-08 13:04:50 +02:00
Pierre Goiffon
3ea82e37d5 N°4635 Report \LogChannels::NOTIFICATIONS 2022-06-03 18:00:29 +02:00
Pierre Goiffon
b3ef9333af 💡 Added since annotation to \LogAPI::IsLogLevelEnabled 2022-05-03 17:18:07 +02:00
Molkobain
0f2cbaf186 N°4849 - Enable notification emails grouping in threads in email clients (#275)
N°4849 - Enable notification emails grouping in threads in email clients (#275)
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2022-03-10 09:31:29 +01:00
Molkobain
6a4ce3c3b1 Fix regression from c3a2713bb 2022-02-02 10:54:01 +01:00
Pierre Goiffon
c3a2713bba N°4725 Fix \DeprecatedCallsLog::NotifyDeprecatedFile doesn't catch ConfigException 2022-01-27 09:25:28 +01:00
Pierre Goiffon
9493e31a5d 💡 N°4558 Add PHPDoc to document that\LogChannels::CMDB_SOURCE constant was added in 3.0.0 2022-01-10 17:11:13 +01:00
Pierre Goiffon
92b61c7491 N°4558 Rename \LogChannels::CMDBSOURCE to CMDB_SOURCE to match existing constant in support/3.0 branch 2022-01-10 17:09:43 +01:00
Pierre Goiffon
8578d18e7f Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/cmdbsource.class.inc.php
#	core/config.class.inc.php
#	core/displayablegraph.class.inc.php
#	core/log.class.inc.php
#	datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php
#	datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php
#	datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php
#	datamodels/2.x/itop-tickets/tr.dict.itop-tickets.php
#	datamodels/2.x/itop-welcome-itil/tr.dict.itop-welcome-itil.php
#	dictionaries/tr.dictionary.itop.core.php
#	dictionaries/tr.dictionary.itop.ui.php
#	pages/UI.php
#	setup/itopdesignformat.class.inc.php
#	test/core/LogAPITest.php
#	test/integration/iTopModulesPhpVersionChecklistTest.php
#	test/postbuild_integration/SetupCssIntegrityChecklistTest.php
#	test/postbuild_integration/iTopModuleXmlInstallationChecklistTest.php
#	test/status/StatusTest.php
2022-01-10 16:15:00 +01:00
Pierre Goiffon
f9359431fe 💡 N°4558 Add PHPDoc 2022-01-03 12:21:55 +01:00
Pierre Goiffon
25e560fdaa N°4558 Fix possible PHP notice in \CMDBSource::StartTransaction 2021-12-31 16:34:19 +01:00
Pierre Goiffon
c9ef543e2e Merge remote-tracking branch 'origin/support/2.7' into develop
# Conflicts:
#	core/log.class.inc.php
#	datamodels/2.x/itop-attachments/renderers.itop-attachments.php
#	js/search/search_form_criteria_enum.js
#	lib/composer/autoload_classmap.php
#	lib/composer/autoload_static.php
#	test/core/dictTest.php
2021-12-08 18:30:20 +01:00
odain
3511867ba3 N°4125 - use Error log level + apc dedicated log channel 2021-11-26 17:07:20 +01:00
Eric Espie
fac454595a removing meaningless information 2021-10-22 10:10:14 +02:00
bruno-ds
9e1f5a1b63 N°4261 - ExceptionLog restore Portal log level to Error as for iTop 2.7 (no more BC break)
- default level is now Error,
 - for "write in DB": each level (including error) are ignored by default
2021-10-21 16:18:27 +02:00
bruno-ds
5e2f8a4ea6 N°4261 - ExceptionLog: improve readability 2021-10-21 11:07:44 +02:00
bruno-ds
62f7eca0a8 N°4261 - Log in db: change default level.
In order to preserve the existing behavior: not EventIssue creation (unless configured otherwise).
2021-10-21 11:07:44 +02:00
Pierre Goiffon
0e14be8b15 N°4261 Refactor ExceptionLog (#239)
Doing a code review with Bruno, we agreed to do some little refactoring :

* Level per exception class
  - Before the whole ExceptionLog::Log method was a total rewrite of its parent, with some code duplicates... not a good idea : we should better improve LogAPI to make other similar uses possible in the future !
  - The logic to get level from config must be in a GetMinLogLevel override
* Write to DB
  - Pull up this functionnality in LogAPI
  - Add a sCode parameter in GetLevelDefault

Doing this refactoring, I also improved :

* Test the attributes set when creating the EventIssue object : during my dev I had crashes because I didn't filled all the mandatory fields... Having a PHPUnit test checking this will prevent future bugs to happen if attributes are modified in the class or in the object creation method
* Use Throwable instead of Exception : this was added in PHP 7.0 and will allow to catch both Exception and Error
* Because we need to have 2 statements on the same line in \Combodo\iTop\Test\UnitTest\Core\Log\ExceptionLogTest::testLogInFile, I modified the editorConfig file to allow disabling the formatter using comments.
2021-10-20 16:01:08 +02:00
Pierre Goiffon
ef6d7925fc Log : always log the same structure, and add a delimiter at the end
This will allow to parse the logs more easily !
2021-10-20 15:16:57 +02:00
Pierre Goiffon
c3d23981fb 💡 Document limitation in \LogAPI::GetConfig 2021-09-30 14:45:06 +02:00
acognet
e97a266c44 N°3946 - LogAPI : log config parameters aren't used when logging in the setup wizard context 2021-09-23 09:19:54 +02:00
bruno-ds
c306c6e30d N°4261 - code review with @PirGoif 2021-09-21 16:38:10 +02:00
Pierre Goiffon
f0aaf21a79 💚 N°3002 Fix php-mock-objects notices
The error handler now checks if logger is enabled before doing anything
2021-09-21 12:01:42 +02:00
Molkobain
96e4ef68df Code conventions 2021-09-21 09:38:01 +02:00
bruno-ds
daf24d8cb3 N°4261 - implement feedbacks from the team
plus:
 - the entrypoint is now `LogException()` instead of `FromException()` which sounded more like a factory and less like an active method.
 - merge conflicting commit with @molkobain (CC fix)
 - remove the writing of the exception object in the error.log context (adding it was an error, it's way too verbose!!).
   - Technical note: The context is still used to propagate the exception across several call stack, so it now uses a less generic naming in order to avoid conflicts (see `ExceptionLog::CONTEXT_EXCEPTION`). another solution would have been to add a new parameter to `ExceptionLog::Log()`, but I didn't want to add constraint over the hypothetical evolution of the base class method.
2021-09-20 12:27:39 +02:00
bruno-ds
6e0d570d41 N°4261 - Portal exception logging: Add exception's file and line to the context.
plus:
 - the exception object is no more automatically added to the error.log context (it's way too verbose)
 - code cleanup (use constant instead of repeated strings)
 - ExceptionLog main method is now named `LogException` instead of `FromException`
2021-09-20 12:27:39 +02:00
Molkobain
6271a33fdb Code review: Fix code conventions 2021-09-16 14:53:40 +02:00
bruno-ds
d1721b0834 N°4261 -Fix CI
Try to repair an odd error in the CI:
> Fatal error: Uncaught Exception: Serialization of 'ReflectionClass' is not allowed

avoid instantiation in the provider, delay them to the actual test
2021-09-15 14:39:00 +02:00
bruno-ds
5d23a250ae N°4261 - New log handler dedicated to Exceptions & use of it in the portal's Exception listener
Such Exceptions are triggered with a Warning level and default the minimum default level in order to write in DB is above, so the behavior is not modified:
 - logs are written in errors.log (with a warning elvel instead of an error)
 - logs are not written in DB unless `log_level_min.write_in_db` is changed
2021-09-14 17:40:11 +02:00
Pierre Goiffon
d0ba84068d N°3002 Better log deprecated call location
Now logs file location when called by a function
2021-08-30 16:43:30 +02:00
Pierre Goiffon
d6d1a5cc23 N°3002 Fix undefined index notice in \DeprecatedCallsLog::DeprecatedNoticesErrorHandler 2021-08-30 15:58:55 +02:00
Molkobain
c475e66176 Add documentation 2021-08-12 09:35:14 +02:00
Pierre Goiffon
a742b6c610 🔊 N°3002 DeprecatedCallsLog error handler : add trigger_error message 2021-08-09 09:06:17 +02:00
Pierre Goiffon
72e628c5d5 💡 Reference in PHPDoc for \LogAPI::GetMinLogLevel 2021-08-06 17:39:34 +02:00
Pierre Goiffon
bf28602ae6 💡 Improve PHPDoc for \LogAPI::GetMinLogLevel 2021-08-06 17:37:56 +02:00
Pierre Goiffon
d335736cfc 🔊 N°3002 Add trigger_error to catch deprecated notices inside DeprecatedCallsLog
They are logged as WARNING level in \DeprecatedCallsLog::ENUM_CHANNEL_PHP_LIBMETHOD channel

Such deprecated notices are generated inside Symfony for example using @trigger_error(..., E_DEPRECATED).
Having such a log will help us migrate to the next lib version !
2021-08-06 17:13:24 +02:00
Molkobain
78af6fdc84 N°3944 - Add comment to explain the 2 similar IFs 2021-08-06 11:11:57 +02:00