lhotari commented on code in PR #25515:
URL: https://github.com/apache/pulsar/pull/25515#discussion_r3080609107


##########
conf/log4j2.yaml:
##########
@@ -66,27 +66,48 @@ Configuration:
 
     # Rolling file appender configuration
     RollingFile:
-      name: RollingFile
-      fileName: "${sys:pulsar.log.dir}/${sys:pulsar.log.file}"
-      filePattern: 
"${sys:pulsar.log.dir}/${sys:pulsar.log.file}-%d{MM-dd-yyyy}-%i.log.gz"
-      immediateFlush: ${sys:pulsar.log.immediateFlush}
-      PatternLayout:
-        Pattern: "%d{ISO8601_OFFSET_DATE_TIME_HHMM} [%t] %-5level %logger{36} 
- %msg %X%n"
-      Policies:
-        TimeBasedTriggeringPolicy:
-          interval: 1
-          modulate: true
-        SizeBasedTriggeringPolicy:
-          size: 1 GB
-      # Delete file older than 30days
-      DefaultRolloverStrategy:
-          Delete:
-            basePath: ${sys:pulsar.log.dir}
-            maxDepth: 2
-            IfFileName:
-              glob: "${sys:pulsar.log.file}*log.gz"
-            IfLastModified:
-              age: 30d
+      - name: RollingFile
+        fileName: "${sys:pulsar.log.dir}/${sys:pulsar.log.file}"
+        filePattern: 
"${sys:pulsar.log.dir}/${sys:pulsar.log.file}-%d{MM-dd-yyyy}-%i.log.gz"
+        immediateFlush: ${sys:pulsar.log.immediateFlush}
+        PatternLayout:
+          Pattern: "%d{ISO8601_OFFSET_DATE_TIME_HHMM} [%t] %-5level 
%logger{36} - %msg %X%n"
+        Policies:
+          TimeBasedTriggeringPolicy:
+            interval: 1
+            modulate: true
+          SizeBasedTriggeringPolicy:
+            size: 1 GB
+        # Delete file older than 30days
+        DefaultRolloverStrategy:
+            Delete:
+              basePath: ${sys:pulsar.log.dir}
+              maxDepth: 2
+              IfFileName:
+                glob: "${sys:pulsar.log.file}*log.gz"
+              IfLastModified:
+                age: 30d
+      - name: RollingFileJson
+        fileName: "${sys:pulsar.log.dir}/${sys:pulsar.log.file}"
+        filePattern: 
"${sys:pulsar.log.dir}/${sys:pulsar.log.file}-%d{MM-dd-yyyy}-%i.log.gz"
+        immediateFlush: ${sys:pulsar.log.immediateFlush}
+        JsonTemplateLayout:
+          eventTemplateUri: ${sys:pulsar.log.console.json.template}
+        Policies:
+          TimeBasedTriggeringPolicy:
+            interval: 1
+            modulate: true
+          SizeBasedTriggeringPolicy:
+            size: 1 GB
+        # Delete file older than 30days
+        DefaultRolloverStrategy:
+            Delete:
+              basePath: ${sys:pulsar.log.dir}
+              maxDepth: 2
+              IfFileName:
+                glob: "${sys:pulsar.log.file}*log.gz"
+              IfLastModified:
+                age: 30d

Review Comment:
   The SystemPropertyArbiter solution is also provided as an example in the 
docs: https://logging.apache.org/log4j/2.x/manual/configuration.html#arbiters . 
file example: 
https://github.com/apache/logging-log4j2/blob/rel/2.25.3/src/site/antora/modules/ROOT/examples/manual/configuration/arbiters.yaml#L22-L29



-- 
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