Skip to content

Commit

Permalink
Fix date-time formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AzeemMuzammil committed Jul 2, 2024
1 parent e0abe1a commit 375e0cd
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ private static String formatAccessLogAttribute(HttpAccessLogMessage httpAccessLo
HttpAccessLogFormat format, String attribute) {
return switch (attribute) {
case ATTRIBUTE_IP -> httpAccessLogMessage.getIp();
case ATTRIBUTE_DATE_TIME ->
String.format("[%1$td/%1$tb/%1$tY:%1$tT.%1$tL %1$tz]", httpAccessLogMessage.getDateTime());
case ATTRIBUTE_DATE_TIME -> String.format(format == HttpAccessLogFormat.FLAT ?
"[%1$td/%1$tb/%1$tY:%1$tT.%1$tL %1$tz]" : "%1$td/%1$tb/%1$tY:%1$tT.%1$tL %1$tz",
httpAccessLogMessage.getDateTime());
case ATTRIBUTE_REQUEST_METHOD -> httpAccessLogMessage.getRequestMethod();
case ATTRIBUTE_REQUEST_URI -> httpAccessLogMessage.getRequestUri();
case ATTRIBUTE_SCHEME -> httpAccessLogMessage.getScheme();
case ATTRIBUTE_REQUEST -> String.format(format == HttpAccessLogFormat.FLAT ?
"\"%1$s %2$s %3$s\"" : "%1$s %2$s %3$s", httpAccessLogMessage.getRequestMethod(),
"\"%1$s %2$s %3$s\"" : "%1$s %2$s %3$s", httpAccessLogMessage.getRequestMethod(),
httpAccessLogMessage.getRequestUri(), httpAccessLogMessage.getScheme());
case ATTRIBUTE_STATUS -> String.valueOf(httpAccessLogMessage.getStatus());
case ATTRIBUTE_REQUEST_BODY_SIZE -> String.valueOf(httpAccessLogMessage.getRequestBodySize());
Expand Down

0 comments on commit 375e0cd

Please sign in to comment.