1

I'm trying to set up a console command in Symfony2 so that it logs to the console in my dev environment, but to a logfile in prod.

so my config_prod.yml has this:

monolog:
    handlers:
        payment:
            type:  stream
            path:  %kernel.logs_dir%/payment.log
            channels: payment

while my config_dev.yml uses this:

monolog:
    handlers:
        console:
            type:   console
            channels: payment

and the service is defined in services.yml like this:

payment_manager:
    class:      My\Bundle\Service\PaymentManager
    arguments:  [@doctrine.orm.entity_manager, @logger]
    tags:
        - { name: monolog.logger, channel: payment }

To my surprise, this does squat nothing. Output goes to app/logs/dev.log instead of the console. Why?

1
  • Many days later, I'm still completely lost, except that it appears to me that the console handler isn't working at all. Is that possible? Commented Jun 1, 2014 at 14:42

1 Answer 1

9

It turns out that "console" doesn't actually mean console at all, it means "browser's javascript console".

If you came here because you have the same question, here's how to do it:

    output:
        type:       stream
        path:       php://stdout
        level:      info
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.