LF-Lin opened a new pull request #800:
URL: https://github.com/apache/logging-log4j2/pull/800


   This PR fixes the [issue](https://issues.apache.org/jira/browse/LOG4J2-3019) 
that `HtmlLayoutTest.testLayoutWithDatePatternFixedFormat` test fails on 
Windows. 
   
   AFAIK, this test only fails in a special case on Windows, that is, the 
_Windows display language_ and _Regional format_ are inconsistent. For example, 
my settings are:
   ```
   Windows display language: zh_CN
   Regional format: en_NL
   ```
   the result will be: `[ERROR]   
HtmlLayoutTest.testLayoutWithDatePatternFixedFormat:245->testLayoutWithDatePatternFixedFormat:277
 Incorrect date=<td>02 十一月 2012 21:34:02,123</td>, format=DATE, timezone=GMT+8 
==> expected: <<td>02 Nov 2012 21:32,123</td>> but was: <<td>02 十一月 2012 
21:34:02,123</td>>`
   
   ---------
   
   I think the reason is that 
   - the actual value that generated from `layout` at [line 
255](https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java#L255)
 using `Locale.getDefault()` (zh_CN, which causes `02 十一月`), 
   - the expected value that generated from `DateTimeFormatter.ofPattern()` at 
[line 
269](https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java#L269)
 using `Locale.Category.FORMAT` (en_NL, which causes `02 Nov`). 
    
   It is easy to avoid this issue by manually setting the `locale` argument for 
`DateTimeFormatter.ofPattern()`, and the results will use the 
`Locale.getDefault()`.


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