}
}
private static void doLog(Logger log, Level level, String msg, Throwable t) {
LogRecord record = new LogRecord(level, msg);
record.setLoggerName(log.getName());
record.setResourceBundleName(log.getResourceBundleName());
record.setResourceBundle(log.getResourceBundle());
if (t != null) {
record.setThrown(t);
}
//try to get the right class name/method name - just trace
//back the stack till we get out of this class
StackTraceElement stack[] = (new Throwable()).getStackTrace();
String cname = LogUtils.class.getName();
for (int x = 0; x < stack.length; x++) {
StackTraceElement frame = stack[x];
if (!frame.getClassName().equals(cname)) {
record.setSourceClassName(frame.getClassName());
record.setSourceMethodName(frame.getMethodName());
break;
}
}
log.log(record);
}