code: public static Logger getLogger()
      {
          StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();
          // stacktrace[0] is getStackTrace()
          // stacktrace[1] is getLogger()
          StackTraceElement element = stacktrace[2];
          String name = element.getClassName();
  
          if (!"<clinit>".equals(element.getMethodName())) {
              LOG.warnf(
                  "Logger %s wasn't allocated in static constructor -- did you forget to make the field static? (%s:%s)",
                  name,
                  element.getFileName(),
                  element.getLineNumber()
              );
          }
  
          return new Logger(org.apache.log4j.Logger.getLogger(name));
      }
docs: Returns a logger for the calling class.
  <p/>
  Specifically, throws and catches an exception, then uses the stack trace to determine the calling class.
  The fully-qualified name of that class is used to get a Log4J logger, when is then wrapped.
  Typical usage is to use this method to initialize a static member variable, e.g.,
  {@code private static final Logger LOG = Logger.getLogger();}
  <p/>
  As this is not the sort of thing you want (or need) to be doing hundreds of times a second,
  a warning is logged if this method is not called from a static constructor.
  
  @return a logger