Skip to content

Commit

Permalink
Fix invalid DateTimeFormatter usage in AeronErrorLog, akka#22982
Browse files Browse the repository at this point in the history
* reason was the Z in the pattern, then one must use ZonedDateTime
  instead of LocalDateTime
* using the same formatter as the StdOutLogger instead
  • Loading branch information
patriknw committed May 23, 2017
1 parent 4707b11 commit 88a1a60
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.agrona.concurrent.errors.ErrorLogReader;

import akka.event.LoggingAdapter;
import akka.util.Helpers;

import java.io.File;
import java.nio.MappedByteBuffer;
Expand All @@ -43,10 +44,6 @@ public class AeronErrorLog
final DirectBuffer cncMetaDataBuffer;
final int cncVersion;
final AtomicBuffer buffer;
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSZ");
private final ZoneId timeZone = ZoneId.systemDefault();



public AeronErrorLog(File cncFile)
{
Expand Down Expand Up @@ -74,8 +71,8 @@ public long logErrors(LoggingAdapter log, long sinceTimestamp)
log.error(String.format(
"Aeron error: %d observations from %s to %s for:%n %s",
observationCount,
formatter.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(firstObservationTimestamp), timeZone)),
formatter.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(lastObservationTimestamp), timeZone)),
Helpers.timestamp(firstObservationTimestamp),
Helpers.timestamp(lastObservationTimestamp),
encodedException));
lastTimestamp.set(Math.max(lastTimestamp.get(), lastObservationTimestamp));
}, sinceTimestamp);
Expand Down

0 comments on commit 88a1a60

Please sign in to comment.