Bug #90250

Make it possible to entirely turn off deprecation logging via configuration in TYPO3 9.x

Added by Sybille Peters 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2020-01-29
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
logging, deprecation
Complexity:
Is Regression:
Sprint Focus:

Description

GeneralUtility::deprecationLog() in 9.5 writes deprecation logs to deprecation file which you can't turn off

(1)

public static function deprecationLog($msg)
    {
        static::writeDeprecationLogFileEntry('GeneralUtility::deprecationLog() will be removed in TYPO3 v10.0, use "trigger_error("Given reason", E_USER_DEPRECATED);" to log deprecations.');
        trigger_error($msg, E_USER_DEPRECATED);
    }

I don't understand why this function does both: use trigger_error and writeDeprecationLogFileEntry. One would be enough, I guess.

Also, writeDeprecationLogFileEntry() writes directly to a logfile which you can't deactivate - AFAICS.

$destination = Environment::getVarPath() . '/log/deprecation_' . self::shortMD5(Environment::getProjectPath() . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . '.log';

Some extensions use GeneralUtility::deprecationLog()

(2)

You can turn off (some) deprecation logging via the logging framework (I think)


Related issues

Related to TYPO3 Core - Bug #87960: No way to disable deprecation message logged to file Closed 2019-03-20
Related to TYPO3 Core - Bug #91226: Fix wrong deprecation log calls Closed 2020-04-28

Associated revisions

Revision 1fa44d38 (diff)
Added by Sybille Peters 6 months ago

[BUGFIX] No longer use deprecated function writeDeprecationLogFileEntry

The function writeDeprecationLogFileEntry has been deprecated
in TYPO3 9.

When a deprecated function is called, we now use trigger_error()
using E_USER_DEPRECATED to warn about deprecated functionality.

Not only is writeDeprecationLogFileEntry() deprecated, but calling
this function resulted in the deprecation being logged to the static
file var/log/deprecation_*.log. This logging is not configurable.

Resolves: #90250
Releases: 9.5
Change-Id: I60e4c06f48c7917e7797ed95914e82a055c48d59
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63071
Tested-by: TYPO3com <>
Tested-by: Jonas Eberle <>
Tested-by: Josef Glatz <>
Tested-by: Benni Mack <>
Reviewed-by: Jonas Eberle <>
Reviewed-by: Johannes Seipelt <>
Reviewed-by: Josef Glatz <>
Reviewed-by: Benni Mack <>

Revision 0de69760 (diff)
Added by Markus Klein 6 months ago

[BUGFIX] Correctly use trigger_error for deprecations

With ticket #90250 a few trigger_error() calls have
been introduced, which lack the second parameter
E_USER_DEPRECATED.

Resolves: #91226
Related: #90250
Releases: 9.5
Change-Id: I04d7b0e184bbd85c318f2c200af79da02facba2d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64340
Tested-by: TYPO3com <>
Tested-by: Josef Glatz <>
Tested-by: Benni Mack <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Josef Glatz <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Sybille Peters 9 months ago

Ok, I understand, there are 2 deprecations. The original deprecation that was being logged via deprecationLog and the new deprecation log about using deprecationLog() (with the also deprecated writeDeprecationLogFileEntry).

Maybe trigger_error can be used for both?

#2 Updated by Sybille Peters 9 months ago

  • Tracker changed from Bug to Task

#3 Updated by Sybille Peters 9 months ago

  • Tracker changed from Task to Bug

#4 Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63071

#5 Updated by Sybille Peters 9 months ago

  • Tags set to logging, deprecation

#6 Updated by Sybille Peters 9 months ago

  • Related to Bug #87960: No way to disable deprecation message logged to file added

#7 Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63828

#8 Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63071

#9 Updated by Sybille Peters 7 months ago

  • Description updated (diff)

#10 Updated by Sybille Peters 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#11 Updated by Markus Klein 6 months ago

  • Related to Bug #91226: Fix wrong deprecation log calls added

#12 Updated by Benni Mack 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF