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

how to make symfony2 writes log in prod mode? #76

Closed
mappedinn opened this issue Apr 13, 2014 · 5 comments
Closed

how to make symfony2 writes log in prod mode? #76

mappedinn opened this issue Apr 13, 2014 · 5 comments

Comments

@mappedinn
Copy link

I would like to make symfony writes in the file app/logs in prod mode.
To do so, I changed the config of monolog in config_prod.yml

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested
        nested:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug

But, not prod.log file is generated!

Since the log is produced in dev mode, I copied than the monolog config which is available in config_dev.yml to the config_prod.yml. This config is follows:

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        firephp:
            type:  firephp
            level: info
        chromephp:
            type:  chromephp
            level: info

But, still no prod.log is written in prod mode.

Is there any idea?

For your information , I am using symfony 2.3.11.

@stof
Copy link
Member

stof commented Apr 14, 2014

the first config you pasted means that logs are written only when a message at the error level at least is logged (this is the goal of the FingersCrossedHandler: avoiding logging when everything is fine)

Have you thought about clearing your prod cache when changing the logging configuration ? If no, it is logical that you don't see any change, as Symfony does not reload the config automatically in the prod environment

@mappedinn
Copy link
Author

Nothing changed!

What I have not noticed is that in prod mode symfony displays white page!

I noticed that only today because I working on a REST api so all my work (these days) consist only trying curl command.

NB : in prod mod all curl command give 500 error code!

@Seldaek
Copy link
Member

Seldaek commented Apr 14, 2014

@mappedinn is it possible that you have a fatal error of some sort? Have you checked the php error log? Because monolog might not log at all if the php process does not terminate correctly.

@mappedinn
Copy link
Author

@Seldaek This is the case! I will try to see what to do!

@mappedinn
Copy link
Author

I don't what it is the problem.

I returned back to a previous version of my project & prod.log is written now!

Thank your help!

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

No branches or pull requests

3 participants