10000 [RFC] Add a way to disable logging and profiler at runtime · Issue #60037 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[RFC] Add a way to disable logging and profiler at runtime #60037
Closed
@lyrixx

Description

@lyrixx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0