Break not if getSourceClassName() is null.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2714 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2010-02-09 20:20:07 +00:00
parent c7e16e52b3
commit d25492df43
@@ -73,17 +73,19 @@ public class OneLineLogFormatter extends Formatter
if (_showWhere) { if (_showWhere) {
// append the log method call context // append the log method call context
String where = record.getSourceClassName(); String where = record.getSourceClassName();
boolean useLoggerName = true;
if (where != null) { if (where != null) {
// strip the package name from the logging class // strip the package name from the logging class
where = where.substring(where.lastIndexOf(".")+1); where = where.substring(where.lastIndexOf(".")+1);
// handle legacy log usage patterns
useLoggerName = !(where.equals("Log") || where.equals("LoggingLogProvider") ||
where.startsWith("JDK14Logger$Impl"));
} }
boolean legacy = where.equals("Log") || where.equals("LoggingLogProvider") || if (useLoggerName) {
where.startsWith("JDK14Logger$Impl");
if (legacy) {
where = record.getLoggerName(); where = record.getLoggerName();
} }
buf.append(where); buf.append(where);
if (record.getSourceMethodName() != null && !legacy) { if (record.getSourceMethodName() != null && !useLoggerName) {
buf.append("."); buf.append(".");
buf.append(record.getSourceMethodName()); buf.append(record.getSourceMethodName());
} }