~/ learn/ comp-348/ cards/ Worked build: access logging, end to end
1 of 6

The shared loggers and the locale-pinned timestamp

The shared loggers and the locale-pinned timestamp

Answer

private static final Logger requests = Logger.getLogger("requests"); private static final Logger errors = Logger.getLogger("errors"); private static final DateTimeFormatter STAMP = DateTimeFormatter.ofPattern("dd/MMM/yyyy:HH:mm:ss Z", Locale.US);

Two loggers for two purposes, both `static final` so every pooled handler shares one thread-safe instance. `Locale.US` is not decoration: `MMM` renders in the default locale, and a month name in any other language makes the log unparseable by the analyser.

Harold 4e ch9 §Logging; §A Full-Fledged HTTP Server

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/7107e57d-4845-416e-bafc-43488b56c4d0/flashcard utf-8 LF