This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 10b3ff9c35 Use JSON style format for the instant by default
10b3ff9c35 is described below
commit 10b3ff9c357607a76e6af0951dfa63f7219e65d3
Author: remm <[email protected]>
AuthorDate: Mon Feb 10 23:11:06 2025 +0100
Use JSON style format for the instant by default
---
java/org/apache/juli/JsonFormatter.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/juli/JsonFormatter.java
b/java/org/apache/juli/JsonFormatter.java
index b0ae7e9576..5947e8ce46 100644
--- a/java/org/apache/juli/JsonFormatter.java
+++ b/java/org/apache/juli/JsonFormatter.java
@@ -16,6 +16,7 @@
*/
package org.apache.juli;
+import java.util.logging.LogManager;
import java.util.logging.LogRecord;
/**
@@ -25,7 +26,7 @@ import java.util.logging.LogRecord;
* <p>
* The LogRecord is mapped as attributes:
* <ul>
- * <li>time: the log record timestamp</li>
+ * <li>time: the log record timestamp, with the default format as {@code
yyyy-MM-dd'T'HH:mm:ss.SSSX}</li>
* <li>level: the log level</li>
* <li>thread: the current on which the log occurred</li>
* <li>class: the class from which the log originated</li>
@@ -39,6 +40,16 @@ import java.util.logging.LogRecord;
*/
public class JsonFormatter extends OneLineFormatter {
+ private static final String DEFAULT_TIME_FORMAT =
"yyyy-MM-dd'T'HH:mm:ss.SSSX";
+
+ public JsonFormatter() {
+ String timeFormat =
LogManager.getLogManager().getProperty(JsonFormatter.class.getName() +
".timeFormat");
+ if (timeFormat == null) {
+ timeFormat = DEFAULT_TIME_FORMAT;
+ }
+ setTimeFormat(timeFormat);
+ }
+
@Override
public String format(LogRecord record) {
StringBuilder sb = new StringBuilder();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]