Set time_zone to logging appenders

I try to set time_zone in config.yaml to different value than UTC.
I saw in the config.yaml link to dropwizard but that link seems not to work.
I tried to set time_zone for appenders with values:
time_zone: Europe/Warsaw
time_zone: "Europe/Warsaw"
time_zone: UTC+2
and none of them works.
what is a correct pattern for setting that value?
Does patterns UTC+2 or Continent/City respects time changes?

After digging and testing what I found is:

  • I’ve found mentioned dropwizard on the gitHub under 1.3.8 tag. After reading, time_zone was only mentioned by using UTC as a default value and other mentioned value was system when logger get time zone from host. But after setting correct time zone in the container (I use docker) nothing has changed in the logs and time was 2h back in time.
  • I’ve found in pom.xml that graphhopper uses slf4j logging provider, and that leaded me to the final solution which I used.
    Instead of setting time_zone parameter (which seemed not working for me) I edited log_format value into:
    log_format: '%d{"YYYY-MM-dd HH:mm:ss.SSS", Europe/Warsaw} [%thread] %-5level %logger{36} - %msg%n'
    (notice Europe/Warsaw after time and coma sign. Pay attention also if using single quote or double quotes).

I’ve deleted completely time_zone line. According to dropwizard docummentation UTC value is default for logging, so I assume that parameter simply doesn’t work.
If anyone has anything to comment, please let me know. At this point I will not test anything else. I will keep that solution which suits me.

2 Likes
Powered by Discourse