Code example for LogRecord

Methods: getLevelgetMessagegetMillisgetThrown

0
		fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
	} 
 
	public String format(LogRecord logrecord) 
	{ 
		String timestamp = fmt.format(Long.valueOf(logrecord.getMillis())); 
		String lvl = logrecord.getLevel().getName(); 
 
		String logmsg = String.format("%s [%s] - %s\n", timestamp,lvl,logrecord.getMessage()); 
		Throwable except = logrecord.getThrown(); 
		if(except != null) 
		{ 
			StringWriter stringwriter = new StringWriter(); 
			except.printStackTrace(new PrintWriter(stringwriter)); 
			logmsg += stringwriter.toString(); 
		} 
		return logmsg; 
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java