jerrypeng closed pull request #1890: Fixed the filename of the log files in 
threaded mode
URL: https://github.com/apache/incubator-pulsar/pull/1890
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/conf/log4j2.yaml b/conf/log4j2.yaml
index 57ce64f764..2462ba6a1b 100644
--- a/conf/log4j2.yaml
+++ b/conf/log4j2.yaml
@@ -126,7 +126,7 @@ Configuration:
                   -
                     RollingFile:
                       name: "Rolling-${ctx:function}"
-                      fileName : 
"${sys:pulsar.log.dir}/functions/${ctx:function}/${sys:pulsar.log.file}-${ctx:instance}.log"
+                      fileName : 
"${sys:pulsar.log.dir}/functions/${ctx:function}/${ctx:functionname}-${ctx:instance}.log"
                       filePattern : 
"${sys:pulsar.log.dir}/functions/${sys:pulsar.log.file}-${ctx:instance}-%d{MM-dd-yyyy}-%i.log.gz"
                       PatternLayout:
                         Pattern: "%d{ABSOLUTE} %level{length=5} [%thread] 
[instance: %X{instance}] %logger{1} - %msg%n"
diff --git 
a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
 
b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
index 28e91f3c3b..861f485d3a 100644
--- 
a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
+++ 
b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
@@ -125,6 +125,7 @@ public JavaInstanceRunnable(InstanceConfig instanceConfig,
     JavaInstance setupJavaInstance() throws Exception {
         // initialize the thread context
         ThreadContext.put("function", 
FunctionDetailsUtils.getFullyQualifiedName(instanceConfig.getFunctionDetails()));
+        ThreadContext.put("functionname", 
instanceConfig.getFunctionDetails().getName());
         ThreadContext.put("instance", instanceConfig.getInstanceId());
 
         log.info("Starting Java Instance {}", 
instanceConfig.getFunctionDetails().getName());


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to