48174[WIP][FEATURE] Replace logging framework with monolog
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 54
- typo3/sysext/core/Classes/Log/Exception/InvalidLogProcessorConfigurationException.phpdeleted+0 −22
- typo3/sysext/core/Classes/Log/Exception/InvalidLogWriterConfigurationException.phpdeleted+0 −22
- typo3/sysext/core/Classes/Log/Handler/DatabaseHandler.phpnew+70 −0
- typo3/sysext/core/Classes/Log/Processor/AbstractMemoryProcessor.phpdeleted+0 −80
- typo3/sysext/core/Classes/Log/Processor/AbstractProcessor.phpdeleted+0 −41
- typo3/sysext/core/Classes/Log/Processor/IntrospectionProcessor.phpdeleted+0 −161
- typo3/sysext/core/Classes/Log/Processor/MemoryPeakUsageProcessor.phpdeleted+0 −42
- typo3/sysext/core/Classes/Log/Processor/MemoryUsageProcessor.phpdeleted+0 −42
- typo3/sysext/core/Classes/Log/Processor/NullProcessor.phpdeleted+0 −32
- typo3/sysext/core/Classes/Log/Processor/ProcessorInterface.phpdeleted+0 −32
- typo3/sysext/core/Classes/Log/Processor/WebProcessor.phpdeleted+0 −36
- typo3/sysext/core/Classes/Log/Writer/AbstractWriter.phpdeleted+0 −41
- typo3/sysext/core/Classes/Log/Writer/DatabaseWriter.phpdeleted+0 −88
- typo3/sysext/core/Classes/Log/Writer/FileWriter.phpdeleted+0 −280
- typo3/sysext/core/Classes/Log/Writer/NullWriter.phpdeleted+0 −34
- typo3/sysext/core/Classes/Log/Writer/PhpErrorLogWriter.phpdeleted+0 −57
- typo3/sysext/core/Classes/Log/Writer/SyslogWriter.phpdeleted+0 −139
- typo3/sysext/core/Classes/Log/Writer/WriterInterface.phpdeleted+0 −30
- typo3/sysext/core/Classes/Log/Exception.phpdeleted+0 −22
- typo3/sysext/core/Classes/Log/Logger.phpdeleted+0 −323
Show 34 more files
- typo3/sysext/core/Classes/Log/LogLevel.php+9 −9
- typo3/sysext/core/Classes/Log/LogManager.php3+161 −132
- typo3/sysext/core/Classes/Log/LogManagerInterface.php+3 −3
- typo3/sysext/core/Classes/Log/LogRecord.phpdeleted+0 −357
- typo3/sysext/core/Configuration/DefaultConfiguration.php4+19 −19
- typo3/sysext/core/Documentation/Changelog/master/Feature-12345-ReplaceLoggingWithMonolog.rst3new+61 −0
- typo3/sysext/core/Tests/Functional/Log/Handler/DatabaseHandlerTest.phpnew+62 −0
- typo3/sysext/core/Tests/Functional/Log/Writer/DatabaseWriterTest.phpdeleted+0 −61
- typo3/sysext/core/Tests/Unit/Log/Fixtures/ProcessorFixture.phpdeleted+0 −32
- typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFailing.phpdeleted+0 −33
- typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFixture.phpdeleted+0 −31
- typo3/sysext/core/Tests/Unit/Log/Processor/AbstractMemoryTest.phpdeleted+0 −63
- typo3/sysext/core/Tests/Unit/Log/Processor/AbstractProcessorTest.phpdeleted+0 −57
- typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionProcessorTest.phpdeleted+0 −179
- typo3/sysext/core/Tests/Unit/Log/Processor/MemoryPeakUsageProcessorTest.phpdeleted+0 −32
- typo3/sysext/core/Tests/Unit/Log/Processor/MemoryUsageProcessorTest.phpdeleted+0 −32
- typo3/sysext/core/Tests/Unit/Log/Processor/WebProcessorTest.phpdeleted+0 −49
- typo3/sysext/core/Tests/Unit/Log/Writer/AbstractWriterTest.phpdeleted+0 −36
- typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseWriterTest.phpdeleted+0 −66
- typo3/sysext/core/Tests/Unit/Log/Writer/FileWriterTest.phpdeleted+0 −224
- typo3/sysext/core/Tests/Unit/Log/LoggerTest.phpdeleted+0 −199
- typo3/sysext/core/Tests/Unit/Log/LogLevelTest.php+21 −9
- typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php+166 −47
- typo3/sysext/core/Tests/Unit/Log/LogRecordTest.phpdeleted+0 −185
- typo3/sysext/core/Tests/Unit/Type/File/ImageInfoTest.php+1 −1
- typo3/sysext/core/ext_tables.sql+1 −1
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/Post.php+8 −3
- typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php+1 −1
- typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php+10 −11
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php+1 −1
- typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php+2 −2
- typo3/sysext/redirects/Tests/Unit/Service/RedirectServiceTest.php+2 −2
- composer.json+1 −0
- composer.lock+79 −1
Review log 4349
Show 2224 earlier messages
-
Susi Moog uploaded patch set 1 05/15/16, 13:17
-
Susi Moog uploaded patch set 2 05/16/16, 10:58
-
Susi Moog uploaded patch set 3 05/16/16, 11:01
-
Susi Moog uploaded patch set 4 05/16/16, 14:21
-
Susi Moog commented on patch set 4 05/16/16, 14:25
-
Georg Ringer commented on patch set 4 05/16/16, 17:52
AboutController.php:18are those used?LogManager.php:209no hsc needed, this must be done when rendering the exceptionFeature-12345-ReplaceLoggingWithMonolog.rst:49this would require a breaking rst IMOImportExportUtility.php:66please replace those with the according class of monolog instead of removing it -
Susi Moog commented on patch set 4 05/17/16, 05:23
AboutController.php:18Replygood catch, not anymore - tested with this class.ImportExportUtility.php:66Replyremoved them because we now have returnType completion for makeInstance and getLogger always returns \Monolog\Logger which the IDE knows, so there is no need for them anymore. -
Susi Moog commented on patch set 4 05/17/16, 05:23
Feature-12345-ReplaceLoggingWithMonolog.rst:49ReplyAdditionally or instead of this one? I was not sure. -
Steffen Müller commented on patch set 4 05/17/16, 07:04
Thank you Susi for picking this task. We should use Psr\Log\LoggerInterface instead of Monolog\Logger at those places where we create logger instances. This is already the case for example in https://github.com/TYPO3/TYPO3.CMS/blob/c78be12c03c919273aa2332fd080fd0b4257a2d5/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php#L221 -
Steffen Müller uploaded patch set 5 05/17/16, 07:29
-
Steffen Müller commented on patch set 5 05/17/16, 07:47
A drawback I see with the current patchset is that the requestId is dropped, but it IMHO should be kept. It is the key to identify all log messages of a unique call.DefaultConfiguration.php:1150In current releases we append a random has to the default log file name for security-by-obscurity reasons. We should not drop that feature. https://github.com/TYPO3/TYPO3.CMS/commit/97949799ac7477ba69fc6ca5790219744d536014 -
Steffen Müller commented on patch set 5 05/17/16, 07:57
Probably this could be achieved by adding requestId to record['context'] through Monolog/Processor/UidProcessor. However this particular Processor forces us to provide integer ids. https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/UidProcessor.php We'd have two alternatives: 1. Implement our own Monolog/Processor/RequestIdProcessor based on UidProcessor.php or 2. Alter requestId in Core\Bootstrap to integer I'd opt for 1. -
Susi Moog commented on patch set 5 05/17/16, 18:20
For the request ID part: Would you say either https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/ProcessIdProcessor.php or https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/WebProcessor.php would provide enough information? if not I'd also add our own processor.DefaultConfiguration.php:1150ReplyWe'd have to either add it directly here (which "feels" ugly) or we'd have to write our own stream handler as far as I can see. Will think on that a bit. -
Georg Ringer commented on patch set 4 05/17/16, 18:46
Feature-12345-ReplaceLoggingWithMonolog.rst:49Replyadditionally, because there you can also state which processors and stuff is all removed and maybe replaced with new ones -
Helmut Hummel commented on patch set 5 05/17/16, 19:18
LogManager.php:8I assume this is not the correct import -
Steffen Müller commented on patch set 5 05/17/16, 21:20
The TYPO3 requestId is a random string which is unique for each request. It is created very early in TYPO3 bootstrap. It is useful to gather all log message which are logged in the same request. Neither Monolog ProcessIdProcessor nor WebProcessor work as substitute for the current requestId implementation in LogRecord. ProcessIdProcessor uses the id from the php process which is not unique per request. WebProcessor requires the ID to be set in $_SERVER['UNIQUE_ID'], but TYPO3 should set the requestId for convenience reasons. Most users do not have the possibility to add custom fields to $_SERVER -
Steffen Müller commented on patch set 5 05/17/16, 21:24
Example Processor: https://gist.github.com/stmllr/180f4f367d2bf9e8f37c8752207da97d -
Susi Moog commented on patch set 5 05/18/16, 09:25
Thanks Steffen, for the processor thing. I will continue to accumulate your comments during the week and try to come up with a patch that addresses them during the weekend. -
Susi Moog abandoned the change 08/02/16, 10:08
-
Susi Moog restored the change 07/06/18, 14:27
-
Alexander Schnitzler uploaded patch set 6 07/07/18, 10:32
-
TYPO3com voted on patch set 6 V -1 07/07/18, 10:32 Completed build in 06s on Sat, 7 Jul, 12:32 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25208
-
Alexander Schnitzler uploaded patch set 7 07/07/18, 10:37
-
TYPO3com voted on patch set 7 V -1 07/07/18, 10:37 Completed build in 07s on Sat, 7 Jul, 12:37 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25209
-
Alexander Schnitzler uploaded patch set 8 07/07/18, 10:42
-
TYPO3com voted on patch set 8 V -1 07/07/18, 10:50 Completed build in 07m 57s on Sat, 7 Jul, 12:50 PM Test Summary: 63 of 4433 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25210
-
Alexander Schnitzler commented on patch set 8 07/07/18, 10:51
Alright. Bamboo failed as I didn't fix the tests yet but I guess the latest patch set is stable enough to discuss the implementation. I had a look at monolog and I am familiar with the configuration of monolog in symfony and that's what influenced this patch set a lot. The api for the user doesn't change at all but the way we look at the configuration differs a lot from the former approach. monolog is mainly about channels. Every logger is assigned to just one channel and the handlers are configured to listen to the channels. The former approach was a bit similar except that every class represented a channel which is not really helpful. Please review concept wise and let me know if you like the approach and if we should put more effort into this. I guess it makes sense to focus on the changes in the LogManager and DefaultConfiguration at first. -
Alexander Schnitzler uploaded patch set 9 07/07/18, 19:19
-
TYPO3com voted on patch set 9 V -1 07/07/18, 19:27 Completed build in 07m 33s on Sat, 7 Jul, 09:27 PM Test Summary: 6 of 32975 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25220
-
Benni Mack commented on patch set 9 07/09/18, 10:47
LocalImageProcessor.php:28we could use a trait here directly (separate patch)FileProcessingService.php:47we could use a trait directly hereStorageRepository.php:58same here! -
Susi Moog rebased onto patch set 10 07/09/18, 11:27
-
TYPO3com voted on patch set 10 V +1 07/09/18, 11:36 Completed build in 08m 48s on Mon, 9 Jul, 01:36 PM Test Summary: 32727 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25248
-
Markus Klein commented on patch set 10 07/09/18, 12:56
_<hash> missingnotavailablethis should be part of the patch already if we replace our current framework. the current processors need an equivalent too. (WebProcessor)we have that now, IMO it has to be there in the new framework from the very beginningimproves -
Alexander Schnitzler commented on patch set 10 07/09/18, 14:22
Reply
To be honest here. I dislike the security by obscurity idea. I'd rather add a rule to the example .htaccess, disallowing access to all .log files.Reply
Yes, you are right. I'd just not put work into it right now until we have an agreement about using monolog or not. This patch set is just a proof of concept at some points.Reply
Same answer like some lines above. Once we decided for monolog, we tackle these things as well. -
Helmut Hummel commented on patch set 10 07/09/18, 14:24
DefaultConfiguration.php:1308if we put instances directly in configuration, we remove the possibility to have other configuration formats than PHP. besides that, the configuration should imho reflect a feature set we need (channels, log levels), but abstract from a concrete implementation. Otherwise we bind TYPO3 and the configuration to a concrete implementation (in this case a concrete version of monolog), which completely obsoletes the idea/possiblity of depending on an abstraction (psr-3) If we still decide to go this path, then the logging configuration must at least be removed from TYPO3_CONF_VARS (main TYPO3 configuration) and put elsewhere -
Alexander Schnitzler commented on patch set 10 07/09/18, 14:41
DefaultConfiguration.php:1308Reply> if we put instances directly in configuration, we remove the > possibility to have other configuration formats than PHP. True. The idea behind this configuration is, that we do bind to concrete instances anyway, no matter if we declare a classname or an instance. The good thing about using instances here (for now), is that the user has a clear api through autocompletion of his IDE. > besides that, the configuration should imho reflect a feature set > we need (channels, log levels), but abstract from a concrete > implementation. Please explain that again. I don't get it. > Otherwise we bind TYPO3 and the configuration to a concrete > implementation (in this case a concrete version of monolog), which > completely obsoletes the idea/possiblity of depending on an > abstraction (psr-3) Well, we do bind to any kind of monolog api no matter if we directly use concrete instances or use some kind of configuration in between. In the end we rely on monolog following semantic versioning and not changing the api. The statement about psr-3 is wrong because that psr does not describe how to deal with the configuration. Neither does it deal with handlers, processors and such. But true, if we want to use monolog, we rely on it and its api regarding the configuration. > If we still decide to go this path, then the logging configuration > must at least be removed from TYPO3_CONF_VARS (main TYPO3 > configuration) and put elsewhere I don't get that as well. -- Some general statements on configuration. For years we didn't have a plan on how to configure at all. Now, there is a movement towards yaml but I don't know the current status. While I worked on this patchset I had a look at symfony and I'd be glad to be able to configure like symfony does. Unfortunately it's not possible. If we had a clear statement about that topic I would have followed a different approach. For now I think, it's way easier using concrete instances in the configuration than having a mapping in between like 'type' => 'stream', which then has to be mapped and you write a huge case statement, mapping keys to class names. I simply don't see the benefit right now though I am open for better ideas. -
Markus Klein commented on patch set 10 07/09/18, 16:34
> if we put instances directly in configuration, we remove the possibility to have other configuration formats than PHP. The point is that some of use (eg Helmut) are using different configuration mechanisms, which "generate" the PHP configuration. If we put PHP objects in there, this is getting a bit harder. I guess that's what Helmut was referring to. -
Benni Mack uploaded patch set 11 07/11/18, 09:38
-
Benni Mack commented on patch set 11 07/11/18, 09:39
simply rebased so the impact is better to understand -
TYPO3com voted on patch set 11 V +1 07/11/18, 09:45 Completed build in 07m 01s on Wed, 11 Jul, 11:45 AM Test Summary: 32727 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25288
-
Helmut Hummel wrote 07/15/18, 09:50
Removed reviewer Helmut Hummel. -
Christian Kuhn abandoned the change 09/16/18, 22:53
i'm sad to say this patch is abandoned the second time. it still seems no final conclusion has been reached and no solution has been established for v9. it would be great to see this patch resurrected for v10 again, for now i'll abandon it for the sake of a more clean review queue. -
Markus Klein commented on patch set 11 09/17/18, 14:00
It is for sure not dead. A lot has been achieved concept-wise. So, this will get alive again! -
Arno Schoon commented on patch set 11 03/19/19, 20:47
I think I agree with Helmut regarding the configuration, sure it feels funny to add executable code to a configuration file, but then again, that's the beauty of PHP. But more important there is this benefit of some auto-completion and giving people a clear grasp of what's going on. I'm not sure what should be done with the two TODO items mentioned, documentation and a config migration wizard. In my opinion it suffices to mark this as breaking because of a conceptual change, but for other developers pointing to things like https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md could be more helpful than writing it ourselves. If you mean examples and specific use cases I'm in, but that doesn't need to hold this patch back as long as the implementation and parts of the Core are a good example. I think the changelog is clear about the rationale of this implementation. As for a migration wizard, is it really just a matter of changing the configuration or making developers aware of the new concept by detecting legacy configuration and giving (static) hints on how to improve it (maybe with a few use cases). Please let me know your thoughts on this. -
Benni Mack commented on patch set 11 03/20/19, 05:34
Hey Arno, thanks for the reply. I consider the patch actually too large. First, I suggest that we move our Core APIs (LogLevel) to be fully PSR-3 compliant, which we aren't at all. Once this is done, we con continue with further steps. There is also a channel #cig-monolog in slack. Feel free to contact Markus, as he's done some more work in this area in the past weeks. -
Arno Schoon commented on patch set 11 03/20/19, 09:19
> Patch Set 11: > > Hey Arno, > > thanks for the reply. I consider the patch actually too large. First, I suggest that we move our Core APIs (LogLevel) to be fully PSR-3 compliant, which we aren't at all. > > Once this is done, we con continue with further steps. > > There is also a channel #cig-monolog in slack. Feel free to contact Markus, as he's done some more work in this area in the past weeks. Agree, let's migrate to PSR-3 to clean up the code and remove some "proprietary" interfaces. This conceptual change will remain just as big I guess. I understood from Markus that he already was working on such a PSR-3-patch, lets see If we can get this patch smaller anyway :) As for configuration, this occurred too me this late last night, this patch of `DefaultConfiguration.php` doesn't allow me (as a system maintainer or administrator) to modify the path where the logs are stored. At least `LocalConfiguration.php` doesn't. I could choose to mis-use `AdditionalConfiguration.php` or even an extension, but that's rather late in the bootstrapping process which might lead to orphaned instances or logs written to the wrong location early in the process. -
Alexander Schnitzler restored the change 11/09/19, 13:52
-
Susi Moog marked it work in progress 02/28/20, 07:37
-
Susi Moog abandoned the change 02/28/20, 09:47
abandoned for now in favor of the approach in https://review.typo3.org/c/Packages/TYPO3.CMS/+/62355
LogManager.php:68