emoncms.log Time incorrect

Hi All.

I have been chasing dow a tricky bug and think i have finally reached the solution, however after looking through the emoncms.log file this morning after the backup script ran, I see that the times are not 1 hour behind.

I am using a home Linux PC to log all of the data on and the I have got my backup script appending a line into the emoncms.log file when it does things so that I can investigate.

I am guessing that the cause of this is now we have entered BST, so the php script will need updating, but where do I begin?

Jimmy

TrystanLea's picture

Re: emoncms.log Time incorrect

Hello Jimmy, you should not need to edit any scripts to deal with BST. Could it be time settings related on your computer?

manicmoddin's picture

Re: emoncms.log Time incorrect

Hi,

I thought that as well, However please see the attached homeserv.txt

I have broken the document into logical sections.

First is me running the timezone configurer and its output (Europe / London)

Then the emoncms.log
Before writing anything to it with the new timezone.

Note the 06:18:44.005 Disconnect, then the INFO after that at 7:18
Then the restart of the MQTT_INput script again at 6:18

The next section is me just writing to the emoncms with the php page, so I restarted the MQTT_INPUT service
This still prints the time in UTC

The dbBackup appends the emoncms.log directly from bash, (echo "Some Text" | tee -a /var/log/emoncms.log /var/log/dbBackup.log)

Its not the end of the world, today was the first day that the backup script worked as it should, so I'm very happy about that as I have 5GB of feed data and the mysqldump method is a nightmare on everything, 30+ min downtime to backup on a morning. Using percona Xtrabackup I have <30 seconds of missed feeds, If I move that to 2-3AM It wont be anything to worry about at all.

 

Oh and incase it matters the system details are

Server Information

Emoncms Version 9.4 | 2016.03.15

Server OS Linux 3.13.0-79-generic

Host homeserv homeserv.localdomain (127.0.1.1)

Date 2016-03-28 14:54:45 BST

Uptime 14:54:46 up 9 days, 15 min, 3 users, load average: 1.02, 0.90, 0.97

HTTP Server Apache/2.4.7 (Ubuntu) HTTP/1.1 CGI/1.1 80

Database Version MySQL 5.5.47-0ubuntu0.14.04.1

Host localhost (127.0.0.1)

Date 2016-03-28 14:54:45 (UTC 01:00‌​)

Stats Uptime: 782709 Threads: 3 Questions: 8136554 Slow queries: 0 Opens: 380 

Flush tables: 21 Open tables: 33 Queries per second avg: 10.395

MQTT Version n/a

Host localhost:1883 (127.0.0.1)

PHP Version 5.5.9-1ubuntu4.14 (Zend Version 2.5.0)

Modules Core   date   ereg   libxml   openssl   pcre   zlib   bcmath   bz2   calendar   ctype   dba   dom   hash   fileinfo   filter   ftp   gettext   SPL   iconv   mbstring   session   posix   Reflection   standard   shmop   SimpleXML   soap   sockets   Phar   exif   sysvmsg   sysvsem   sysvshm   tokenizer   wddx   xml   xmlreader   xmlwriter   zip   apache2handler   PDO   curl   gd   json   mosquitto   mysql   mysqli   pdo_mysql   readline   redis   mhash   Zend OPcache  
manicmoddin's picture

Re: emoncms.log Time incorrect

Interestingly though, creating a php page with the following code

 

<?php

echo date("H:m:s");

?>

and running it with

php date.php

returns the correct time: 15:03:16

 

Hmmm... What generates the date timmestamp for emoncms.log?

 

Jimmy

 

manicmoddin's picture

Re: emoncms.log Time incorrect

Ok I found it, its in Lib/EmonLogger.php Line 69

$now = DateTime::createFromFormat('U', (int)$now); // Only use UTC for logs

Its hard written into the logging script,

I'll adapt my backup script to match...

 

Jimmy

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.