/** * Logs a message object with the {@link Level#ERROR ERROR} level. * * @param message the message object to log. */ voiderror(Object message);
根據方法重載特性,當第二個參數為Throwable時,會打印出異常信息,并且包含異常堆棧信息。
1
2
3
4
5
6
7
8
/** * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable} * <code>t</code> passed as parameter. * * @param message the message object to log. * @param t the exception to log, including its stack trace. */ voiderror(String message, Throwable t);
根據方法重載特性,當第二個參數為Object時,會根據占位符進行替換并打印出錯誤日志。
1
2
3
4
5
6
7
/** * Logs a message with parameters at error level. * * @param message the message to log; the format depends on the message factory. * @param p0 parameter to the message. */ voiderror(String message, Object p0);