private final SimpleDateFormat monthFormatter = new SimpleDateFormat("MM");
private final SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy");
private final SimpleDateFormat timeFormatter =
- new SimpleDateFormat("HH:mm:ss.S");
+ new SimpleDateFormat("HH:mm:ss.SSS");
- private Date currentDate;
- private String currentDateString;
+ private volatile Date currentDate;
+ private volatile String currentDateString;
@Override
public String format(LogRecord record) {
// Message
sb.append(' ');
- sb.append(record.getMessage());
+ sb.append(formatMessage(record));
// Stack trace
if (record.getThrown() != null) {
return sb.toString();
}
- public void addTimestamp(StringBuilder buf, Date date) {
- if (currentDate != date) {
+ protected void addTimestamp(StringBuilder buf, Date date) {
+ if (currentDate.getTime() != date.getTime()) {
synchronized (this) {
- if (currentDate != date) {
+ if (currentDate.getTime() != date.getTime()) {
StringBuilder current = new StringBuilder(32);
current.append(dayFormatter.format(date)); // Day
current.append('-');
when Tomcat was shutdown. This fix ensures that that work directory for
an application is not deleted when Tomcat is shutdown. (mark)
</fix>
+ <fix>
+ Correct issues with JULI's OneLineFormatter including: correctly
+ re-using formatted timestamps when possible; thread-safety issues in
+ tiomstamp formatting; correcting the output of any milliseconds to
+ include leading zeros and formatting any parameters present.
+ (kolinko/markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">