@Override
	public synchronized String format(LogRecord record) {
		StringBuffer sb = new StringBuffer();
		dat.setTime(record.getMillis());
		args[0] = dat;

		StringBuffer text = new StringBuffer();
		if (formatter == null) {
			formatter = new MessageFormat(format);
		}
		
		formatter.format(args, text, null);
		sb.append(text);
		sb.append(" ");
		
		if (record.getSourceClassName() != null) {
			sb.append(record.getSourceClassName().substring(
					record.getSourceClassName().lastIndexOf(".") + 1));
		} else {
			sb.append(record.getLoggerName());
		}
		
		if (record.getSourceMethodName() != null) {
			sb.append(".");
			sb.append(record.getSourceMethodName() + "()");
		}
		
		sb.append(" ");
		String message = formatMessage(record);
		sb.append(record.getLevel().getLocalizedName());
		sb.append(": ");
		sb.append(message);
		sb.append(lineSeparator);
		
		if (record.getThrown() != null) {
			try {
				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw);
				record.getThrown().printStackTrace(pw);
				pw.close();
				sb.append(sw.toString());
			} catch (Exception ex) { };
		}
		
		return sb.toString();
	}