MCPcopy Create free account
hub / github.com/PCGen/pcgen / getLogger

Method getLogger

code/src/java/pcgen/util/Logging.java:500–529  ·  view source on GitHub ↗

Retrieve a Logger object with the specified name. Generally this name should be either the fully qualified class name, or the package name. @return An instance of Logger that deals with the specified name.

()

Source from the content-addressed store, hash-verified

498 * @return An instance of Logger that deals with the specified name.
499 */
500 private static java.util.logging.Logger getLogger()
501 {
502 StackTraceElement[] stack = new Throwable().getStackTrace();
503 StackTraceElement caller = null;
504
505 for (int i = 1; i < stack.length; i++) //1 to skip this method
506 {
507 if (!"pcgen.util.Logging".equals(stack[i].getClassName()))
508 {
509 caller = stack[i];
510 break;
511 }
512 }
513 // name The name of the logger
514 String name = (caller == null) ? "<null>" : caller.getClassName();
515
516 Logger l = null;
517 final int maxRetries = 15;
518 int retries = 0;
519 while (l == null && retries < maxRetries)
520 {
521 l = java.util.logging.Logger.getLogger(name);
522 retries++;
523 }
524 if (l == null)
525 {
526 System.err.println("Unable to get logger for " + name + " after " + retries + " atempts.");
527 }
528 return l;
529 }
530
531 /**
532 * List the current stack of all threads to STDOUT.

Callers 15

isLoggableMethod · 0.95
debugPrintMethod · 0.95
debugPrintLocalisedMethod · 0.95
deprecationPrintMethod · 0.95
reportSourceMethod · 0.95
errorPrintMethod · 0.95
logMethod · 0.95
replayParsedMessagesMethod · 0.95
PcgenFtlTestCaseClass · 0.80
TestHelperClass · 0.80
importDataMethod · 0.80

Calls 1

equalsMethod · 0.65

Tested by

no test coverage detected