You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/08/12 14:16:43 UTC

[GitHub] [skywalking] mm23504570 commented on a change in pull request #3250: Feature logger config

mm23504570 commented on a change in pull request #3250: Feature logger config
URL: https://github.com/apache/skywalking/pull/3250#discussion_r312947371
 
 

 ##########
 File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/logging/core/PatternLogger.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed 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.skywalking.apm.agent.core.logging.core;
+
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.util.PropertyPlaceholderHelper;
+import org.apache.skywalking.apm.util.StringUtil;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * @author alvin
+ */
+public class PatternLogger extends EasyLogger {
 
 Review comment:
   1. I think the EasyLogger is a default choice. The default is concat Strings.
   String format(LogLevel level, String message, Throwable t) {
           return StringUtil.join(' ', level.name(),
               new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()),
               Thread.currentThread().getName(),
               targetClass,
               ": ",
               message,
               t == null ? "" : format(t)
           );
       }
   ```
   It has hard to changeing the order. You mentioned pattern means '{}'? But how can i change the above the order?
   Use `%{level} %{timestamp} %{thread} %{class} : %{msg} %{throwable}` this method to express the format of the log is more clear.
   
   2. 
   * If we use system.out to println log. It will be print together with agented Progress. Some log-collector collect log need use same logformat.
   * More flexible. We can log something which we want.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services