Skip to content

Add Google Cloud formatter to default services - #579

Merged
GromNaN merged 1 commit into
symfony:4.xfrom
jannes-io:add-google-cloud-formatter-service
May 2, 2026
Merged

Add Google Cloud formatter to default services#579
GromNaN merged 1 commit into
symfony:4.xfrom
jannes-io:add-google-cloud-formatter-service

Conversation

@jannes-io

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.x
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #...
License MIT

Adds GoogleCloudLoggingFormatter to the default exposed services. The Google Cloud formatter is a class provided by monolog, so it makes sense to also expose it to the DI container so we can use it without having to add it to DI ourselves.

The Google Cloud formatter is pretty much essential for anyone running Symfony apps on Google Cloud infrastructure, otherwise the severity is unknown and the timestamp when the log is received is used instead of when the log was generated.

Before users had to manually register the GoogleCloudLoggingFormatter:

    $services->set('app.logger.formatter.google', GoogleCloudLoggingFormatter::class);

And then use it in their monolog bundle config:

monolog:
    handlers:
        main:
            type: stream
            path: php://stderr
            level: info
            formatter: app.logger.formatter.google

After this change, users will no longer need to configure the GoogleCloudLoggingFormatter themselves and can just use monolog.formatter.google instead.

@GromNaN

GromNaN commented May 2, 2026

Copy link
Copy Markdown
Member

Thank you @jannes-io.

@GromNaN
GromNaN merged commit 423bc37 into symfony:4.x May 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants