AMashenkov commented on a change in pull request #266:
URL: https://github.com/apache/ignite-3/pull/266#discussion_r686032938



##########
File path: 
modules/core/src/main/java/org/apache/ignite/lang/JavaLoggerFormatter.java
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.lang;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * Formatter for JUL logger.
+ */
+public class JavaLoggerFormatter extends Formatter {
+    /** See {@link Level#OFF}. */
+    private static final int SEVERITY_OFF = Integer.MAX_VALUE;
+
+    /** See {@link Level#SEVERE}. */
+    private static final int SEVERITY_SEVERE = 1000;
+
+    /** See {@link Level#WARNING}. */
+    private static final int SEVERITY_WARNING = 900;
+
+    /** See {@link Level#INFO}. */
+    private static final int SEVERITY_INFO = 800;
+
+    /** See {@link Level#CONFIG}. */
+    private static final int SEVERITY_CONFIG = 700;
+
+    /** See {@link Level#FINE}. */
+    private static final int SEVERITY_FINE = 500;
+
+    /** See {@link Level#FINER}. */
+    private static final int SEVERITY_FINER = 400;
+
+    /** See {@link Level#ALL}. */
+    private static final int SEVERITY_ALL = Integer.MIN_VALUE;
+
+    /** Ascending order for binary search matching the list of severity 
constants. */
+    private static final int[] LEVEL_VALUES = new int[] {
+        SEVERITY_ALL, SEVERITY_FINER,
+        SEVERITY_FINE, SEVERITY_CONFIG, SEVERITY_INFO,
+        SEVERITY_WARNING, SEVERITY_SEVERE, SEVERITY_OFF
+    };
+
+    /** Name for anonymous loggers. */
+    public static final String ANONYMOUS_LOGGER_NAME = "UNKNOWN";
+
+    /** Date formatter. */
+    private static final ThreadLocal<SimpleDateFormat> DATE_FORMATTER = new 
ThreadLocal<SimpleDateFormat>() {
+        /** {@inheritDoc} */
+        @Override protected SimpleDateFormat initialValue() {
+            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS Z");
+        }
+    };

Review comment:
       Let's use DateTimeFormatter from Java Time API instead. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to