2

i set aws system timezone to IST.

$ timedatectl
  Local time: Fri 2018-06-15 16:43:20 IST
  Universal time: Fri 2018-06-15 11:13:20 UTC
  RTC time: Fri 2018-06-15 11:13:20
  Time zone: Asia/Kolkata (IST, +0530)
  Network time on: yes
  NTP synchronized: no
  RTC in local TZ: no

but play framework logs are still generating with UTC time zone

2018-06-15 11:22:46,002 [INFO] from application in main - Creating Pool for datasource 'default'

i am using play framework 2.5 and i am running play framework by sudo sbt clean dist

Govind Singh
  • 15,282
  • 14
  • 72
  • 106
  • 1
    Perhaps UTC is set on [logback PatternLayout](https://logback.qos.ch/manual/layouts.html) configuration, from the docs, the pattern can be set to `date{pattern, timezone}` thus forcing log records to be in a different timezone than the OS. – LMC Jun 15 '18 at 12:57

1 Answers1

2

Try passing the timezone to the JVM like so:

sbt -Duser.timezone=Asia/Kolkata

In conf/logback.xml there should be a conversion word %date in an element similar to

<pattern>%date [%level] from %logger in %thread - %message%n%xException</pattern> 

Date conversion word has format date{pattern, timezone} and by default:

...in the absence of the timezone parameter, the default timezone of the host Java platform is used.

Therefore the JVM, and not the OS, has the final word on the timezone.

Mario Galic
  • 47,285
  • 6
  • 56
  • 98