ngocnhan-tran1996 commented on issue #2666:
URL: 
https://github.com/apache/logging-log4j2/issues/2666#issuecomment-2173652696

   > @ngocnhan-tran1996, thanks for the report, I've submitted #2667 fixing the 
issue. I would really appreciate it if you can
   > 
   > 1. Checkout the `fix/2.x/JTL-prop-subs` branch
   > 2. Quickly build it using `./mvnw install -DskipTests` – see 
[`BUILDING.adoc`](/apache/logging-log4j2/blob/2.x/BUILDING.adoc) for details
   > 3. And test the installed `2.24.0-SNAPSHOT` artifacts in your project
   
   @vy 
   
   Thanks for the answer, I have test on cases with below `EcsLayout.json` and 
`log4j2.xml`. I type wrong timezone value, GMT instead UTC.
   
   File `EcsLayout.json`
   ```json
   {
     "message1": {
       "$resolver": "pattern",
       "pattern": "${env:TZ:-%d{yyyy-MM-dd HH:mm:ss}{GMT+00}}"
     },
     "message2": {
       "$resolver": "pattern",
       "pattern": "${env:TZ:-${TIMEZONE}}"
     },
     "message3": {
       "$resolver": "pattern",
       "pattern": "${env:TZ:-%d{yyyy-MM-dd HH:mm:ss}}"
     }
   }
   ```
   
   File `log4j2.xml`
   ```xml
   <Properties>
       <Property name="TIMEZONE">%d{yyyy-MM-dd HH:mm:ss}{GMT+03}</Property>
   </Properties>
   ```
   
   
   **1. Environment `TZ` does not exists**
   
   The result
   
   ```json
   {"message1":"2024-06-17 21:49:18,263","message2":"2024-06-17 
17:49:18","message3":"2024-06-17 21:49:18"}
   ```
   
   **message2** and **message3** work as my expected
   
   **2. Environment `TZ` do exists**
   
   
![env-tz](https://github.com/apache/logging-log4j2/assets/107504266/1d23816d-d7cb-412e-8413-107ab8dcdd24)
   
   The result
   
   ```json
   
   {"message1":"2024-06-17 14:53}","message2":"2024-06-17 
21:53","message3":"2024-06-17 21:53}"}
   ```
   
   **message2** works as my expected
   
   I dont know why **message1** and **message3** have brace `}` at the end
   
   **Note:** GMT in my local is setting to +07:00


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