70014[FEATURE] Adopt Monolog for injected loggers.
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 23
- typo3/sysext/core/Classes/DependencyInjection/Monolog/FormatterConfig.phpnew+26 −0
- typo3/sysext/core/Classes/DependencyInjection/Monolog/HandlerConfig.phpnew+50 −0
- typo3/sysext/core/Classes/DependencyInjection/Monolog/MonologConfig.phpnew+124 −0
- typo3/sysext/core/Classes/DependencyInjection/Monolog/ProcessorConfig.phpnew+31 −0
- typo3/sysext/core/Classes/DependencyInjection/Monolog/ServiceConfig.phpnew+89 −0
- typo3/sysext/core/Classes/DependencyInjection/MonologPass.php1new+290 −0
- typo3/sysext/core/Classes/Log/Channel.phpnew+45 −0
- typo3/sysext/core/Classes/Log/DatabaseHandler.phpnew+62 −0
- typo3/sysext/core/Classes/Log/LogManager.php+18 −0
- typo3/sysext/core/Configuration/Services.php2+15 −1
- typo3/sysext/core/Configuration/Services.yaml2+12 −0
- typo3/sysext/core/Documentation/Changelog/master/Feature-94600-AdoptMonologForInjectedLoggers.rst37new+196 −0
- typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_logging/Classes/Service/LoggingExperiment.phpnew+36 −0
- typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_logging/Configuration/Services.yamlnew+8 −0
- typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_logging/ext_emconf.phpnew+22 −0
- typo3/sysext/core/Tests/Functional/Log/Writer/DatabaseHandlerTest.phpnew+65 −0
- typo3/sysext/core/Tests/Functional/Log/Writer/LoggerAutowiringTest.phpnew+41 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/MonologPassTest.phpnew+395 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/MonologServiceConfigTest.phpnew+95 −0
- typo3/sysext/core/composer.json+1 −0
Review log 3862
Show 2037 earlier messages
-
crell uploaded patch set 1 07/20/21, 20:26
-
crell marked it work in progress 07/20/21, 20:27
-
core-ci voted on patch set 1 V -1 07/20/21, 20:36 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13610
-
crell uploaded patch set 2 07/22/21, 15:40
-
core-ci voted on patch set 2 V +1 07/22/21, 15:55 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13673
-
crell marked it ready for review 07/22/21, 16:58
-
crell uploaded patch set 3 07/23/21, 15:49
-
core-ci voted on patch set 3 V -1 07/23/21, 16:01 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13696
-
crell uploaded patch set 4 07/26/21, 21:12
-
core-ci voted on patch set 4 V -1 07/26/21, 21:16 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13783
-
crell uploaded patch set 5 07/26/21, 21:36
-
core-ci voted on patch set 5 V -1 07/26/21, 21:48 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13784
-
crell uploaded patch set 6 07/26/21, 22:21
-
core-ci voted on patch set 6 V +1 07/26/21, 22:34 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13785
-
crell uploaded patch set 7 07/31/21, 00:09
-
core-ci voted on patch set 7 V -1 07/31/21, 00:12 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13938
-
crell uploaded patch set 8 08/02/21, 13:33
-
core-ci voted on patch set 8 V -1 08/02/21, 13:59 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13998
-
crell uploaded patch set 9 08/02/21, 15:53
-
core-ci voted on patch set 9 V -1 08/02/21, 16:23 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14008
-
core-ci voted on patch set 9 V +1 08/02/21, 17:11 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14008
-
Georg Ringer commented on patch set 9 08/02/21, 18:02
Feature-94600-AdoptMonologForInjectedLoggers.rst:39can we call it $dependency?Feature-94600-AdoptMonologForInjectedLoggers.rst:50should we give it the same name as in the php example? -
crell commented on patch set 9 08/02/21, 18:10
MonologHandlerDef.php:3ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:39ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:50ReplyDone -
crell uploaded patch set 10 08/02/21, 18:16
-
core-ci voted on patch set 10 V +1 08/02/21, 18:36 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14019
-
crell uploaded patch set 11 08/03/21, 21:36
-
core-ci voted on patch set 11 V -1 08/03/21, 21:55 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14064
-
crell uploaded patch set 12 08/04/21, 14:14
-
core-ci voted on patch set 12 V -1 08/04/21, 14:36 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14095
-
crell uploaded patch set 13 08/04/21, 17:05
-
core-ci voted on patch set 13 V +1 08/04/21, 17:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14100
-
crell uploaded patch set 14 08/05/21, 16:14
-
core-ci voted on patch set 14 V -1 08/05/21, 16:18 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14154
-
crell uploaded patch set 15 08/19/21, 15:19
-
core-ci voted on patch set 15 V -1 08/19/21, 15:22 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15305
-
crell uploaded patch set 16 08/19/21, 15:33
-
core-ci voted on patch set 16 V +1 08/19/21, 15:52 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15306
-
Jonas Eberle uploaded patch set 17 08/19/21, 19:54
-
core-ci voted on patch set 17 V +1 08/19/21, 20:09 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15313
-
Mathias Brodala commented on patch set 17 08/20/21, 07:09
Feature-94600-AdoptMonologForInjectedLoggers.rst:13Micro nitpick: we do not use the ". " pattern anywhere in TYPO3, please always use a single space after punctuation.Feature-94600-AdoptMonologForInjectedLoggers.rst:25TYPO3Feature-94600-AdoptMonologForInjectedLoggers.rst:33There must be a newline after .. code-block:: <role> https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/WritingReST/CheatSheet.html#code-blocks Also code blocks must be indented by 3 spaces (which aligns to the ".. " of ".. code-block::")Feature-94600-AdoptMonologForInjectedLoggers.rst:87Here we should clarify the relation to "trigger_error(..., E_USER_DEPRECATED)". It sounds like developers can use any of these but we should stick to a single way.Feature-94600-AdoptMonologForInjectedLoggers.rst:104We should add a link here IMO: https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/WritingReST/CheatSheet.html#external-linksFeature-94600-AdoptMonologForInjectedLoggers.rst:105many (This document will be left unchanged forever so referring to a specific number doesn't make much sense.)Feature-94600-AdoptMonologForInjectedLoggers.rst:107Please add the :file: text role to filenames: https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/WritingReST/CheatSheet.html#inline-code-text-rolesFeature-94600-AdoptMonologForInjectedLoggers.rst:124Should be "arguments: []" just like the processor afterwards I guess. Without explanation that these are constructor arguments we should maybe skip this altogether though.Feature-94600-AdoptMonologForInjectedLoggers.rst:132Here the :php: role should be used.Feature-94600-AdoptMonologForInjectedLoggers.rst:140Here we should use inline code formatting.Feature-94600-AdoptMonologForInjectedLoggers.rst:144AdministratorsFeature-94600-AdoptMonologForInjectedLoggers.rst:154Here the :yaml: role should be used.Feature-94600-AdoptMonologForInjectedLoggers.rst:163General question: are there plans to support other non-monolog logging options here? I'm used to Symfony where there's a config/packages/monolog.yaml which clearly hints at the implementation. -
Jonas Eberle uploaded patch set 18 08/20/21, 07:32
-
Jonas Eberle commented on patch set 17 08/20/21, 07:32
Feature-94600-AdoptMonologForInjectedLoggers.rst:13ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:25ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:33ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:104ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:107ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:132ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:140ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:144ReplyDoneFeature-94600-AdoptMonologForInjectedLoggers.rst:154ReplyDone -
core-ci voted on patch set 18 V +1 08/20/21, 07:51 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15320
-
crell uploaded patch set 19 08/20/21, 15:05
-
crell commented on patch set 19 08/20/21, 15:05
Feature-94600-AdoptMonologForInjectedLoggers.rst:33Reply3? That should be enforced by the .editorconfig file, then. Right now, .editorconfig says the indent is 4.Feature-94600-AdoptMonologForInjectedLoggers.rst:87ReplyCalling trigger_error() isn't really relevant here. This is about what happens when you call trigger_error(). Extensions can call trigger_error() themselves whenever, that's unrelated. The point here is that they should almost never use the `deprecated` log channel. Only the core error handler will do that.Feature-94600-AdoptMonologForInjectedLoggers.rst:105ReplyAckFeature-94600-AdoptMonologForInjectedLoggers.rst:124ReplyMm, actually I think I'm wrong there anyway, it shouldn't be arguments. The formatter uses the same "everything is an arg except for the magic names" logic. I'll change that.Feature-94600-AdoptMonologForInjectedLoggers.rst:163Reply UnresolvedNot that I'm aware of. I am highly impartial about what the file is named and where it lives, just that it's a YAML file that gets parsed at container build time. Where that file lives and what it's called I don't much care. -
Nikita Hovratov commented on patch set 19 08/20/21, 15:19
Feature-94600-AdoptMonologForInjectedLoggers.rst:33Replyafaik this was recently changed, so that it is easier to paste code examples. Strictly speaking there should also be 3 spaces in lists (including the asterisk symbol). -
core-ci voted on patch set 19 V +1 08/20/21, 15:25 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15331
-
Benjamin Franzke commented on patch set 19 08/23/21, 19:56
Services.php:32I personally strongly dislike parsing another configuration in services.php That makes Services.php heavily depend on "side-effects". This is implicit, hard to discover service configuration and if the config causes DI to break, the integrator will have a hard time to fix it via installtool. And it's unclear that DI caches need to be cleared for logging config to be reflected. Also I think that logging information is possibly sensitive and shouldn't be located in a possibly publicly readable yaml file. I'd much prefer logging factories that read from $GLOBALS['TYPO3_CONF_VARS']['monolog'][$channel] Example for such a factory, as prototypes back in 2019: https://github.com/bnf/TYPO3.CMS/commit/monolog-alex-patchset-5-with-handler-factory Why? We need a generic config overhaul anyway, so introducing yet another config-form, just for loggers, isn't really helpful – sorry.Services.yaml:326Can you explain why it is a placeholder? It's a service alias and is actually used, so not a placeholder, right?Feature-94600-AdoptMonologForInjectedLoggers.rst:5UnresolvedToo many equal signs.Feature-94600-AdoptMonologForInjectedLoggers.rst:12It's not really replaced, it's added as an alternative, right?Feature-94600-AdoptMonologForInjectedLoggers.rst:13Auto-configuration in Symfony DI terms would be to auto-configure based on class names. The currently implemented approach (that this patch implements) uses explicit configuration via arguments in Services.yaml or PHP 8 annotation. So I think we shouldn't talk about auto-confguration. Did you experiment to actually autowire LoggerInterface to the default channel, if not explicitly configured to another channel? I think that would be nice, and since we currently do that in core (we only autowire LoggerAwareInterface) that wouldn't be breaking. -
crell commented on patch set 19 08/24/21, 00:58
Services.php:32Reply UnresolvedBecause this configuration affects the container, it simply cannot be done through the global config array. That is not an option on the table if we want to use DI without a great deal of runtime overhead and complexity. I fully agree on the need for a larger configuration overhaul, although that's out of scope here. (I have a proposal for part of that in another issue.) If anything, I would push hard on moving away from the global config array. My proposal in https://decisions.typo3.org/t/object-interface-to-typo3-conf-vars/706 makes portions of the configuration injectable, which could lead to all configuration being injectable in the future. Having compile-time information available in YAML is a common pattern, and this is effectively how Symfony wires up Monolog, too. (That goes through the Symfony Config system, which is not used here and would just complicate matters even more.) As for where the file lives, I am very flexible on that and have no particular preference. Ideally we would have a configuration system that supports per-environment (dev/prod) overrides, a la Symfony, all of which can be stored in Git. Lacking that for now, I could see a good argument for the file being in a Git-stored location or a not-Git-stored location. I defer to the consensus on that front. At that point, "YAML file that gets pulled into the CI config" can, and probably should, become a part of a new config system in v12. (With less manual parsing than I have here, courtesy of a proper serialization library as discussed in the Decisions link above.)Services.yaml:326ReplyOther loggers are cloned off of this one, and declaring this as a dependency is what triggers the auto-configuration for channels. However, this service itself is never actually injected. The generated `monolog.logger.$channel` services are.Feature-94600-AdoptMonologForInjectedLoggers.rst:12Reply UnresolvedThe plan is to deprecate the old logging system, add a bridge inside LoggerManager (probably a separate patch to keep things reviewable, but I could stick it in this one if desired), and then remove the current one in v12 or v13.Feature-94600-AdoptMonologForInjectedLoggers.rst:13Reply UnresolvedI struggle to come up with a different name than "auto configuration" or "auto wiring", both of which Symfony already uses. If you have an alternative I am open to it. At the moment, the auto-whatever logic is keyed off of depending on the @logger placeholder service. However, that's a single method so it should be pretty easy to change the trigger to latch on by variable name or type as well. I didn't want to go too far without checking to see what people were comfortable with. -
crell uploaded patch set 20 08/26/21, 01:54
-
core-ci voted on patch set 20 V -1 08/26/21, 01:58 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15645
-
crell commented on patch set 20 08/26/21, 02:00
This version will fail, but I'm about to sign off for a few days for vacation so I'm posting what I've got in case someone wants to continue while I'm gone. This version now detects places to inject a logger based on the type of a constructor parameter, not just the name. It also has a lot more error handling to account for the Symfony container, frankly, doing all kinds of weird things that make any sort of predictability impossible. :-( There's now a functional test as well, which isn't quite working for reasons I do not understand. The error from the container makes it seem like the auto-wiring logic is getting confused by the interface type declaration and fighting with the logic I'm adding, but I'm not clear why. If someone wants to answer that for me while I'm gone, that would be much appreciated. -
Benjamin Franzke commented on patch set 20 08/31/21, 17:25
MonologPass.php:65UnresolvedSo this is basically a service iterator. That's what the base class AbstractRecursivePass is usually used for, example in typo3/sysext/core/Classes/DependencyInjection/AutowireInjectMethodsPass.php That works on $container->getDefinitons() and allows to work on the concrete Definition instances and will recursively processes all definitons. …and it would allow to drop the $skipIds and the !$container->hasDefiniton($id) hacks. -
crell uploaded patch set 21 09/01/21, 19:32
-
core-ci voted on patch set 21 V -1 09/01/21, 19:38 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16033
-
crell uploaded patch set 22 09/01/21, 20:48
-
core-ci voted on patch set 22 V -1 09/01/21, 22:52 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16039
-
Benni Mack wrote 11/29/21, 10:10
Change destination moved from master to main -
Benni Mack updated the commit message in patch set 23 11/29/21, 13:29
-
core-ci voted on patch set 23 V -1 11/29/21, 18:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20039
-
Christian Kuhn commented on patch set 23 02/04/23, 11:25
Hey. It seems the logging topic is stuck again for a while. We may need a fresh restart *again*. I hope it's ok to abandon here for the time being. -
Christian Kuhn abandoned the change 02/04/23, 11:25
MonologHandlerDef.php:3