Home Getting caller class name for Formatter [Java Logging with File Handler]
Reply: 0

Getting caller class name for Formatter [Java Logging with File Handler]

user553
1#
user553 Published in May 20, 2018, 9:58 am

I want to add a FileHandler to my logger. And I am also creating a new Formatter(java.util.logging.Formatter) for my FileHandler

In the format method https://docs.oracle.com/javase/7/docs/api/java/util/logging/Formatter.html#format(java.util.logging.LogRecord), is it possible to get the class which called the log https://docs.oracle.com/javase/7/docs/api/java/util/logging/Logger.html#log(java.util.logging.Level,%20java.lang.String)method?

Edit: I wrapped my logger in a class, so getSourceClassName() will not work

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.244457 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO