There are several places in my application where I throw an exception as part of the business logic, but I don't need Symfony2 to generate and log an exception.
For example, when the user attempts an action he can't do temporarily, I call $this->createAccessDeniedException() with a nice error message. This is not an application failure and I don't need it logged. Mostly it's a message to the user saying "try again later, or after you completed this other step first".
Can I teach it to not log certain cases or am I using exceptions badly and if so, what should I do instead?
update: My config:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped
grouped:
type: group
members: [streamed, buffered]
streamed:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
buffered:
type: buffer
handler: swift
swift:
type: swift_mailer
from_email: xxx@xxx.xxx
to_email: xxx@xxx.xxx
subject: "Error"
level: info