Skip to content

Commit c56704f

Browse files
committed
Fix logviewer using Instant with TIMESTAMP
which broke due to forcing jOOQ to use Instant with TIMESTAMP
1 parent bd9103d commit c56704f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

logviewer/src/main/java/org/togetherjava/tjbot/logwatcher/logs/LogREST.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import org.togetherjava.tjbot.logwatcher.watcher.StreamWatcher;
99
import org.togetherjava.tjbot.db.generated.tables.pojos.Logevents;
1010

11-
import java.time.LocalDateTime;
12-
import java.time.ZoneId;
13-
1411
@RestController
1512
public class LogREST {
1613

@@ -28,10 +25,8 @@ public ResponseEntity<Void> logEvent(@RequestBody final LogEvent body) {
2825
}
2926

3027
private Logevents mapToLogevents(final LogEvent body) {
31-
return new Logevents(Integer.MIN_VALUE,
32-
LocalDateTime.ofInstant(body.getInstant(), ZoneId.systemDefault()),
33-
body.getThread(), body.getLevel(), body.getLoggerName(), body.getMessage(),
34-
body.getEndOfBatch(), body.getLoggerFqcn(), body.getThreadId(),
35-
body.getThreadPriority());
28+
return new Logevents(Integer.MIN_VALUE, body.getInstant(), body.getThread(),
29+
body.getLevel(), body.getLoggerName(), body.getMessage(), body.getEndOfBatch(),
30+
body.getLoggerFqcn(), body.getThreadId(), body.getThreadPriority());
3631
}
3732
}

logviewer/src/main/java/org/togetherjava/tjbot/logwatcher/views/logs/StreamedView.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.vaadin.crudui.crud.impl.GridCrud;
2525

2626
import javax.annotation.security.PermitAll;
27+
import java.time.LocalDateTime;
28+
import java.time.ZoneOffset;
2729
import java.time.format.DateTimeFormatter;
2830
import java.util.*;
2931
import java.util.stream.Collectors;
@@ -128,7 +130,8 @@ private void setInstantFormatter() {
128130

129131

130132
innerGrid
131-
.addColumn(new LocalDateTimeRenderer<>(Logevents::getTime,
133+
.addColumn(new LocalDateTimeRenderer<>(
134+
logEvents -> LocalDateTime.ofInstant(logEvents.getTime(), ZoneOffset.UTC),
132135
DateTimeFormatter.ofPattern("yyy-MM-dd HH:mm:ss.SSS")))
133136
.setHeader("Instant")
134137
.setComparator(Comparator.comparing(Logevents::getTime))

0 commit comments

Comments
 (0)