Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Is there a way to change the Mage::log() timestamp in magento? I would prefer it to match my timezone.

share|improve this question

migrated from stackoverflow.com Dec 2 '11 at 23:31

This question came from our site for professional and enthusiast programmers.

    
I'm sure it's possible. Have you looked at the source? –  Colin Dec 2 '11 at 19:27
    
I know it all extends from the Zend_Log::log() method, which has a hard-coded date('c') for the timestamp placeholder in the format. but I'm not sure if there is a way to adjust this...I don't think so. –  veilig Dec 2 '11 at 20:43
1  
If you have access to the source code, you can modify anything you'd like, can't you? –  Colin Dec 2 '11 at 20:44

2 Answers 2

I found this which might be some help.

Magento internally sets all cron dates to occur in GMT, it actually overrides the server php time zone settings so that all log events and all cron time schedules are triggered in the GMT timezone - you can see this in Mage.php on line 527. All php time functions called within Magento will be in GMT as a result (like the timestamp in the log call above).

Magento then adds back your timezone offset based on your locale settings when it shows you times in the admin panel. It does this so you can run multiple stores in different timezones based on your locale choice and ideally you would never know nor care about this - but it makes debugging cron events really confusing.

share|improve this answer

Since I am from India, in app/mage.php at around line number 767, I modified this to be:

date_default_timezone_set('Asia/Calcutta');

Then it started displaying my local time as time stamp in log files. So you can add your own time zone...I'm sure it will work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.