You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/10/23 05:57:59 UTC

[pulsar] branch master updated: Add a simple log4j configuration for PrometheusMetricsServer (#2819)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new f0a81cb  Add a simple log4j configuration for PrometheusMetricsServer (#2819)
f0a81cb is described below

commit f0a81cb7b38d16f0901451a43ac8c2aa569639b7
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Mon Oct 22 22:57:55 2018 -0700

    Add a simple log4j configuration for PrometheusMetricsServer (#2819)
    
    * Added a simple log4j configuration for PrometheusMetricsServer
    
    * Fixed compile
    
    * Fix header
---
 .../resources/prometheus_metricsserver_log4j2.yml  | 29 ++++++++++++++++++++++
 .../functions/runtime/KubernetesRuntime.java       |  1 +
 2 files changed, 30 insertions(+)

diff --git a/pulsar-functions/metrics/src/main/resources/prometheus_metricsserver_log4j2.yml b/pulsar-functions/metrics/src/main/resources/prometheus_metricsserver_log4j2.yml
new file mode 100644
index 0000000..3ad41cb
--- /dev/null
+++ b/pulsar-functions/metrics/src/main/resources/prometheus_metricsserver_log4j2.yml
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+Configuration:
+  name: pulsar-functions-kubernetes-prometheus-metrics-server
+  monitorInterval: 30
+  Appenders:
+    # Console
+    Console:
+      name: Console
+      target: SYSTEM_OUT
+      PatternLayout:
+        Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
index 7a11111..ddfe36f 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
@@ -621,6 +621,7 @@ class KubernetesRuntime implements Runtime {
         args.add("java");
         args.add("-cp");
         args.add(prometheusMetricsServerFile);
+        args.add("-Dlog4j.configurationFile=prometheus_metricsserver_log4j2.yml");
         args.add("-Xmx" + String.valueOf(prometheusMetricsServerRam));
         args.add(PrometheusMetricsServer.class.getName());
         args.add("--function_details");