Magento log files not showing correct timezone

How to set the exception.log and system.log showing timezone of UTC+8?
Timezone settings in admin and web server is set to UTC+8 already, but the time logged in the files still showing UTC.
Timezone setting in Magento adminTimezone setting in web server
This is the system specification:
Magento CE 1.9.3.3
PHP 5.6.31
Windows Server 2012 R2
IIS 8.5
LVL 1
Boon Chye PhangAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NerdsOfTechTechnology ScientistCommented:
First you must also change the PHP date.timezone. Change this in php.ini:

date.timezone = "Asia/Singapore"

Open in new window


Or, you can modify the PHP timezone in run-time. In run-time, you can define the timezone for mySQL as well. You can do this with a run-once script:

<?php
//run once to define timezone for both PHP and mySQL

define('TIMEZONE', 'Asia/Singapore');
date_default_timezone_set(TIMEZONE);

$now = new DateTime();
$mins = $now->getOffset() / 60;
$sgn = ($mins < 0 ? -1 : 1);
$mins = abs($mins);
$hrs = floor($mins / 60);
$mins -= $hrs * 60;
$offset = sprintf('%+d:%02d', $hrs*$sgn, $mins);

//Your DB Connection
$db = new PDO('mysql:host=localhost;dbname=test', 'dbuser', 'dbpassword');
$db->exec("SET time_zone='$offset';");
?>

Open in new window


Afterward, test.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NerdsOfTechTechnology ScientistCommented:
Setting timezone is the solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Magento

From novice to tech pro — start learning today.