Skip to content
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

Making the channel handler more useful by showing it on the prod environment #4604

Merged
merged 3 commits into from
May 25, 2015

Conversation

weaverryan
Copy link
Member

Q A
Doc fix? yes
New docs? no
Applies to 2.3+
Fixed tickets n/a

Hi guys!

I realized there were a few practical problems with this:

  1. Normally, there is no monolog configuration in config.yml - so it's odd to show an example there
  2. In the prod environment (by default, unless you set doctrine's logging explicitly to true), the doctrine channel is not logged at all. So, if you tried this example in config_prod.yml, it probably wouldn't work. But security is always there.

Thanks!

P.S. After merging to 2.6, container:debug should be changed to debug:container.

@@ -67,19 +79,21 @@ To do so, just create a new handler and configure it like this:
// app/config/config.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs file name update too (I couldn't comment on the XML filename, but that should be changed as well)

@wouterj
Copy link
Member

wouterj commented Dec 7, 2014

Why did you make it specific for prod config?

@weaverryan
Copy link
Member Author

@wouterj because the standard edition (and my real projects) only have a monolog config key in config_dev and config_prod, so this seems more realistic. But now that you mention it, if you have this specific logging use-case (eg log all security messages to this special file), you will probably want this logged consistently across environments.

So now I agree with you - I'll update it :)


Each channel corresponds to a logger service (``monolog.logger.XXX``)
in the container (use the ``container:debug`` command to see a full list)
and those are injected into different services.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however, when defining your services, the way to ask for a given channel is not to use monolog.logger.XXX directly. It is to inject the logger service and set the appropriate tag on your service.
this is necessary because the compiler pass reading these tags is also the place creating these services.

I'm not sure documenting the monolog.logger.XXX naming convention is actually worth it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for documenting it as an monolog implementation detail. we should warn to rely on this naming convention

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think the specific monolog.logger.XXX service names are guaranteed in a sense, due to this feature: http://symfony.com/doc/current/cookbook/logging/channels_handlers.html#configure-additional-channels-without-tagged-services. And for me, this has always seems a lot more clear - using a tag to change how a logger is injected (in reality, which logger is injected) always seemed obtuse to me. I wonder if we should tell end-users to use the specific services, and leave the tag-usage primarily for third-party code (where you can't create a channel via config).

@wouterj
Copy link
Member

wouterj commented Mar 25, 2015

ping @weaverryan

@wouterj
Copy link
Member

wouterj commented May 21, 2015

@weaverryan can you please finish/merge this one or put it on the list for saturday? Thanks!

@weaverryan
Copy link
Member Author

Thanks for the poke Wouter. I actually think all the issues were all taken care of with this, so i merged it in (I did at one last second tiny tweak).

@weaverryan weaverryan merged commit bc79b21 into 2.3 May 25, 2015
weaverryan added a commit that referenced this pull request May 25, 2015
… the prod environment (weaverryan)

This PR was merged into the 2.3 branch.

Discussion
----------

Making the channel handler more useful by showing it on the prod environment

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | n/a

Hi guys!

I realized there were a few practical problems with this:

1) Normally, there is no `monolog` configuration in `config.yml` - so it's odd to show an example there
2) In the `prod` environment (by default, unless you set doctrine's logging explicitly to true), the `doctrine` channel is not logged at all. So, if you tried this example in `config_prod.yml`, it probably wouldn't work. But security is always there.

Thanks!

P.S. After merging to 2.6, `container:debug` should be changed to `debug:container`.

Commits
-------

bc79b21 Adding one more note about why we're in config.yml
78323d8 Changing back to config.yml and fixing some code block mistakes thanks to Wouter
f9f3c3f Making the channel handler more useful by showing it on the prod environment
@xabbuh xabbuh deleted the monolog-handler-update branch May 31, 2015 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants