• Post Reply Bookmark Topic Watch Topic
  • New Topic

Logging: same handler, different formatters  RSS feed

 
Saverio Miroddi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing some logging code for my application, but I faced a problem:

I have two classes, which logging need to be directed to a file.

These two classes log things of a different domain; this would fit perfectly with the idea of having two formatters.

But the problem is:
how can I send different logs with different formatters to the same handler?

I have to use the same file handler, which means I have to add it to the root handler, but how to separate the formatting behavior?

Thanks!
Saverio M.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!