public static Logger getLogger() { final Throwable t = new Throwable(); final StackTraceElement methodCaller = t.getStackTrace()[1]; final Logger logger = Logger.getLogger(methodCaller.getClassName()); logger.setLevel(ResourceManager.LOGLEVEL); return logger; }
This method would return a logger that knows the class it’s logging for. Any ideas against it?
Many years later: https://github.com/yanchenko/droidparts/blob/master/droidparts/src/org/droidparts/util/L.java
I guess it adds a lot of overhead for every class. Every class has to be ‘looked up’. You create new Throwable objects to do that… These throwables don’t come for free.