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 can I specify which formatter should be used? #296

Closed
rmuktader opened this issue Dec 26, 2013 · 3 comments
Closed

How can I specify which formatter should be used? #296

rmuktader opened this issue Dec 26, 2013 · 3 comments

Comments

@rmuktader
Copy link

Hello,

I am trying to incorporate monolog into a non-symfony project. I need to capture the stack trace when an exception is logged.

Thus far it seems that I need to use the NormalizerFormatter instead of the LineFormatter. But I cannot figure out how to do that. Can some please assist? Many thanks in advance.

@Seldaek
Copy link
Owner

Seldaek commented Dec 26, 2013

You can just call ->setFormatter() on any handler to change it's default formatter. In this case you would need to write your own I think because the normalizer one will just return an array of data so if you output it in a file you'll just get Array as output for every line, not very useful :)

@Seldaek Seldaek closed this as completed Dec 26, 2013
@staabm
Copy link
Contributor

staabm commented Dec 26, 2013

Sounds like the thing you are searching for is IntrospectionProcessor. I think the issue tracker is not the right place to ask questions...

@Fleshgrinder
Copy link

Simply pass the exception as message to the logger, this will call the exception's __toString() and give you a nice formatting including the stack trace.

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

4 participants