-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
AddDebugLogProcessorPass is not working correctly in long run runtime and debug environment #48176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/cc @MatTheCat maybe? |
Yes I remember it was to avoid memory leaks: #30339 |
this is because in a non-swoole setup, the profiler does not collect anything in the CLI (as web requests are not handled there) so this avoids memory leaks for long-running commands. We would need a way to disable that SAPI check for swoole. |
How about make a patch like: public static function configureLogger(mixed $logger)
{
- if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
+ if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && $_ENV['APP_ENV'] === 'prod') {
$logger->removeDebugLogger();
}
} I patch it locally, and works fine now ( in dev and test environment). |
Your proposal has two issues:
I don't know much about Swoole, but could you try checking |
After some testing we could indeed check if But seeing that Roadrunner also leverages the cli SAPI makes me wonder if it really is Symfony’s responsibility to determine whether collecting logs or not 🤔 |
Hey, thanks for your report! |
Hello? This issue is about to be closed if nobody replies. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
Symfony version(s) affected
6.1.*
Description
I start to develop a new project using symfony and swoole.
Symfony & Swoole is really fast, but when running in APP_ENV=dev environment, I cannnot see any log in profiler bar.
After some reseach, I found that the problem is \Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass.
This classs will remove all debug logger when symfony is under CLI. So swoole or any other same framework like workerman/reactphp is not working well.
How to reproduce
Possible Solution
I dont know if we can detect the running environment while kernel compile.
Maybe we can add a new env variable, just like $_ENV['REMOTE_DEBUG_LOGGER'] (default: false) to replace the check in \Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass::configureLogger.
Additional Context
No response
The text was updated successfully, but these errors were encountered: