Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Logging: same handler, different formatters  RSS feed

Saverio Miroddi
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?

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