symfony-cmf / Routing

Routing component building on the Symfony Routing component
Other
288 stars 69 forks source link

ChainRouter floods error log #95

Closed trsteel88 closed 10 years ago

trsteel88 commented 10 years ago

I am using the ChainRouter, when I check my error log it is flooded with INFO log messages. Obviously it is going to log an error whenever the Symfony Default Router doesn't find a match. I can't see a way to set any kind of error logging level.

[2014-03-03 12:49:15] app.INFO: Router Symfony\Bundle\FrameworkBundle\Routing\Router was unable to generate route. Reason: 'Route 'acme.contact.index' not found': Unable to generate a URL for the named route "acme.contact.index" as such route does not exist. [] []

https://github.com/symfony-cmf/Routing/blob/master/ChainRouter.php#L234

dbu commented 10 years ago

indeed, not good. what would be the best solution? lowering the level, as its something that is expected to happen? if you have any inputs (or even a pull request) that would be appreciated.

trsteel88 commented 10 years ago

I haven't really had a look into it yet at this stage. I just noticed it in a few different logs. Just wanted to open a discussion to see what everyone's thoughts are.

Do we need to log each router not finding the route? Perhaps we only need to log it if none of the chained routers can find a match?

dantleech commented 10 years ago

I think a failed attempt on a router should be logged as debug -- as that is the level where that information is useful, otherwise just log the aggregate result.

dbu commented 10 years ago

@trsteel88 would reducing the level to debug solve the issue?

i had a glance at http://inside.webfactory.de/de/blog/logging-with-monolog-in-symfony2.html and wonder if we could further improve by having a special channel for the routing logging, but have no time to dig deeper into this. seems like maybe all cmf bundles should provide their own channel and i would hope you could then configure monolog to see a verbose log of a specific bundle...?

dbu commented 10 years ago

@trsteel88 would #96 solve the issue for you?

trsteel88 commented 10 years ago

Is debug level only in dev env?

wouterj commented 10 years ago

@trsteel88 that depends on your monolog settings. Btw, if you use the finger crossed handler, and configured it correctly, you'll only get these logs when no router matches.