146 Commits

Author SHA1 Message Date
Pierre Goiffon
5db8bd06ba Merge remote-tracking branch 'origin/support/2.7' into develop
# Conflicts:
#	core/cmdbsource.class.inc.php
#	core/coreexception.class.inc.php
#	core/log.class.inc.php
2021-06-21 16:24:27 +02:00
Eric
0f5130611d Fix log API tests 2021-06-21 16:07:36 +02:00
Eric
a1271da74a N°3513 - ObjectFormManager : remove transaction 2021-06-21 15:03:17 +02:00
Pierre Goiffon
8f84c3b84b 🎨 LogAPI code formatting 2021-06-18 10:58:04 +02:00
Pierre Goiffon
d8e2a1cc7c Merge branch 'support/2.7' into develop
# Conflicts:
#	README.md
#	composer.json
#	composer.lock
#	core/cmdbsource.class.inc.php
#	core/dbobject.class.php
#	datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php
#	datamodels/2.x/combodo-db-tools/dbtools.php
#	datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php
#	datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php
#	datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php
#	dictionaries/zh_cn.dictionary.itop.core.php
#	dictionaries/zh_cn.dictionary.itop.ui.php
#	lib/composer/InstalledVersions.php
#	lib/composer/autoload_classmap.php
#	lib/composer/autoload_static.php
#	lib/composer/installed.php
#	lib/composer/platform_check.php
#	pages/ajax.render.php
#	pages/csvimport.php
#	setup/ajax.dataloader.php
#	setup/index.php
#	setup/setuputils.class.inc.php
#	test/application/UtilsTest.php
2021-06-14 16:19:56 +02:00
Pierre Goiffon
147916062b 🎨 Fix local variable names
Was copy/paste and wasn't consistent with the functionnality :/
2021-06-10 16:28:17 +02:00
Molkobain
1c2dcc7b9a Merge remote-tracking branch 'origin/support/2.7' into develop 2021-05-11 12:22:47 +02:00
Pierre Goiffon
87ba67225a 💡 Add since phpdoc tags for \DeadLockLog::Log 2021-04-16 08:36:21 +02:00
Pierre Goiffon
2ad3b3c27e 🎨 Fix \DeadLockLog::Log parameter name + PHPDoc
Thanks @Hipska !
2021-04-15 15:03:13 +02:00
Pierre Goiffon
a6d20ab648 N°3731 \DeprecatedCallsLog : always catch errors so that we won't crash the caller 2021-04-13 17:56:20 +02:00
Pierre Goiffon
7f4ef12c04 🐛 Fix \DeprecatedCallsLog::NotifyDeprecatedPhpMethod log message
This was bringed by #193
The stack trace wasn't used correctly :/ This is now fixed !

Sample message for deprecated PHP method call :
`2021-04-13 15:31:47 | Warning | Call to WebPage:outputCollapsibleSectionInit in  C:\...\itop-dev\sources\application\WebPage\AjaxPage.php#L170 (AjaxPage::output) | deprecated-php-method`

Log message for deprecated PHP file remains the same :
`2021-04-13 10:31:12 | Warning | C:\...\itop-dev\sources\application\WebPage\WebPage.php L32 including/requiring C:\...\itop-dev\core\coreexception.class.inc.php : Classes were moved to /application/exceptions | deprecated-file`
2021-04-13 15:38:38 +02:00
Pierre Goiffon
f6d9d0f08b N°3731 Log deprecated calls (#193)
* New DeprecatedCallsLog logger enabled directly in bootstrap so that we can use it in the most situations
* Default Log level is now DEBUG for dev env, ERROR for others
* Logs the caller and the deprecated method called, like :
`2021-04-06 10:52:25 | Warning | AjaxPage::output L2857 calling WebPage:outputCollapsibleSectionInit | deprecated-method`
* Sample file consumer
* Sample php consumer
2021-04-13 13:55:25 +02:00
Molkobain
8dd96ea636 Copyright year bump 2021-03-15 09:29:45 +01:00
Eric
761c2a46a3 N°3234 - Cron rework
* some timezone refactors occurred
2020-08-25 11:20:17 +02:00
Pierre Goiffon
336637a7a4 SetupLog : ease changing manually the default level
In setup no conf file available so the log_level_min config option cannot be read
A solution is to manually change this constant
2020-05-28 11:40:22 +02:00
Pierre Goiffon
0ffa2850ea Deadlock log : log inside a dedicated log file instead of creating an EventIssue object (#139)
First log implementation (75730ee) was creating EventIssue objects, and was rollbacking transaction if it exists

The new one has some benefits :

* always log one line by default in log/error.log, but details must be activated though config (channels `Deadlock-WaitTimeout` and `Deadlock-Found`)
* detailed logs are in a dedicated file (log/deadlock.log) : 
  - easier for our clients to get and share
  - has rotation by default
  - looking at the file size is a direct way to know if error happened
  - more compliant to industry standards !
* the transaction stays untouched, so that the consumer can do whatever it prefers
2020-05-14 17:49:05 +02:00
Pierre Goiffon
7ec7626aa0 N°2977 PHP Doc change 2020-05-04 18:13:40 +02:00
Pierre Goiffon
5d7582bb6f N°2977 LogAPI : restore default log level to OK, and really allow LEVEL_DEFAULT overloads
* Level was changed by mistake to trace with refactoring in 289171b9
Thanks @v-dumas !

* self wouldn't allow to override
see https://www.php.net/manual/fr/language.oop5.late-static-bindings.php
Thanks @bruno-ds !

* improve PHPDoc !
2020-05-04 16:55:46 +02:00
Pierre Goiffon
bf13f9fc8a N°2975 improve RotatingLogFileNameBuilder next cron occurrence computation 2020-04-30 08:41:55 +02:00
Pierre Goiffon
289171b9f1 N°2977 LogAPI : allow to overwrite the default log level 2020-04-29 15:16:45 +02:00
Pierre Goiffon
eadc3b72c2 📝 N°2793 log rotation add PHPDoc about timezones 2020-03-04 14:23:34 +01:00
odain
c06f8e9a98 N°2793 log rotation test : fix timezone issues 2020-03-04 12:05:42 +01:00
Pierre Goiffon
6675d7d42a N°2793 Test log rotation 2020-03-04 09:21:05 +01:00
Pierre Goiffon
29d24faf52 N°2793 Log rotation : fix no rotation :/
Was caused by erroneous file exists test
2020-03-03 10:18:09 +01:00
Pierre Goiffon
33f3f2810e N°2793 Log rotation : add file exists check in the lock 2020-03-02 18:33:00 +01:00
Pierre Goiffon
56ef6feadf N°2820 Log rotation : new MonthlyRotatingLogFileNameBuilder class 2020-03-02 15:52:59 +01:00
Pierre Goiffon
2be16f9078 N°2793 Log rotation (#117)
Now log file name is unchanged : current log is still /log/error.log \o/

Rotation check (using file last modification time) is done :
* on each file write : we don't want to miss calls if session last from 23:59:59 to 00:01 for example ! Though the filemtime() call is done once per session to lower performance impacts
* using a new background process (LogFileRotationProcess)

File renaming on setup is therefore removed.
Also the interface is renamed (from ILogFileNameBuilder to iLogFileNameBuilder) to conform to iTop convention.
2020-03-02 15:01:12 +01:00
bruno DA SILVA
c09bd2bfc6 2626 - log modularity: filterable logs using minimal log level per channel
🔊 Adding log level Trace, which is not logged by default (as for Debug)
2019-12-19 11:17:18 +01:00
Pierre Goiffon
358efb0f2f N°2518 Change log level for non existent legacy log file when trying to rename 2019-12-18 09:28:11 +01:00
bruno DA SILVA
3f154fa765 2626 - log modularity: filterable logs using minimal log level per channel
🐛 logs are no more written twice.
2019-12-17 12:33:34 +01:00
odain
abd5e27c2e fix and complete testcase 2019-12-12 14:22:49 +01:00
odain
6ec441e501 peer review: added tests but not passed yet 2019-12-12 08:43:01 +01:00
Pierre Goiffon
18db31f138 Log : rename config parameter from 'min_log_level' to 'log_level_min' 2019-12-10 09:46:42 +01:00
Pierre Goiffon
332c6eb33c log : factorize level & context 2019-12-10 09:39:46 +01:00
bruno DA SILVA
e5c49e3bd4 filterable logs using min_log_level optionnaly per channels 2019-12-10 09:03:14 +01:00
Pierre Goiffon
16c4f18a81 N°2518 fix log call is crashing when invalid log_filename_builder_impl value set in config 2019-10-22 15:15:40 +02:00
Pierre Goiffon
cd6104ddb3 N°2518 If switching to log file rotation, rename setup/error legacy files 2019-10-22 15:08:48 +02:00
Pierre Goiffon
c3915ee48e N°2518 Implementation to rotate logs on a weekly basis 2019-10-08 08:42:41 +02:00
Pierre Goiffon
21ff03e28f N°2518 Possibiliy to rotate log files based on days
See the 'log_filename_builder_impl' config parameter
2019-10-08 08:42:41 +02:00
Pierre Goiffon
2c8887398d 🎨 Log classes : PHPDoc & fix wrong self:: uses 2019-10-08 08:42:41 +02:00
Romain Quetiez
38c12104b3 N.740 Error when attempting to disable the logs. Took the opportunity to refactor, relying on late static bindings (requires PHP 5.3). The refactoring avoided the fix to be duplicated in three places.
SVN:trunk[4628]
2017-03-29 08:28:24 +00:00
Denis Flaven
fa94dd257a File-based "transactions" dans log files better protected against concurrent access...
SVN:trunk[3659]
2015-07-28 12:51:46 +00:00
Romain Quetiez
721faa7e1e Updated copyright (2012) and license (LGPL changed to AGPL)
SVN:trunk[2333]
2012-10-23 21:41:36 +00:00
Romain Quetiez
21722b9e80 Internal: added an API for logging tools events
SVN:trunk[1026]
2010-12-10 15:19:18 +00:00
Romain Quetiez
a0e0371812 #19 - Reviewed the licensing information and started to align the comments in the code
SVN:trunk[422]
2010-05-24 09:24:35 +00:00
Romain Quetiez
d527b56340 #74 Added the configuration of logging (errors, web service usage, etc.), and improved a little the error logging (both in a file and into the database + new format for additional information such as the callstack)
SVN:trunk[403]
2010-05-13 20:40:52 +00:00