-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FixedDateFormat
incorrectly calculates DST for America/Santiago
time zone
#2943
Comments
This is probably a JDK or operating system update problem. Do you have the latest version of JDK 17? Some countries have stable daylight saving time rules and the JDK and operating system know them for years in advance. Other countries decide the dates of the change between winter and summer time at the last moment and you need for that data to be included in the JDK and OS. |
@ppkarwasz Thank you for the response . |
Can you show us your configuration file? |
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p %c{1}:%L - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration> |
When you use
Even better, could your provide a test case? The test cases for |
As of now I have this simple java class to reproduce the issue . Please note to reproduce this you have to change the system date / time to 8th September midnight to 9th September midnight . import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.TimeZone;
public class SimpleLog4jExample {
// Create a logger instance
private static final Logger logger = LogManager.getLogger(SimpleLog4jExample.class);
public static void main(String[] args) {
// Log messages of different levels
String tzid = "America/Santiago";
// tzid = readln("Enter time zone ID [" + tzid + "]: ", tzid);
TimeZone tz = TimeZone.getTimeZone(tzid);
TimeZone.setDefault(tz);
logger.info("This is an info message");
logger.warn("This is a warning message");
logger.error("This is an error message");
} |
I confirmed the bug using two additional test cases in our Lines 280 to 308 in ef34c99
The modified test is available in the We are of course happy if someone can provide a PR. |
FixedDateFormat
incorrectly calculates DST for America/Santiago
time zone
Yet another
|
This seems to follow the same pattern as |
Description
After DST time change in Chile , the logs are not showing the correct time with plain %d date pattern on September 8th but after midnight of 9th September the logs are printing correct date without having to change anything
but when we use date format with time zone it shows correct date on 8th September also .
Configuration
Version: 2.24
Operating system: RHEL
JDK: openJDK17
Logs
Reproduction
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]
Here’s the steps to reproduce it:
Here is the java code and config file :
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.TimeZone;
public class SimpleLog4jExample {
}
log4j2.xml
The text was updated successfully, but these errors were encountered: