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.
()
| 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. |
no test coverage detected