[TYPO3-core] Strategy for deprecation log

Markus Klein klein.t3 at mfc-linz.at
Mon Apr 1 13:39:08 CEST 2013



Hi,

a lot of people complain about huge deprecation log files with a high percentage of duplicate entries.

ATM there's a patch pending in gerrit which filters duplicates in the deprecation log [1] to reduce size of these files.

What the patch does:
* create a unique token for the incoming deprecation log message
* load the complete log file,
* test line by line if token already exists
* append new line if not existing

Drawbacks of this approach:
* bad performance
> Do you have numbers how bad this really is? IMO it is not so bad, because the file is rather small now.

* permanently monitoring the deprecation log by running "tail -f" on the cli won't work for duplicates
> True, but I personally have no usecase for "tail -f". Could you elaborate on how you use this?

Better solution:
IMO we should use the Logging API for writing deprecation log messages.
This would give users more control over deprecation log strategy.
> +1

The general approach would be to replace the implementation of
GeneralUtility::deprecationLog() with:

  $logger =
self::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger('deprecation');
  $logger->warning($msg);

In the most simple case, we'd have a FileWriter configured which simply writes to typo3temp/logs/deprecation.log This would be a plain replacement for the 'file' part in GeneralUtility::deprecationLog()

To filter duplicates we could add a dedicated DeprecationWriter, which
1) receives all deprecation messages,
2) optionally checks for duplicates using the sys_registry
> IMHO a NO GO. Please don't use any database stuff in deprecation handling.
3) writes the log record to the configured target writers.

I already have a prove of concept for this. [2]

If you have ideas for more fancy stuff in step 2) - then go ahead and share.

Questions I have:
* How to flush the registry from the backend?
* Should we filter duplicates be default?
* How to migrate the old configuration from $TYPO3_CONF_VARS['SYS']['enableDeprecationLog']?
* What is your workflow with deprecation log? (when working on core or
extensions)



[1] https://review.typo3.org/#/c/19251/
[2] https://gist.github.com/t3node/5282732

--
cheers,
Steffen

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node _______________________________________________
Before posting to this list, please have a look to the posting rules on the following websites:

http://typo3.org/teams/core/core-mailinglist-rules/
http://typo3.org/development/bug-fixing/diff-and-patch/
_______________________________________________
TYPO3-team-core mailing list
TYPO3-team-core at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-core



More information about the TYPO3-team-core mailing list