Description
Description
Problem
When I work on long running process I often face the same situation where
Symfony leaks. It usually does not happen in production, but in development it
is a real pain. I have already worked hard on Symfony to mitigate this issue,
but it is still there.
Now, I think the remaining pain point is the Profiler + Logger debug infrastructure.
To ease the debug, we store a lot of information in the profiler and in the
logs.
However, when the process runs for a long time, the profiler and the logs grow
and grow and grow. More over, we usually don't need all that information.
For example, when we import huge CSV, as a developer we does tons of SQL or
HTTP queries.
In the past, we used to "mute" the SQL logger :
$this->connection->getConfiguration()->setSQLLogger(null);
But this does not work anymore since DBAL4. More over, Symfony still collect a
lof a data in the profiler.
There a some workarounds, but they are so not satisfying. And it makes me wonder
if Symfony can't do better.
Proposal
I think Symfony should provide a way to "mute" the profiler and the logger, programmatically.
So I think we could introduce a new interface and its implementation:
interface DebugRecorderInterface
{
public function disableLogging(): void;
public function enableLogging(): void;
public function disableProfiling(): void;
public function enableProfiling(): void;
}
I think we need to make a difference between the logger and the profiler, because
we may want to disable one and not the other.
For example, in production we want to keep logs (since we usually have a buffer
with eviction) and in dev we want to remove everything.
Example
No response