Not logged in. · Lost password · Register
Forum: Support Bug reports and troubleshooting RSS
Log viewer timezone
Page:  previous  1  2  3  4  next 
jense #16
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
In reply to post ID 10204
Thanks, however, I'm well aware of these.  It even strengthens my point to use GMT rather than anything else: time stamps that are stored in GMT are *under any circumstances* unique.  Anything else is the task of the user and the CP offers options to display the correct time for him.  That's the reason why me gets the correct time displayed *anywhere* ...

So, now back to any fixes:
Since time stamps in local time are stored all over the place in UNB, I do not think (I would even strongly oppose) that these should be changed.  It will definitely break something somewhere.  The most obvious problem is that any old log files are void as soon as the time zone used in these files gets changed.
The only backward compatible change is that the times, which are displayed by the log viewer, are converted to the user's time zone.  Such a change is trivial and UNB already provides functions to exactly do this.  Then, one is left with the problem that one log file has dates spread over two days.  This is most easily fixed by two table rows that display once the date of the successive times.

In short: for the sake of backwards compatibility do not touch the stored time stamps.  Just change the displayed time...
Alala, Alala, Gimme three wishes - CSS
Avatar
Saxtus #17
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
According to your solution, people that are (for example's sake) 8 hours away of GMT they will not be able to see all day's log some hours of the day, because either they will see previous day's file that doesn't have latest records or an empty file that just haven't created yet.
So it seems I have to mention for third time in the same thread that it will break the log's filter function and it seems (at least to me) by far the most time-consuming task for Yves to fix...
The Answer to Life, the Universe, and Everything = 42
jense #18
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
Quote by Saxtus:
According to your solution, people that are (for example's sake) 8 hours away of GMT they will not be able to see all day's log some hours of the day, because either they will see previous day's file that doesn't have latest records or an empty file that just haven't created yet.
Taking this statement serious, you apparently check your files every day at 23:59:59 server time...  In any other case, you have to check two files anyway.  The 'date' in the form is nothing more and nothing less than a file name and should be seen as just that.
So it seems I have to mention for third time in the same thread that it will break the log's filter function and it seems (at least to me) by far the most time-consuming task for Yves to fix...
This is a strong claim that you did actually verify by looking into the source code?  Did you even looked at it?  I did, so please do not treat me as if I am an idiot.

Please answer the following questions first
  • if the actual time zome in the files is changed, how will you achieve that *any other previous log file* becomes incorrect?
  • if the time zone stays the same, how will you get the correct date for a single line (the file spreads two days in local time)?

My suggestion involves minimal changes (I *did* check that), does not break anything (even no filter and yes I *did* check that).  Anything else is just documentation changes (how to interpret the numbers at the top of the form, for instance).
Alala, Alala, Gimme three wishes - CSS
Avatar
Saxtus #19
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
Quote by jense:
please do not treat me as if I am an idiot.
I did not. I've just stated the truth: For two consecutive posts you chose not to answer that part of my post so I assumed that you read it too fast and skipped it both times.

Quote by jense:
* if the actual time zome in the files is changed, how will you achieve that *any other previous log file* becomes incorrect?
What happened to your previous statement: "All in all its just log files..."?

I am not going to argue anymore, Yves asked for suggestions and we both give ours.
I still can't see how your suggestion will solve DST problems but hey, I am probably the idiot here...

I guess Yves is the best person to tell us what will finally happen (if anything happens at all).
The Answer to Life, the Universe, and Everything = 42
jense #20
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
Quote by Saxtus:
What happened to your previous statement: "All in all its just log
files..."?
Well, this does not mean that they should be rendered invalid by
something, which I call a cosmetic change (and that's indeed what I
meant - I'm sorry that I didn't put it clearer).  Because of this I
already had to change my mind concerning using GMT.

I am not going to argue anymore, Yves asked for suggestions and
we both give ours.
One a funny side note: it was just your suggestion to only convert the
times and dates in the controlpanel output... :-)

I'll prepare a patch tonight, which just does this, so that you can
check if anything breaks seriously.
Alala, Alala, Gimme three wishes - CSS
jense #21
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
Please find attached a modified logviewer.php.  All changes are confined in this file and do not touch the board itself.

What changed:
  • all dates and times are displayed in the user's time zone just like in the forums, i.e. these times now coincide. Note: the display format is the same as before (no localization).
  • the 'time' input field is converted to the board's time zone and then compared, i.e. >23:00 even matches 01:00 of the next day in the users time zone (if it's the same day in the log file)
  • cosmetic: if the user's and board's time zone differ $UNB_T['_logviewer.log file'] is shown rather then 'log date'.  At present, you need to define this variable yourself in logviewer.en.php
Alala, Alala, Gimme three wishes - CSS
The author has attached one file to this post:
logviewer.php 17.7 kBytes
You have no permission to open this file.
jense #22
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
... and here comes the diff.
Alala, Alala, Gimme three wishes - CSS
The author has attached one file to this post:
logviewer.diff 2.8 kBytes
You have no permission to open this file.
Avatar
Saxtus #23
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
In reply to post #21
Excellent work. It works as expected (i.e. for my server, log begins from 7am and ends at 7am of next day).
I guess till Sunday, when DST at US kicks-in and destroys everything board-wide until the end of the month! ^_^
The Answer to Life, the Universe, and Everything = 42
Avatar
Yves (Administrator) #24
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I'm checking in here too rarely...

No patch please, I have already modified that file. What happened by now: I have changed the code as suggested by Saxtus. So all timestamps are converted to the board's default timezone, respecting the board's default DST switch, before a log line is written. The rest is the same: File name and time format are derived from that timestamp. It's only converted from the server's system timezone to the board's default timezone. For most cases this doesn't change a thing. Server in DE, board admin in DE -> no change. Only this changes: Server in NY, board admin in Australia -> log entries are now in some Australian timezone (UTC+08 or so) instead of NY time (UTC-05 or so).

The only effects this has on the uniqueness of log entries:
  • When updating the board code from yesterday to tomorrow, log entries' timestamps may either skip to the future or repeat a few hours. If the board timezone and system timezone already match, nothing changes at all.
  • When switching from ST to DST, either one hour is skipped or repeated, each once in a year.

Converting to UTC instead of board timezone only eliminates the second point, but introduces massive deviations from day breaks comparing to any local timezone. The day filter is directly hard-wired to the filename and only this single file is scanned for log entries. So you can only display one day at a time. Adding stuff like a day separator row and things sound weird to me, also the user is likely to regularly get confused with time of day: Filter for 2009-03-02 and 21:xx, you may end up one day off because 21:00 UTC is in fact 03:00 in your timezone - of 2009-03-03!

To move a little out of this stone age, I'm not going to save log entries into files anymore in newer versions of software that I write. Instead everything goes into the database when there is already one. This avoids any file access issues and allows for better filtering and reading beyond single days. Only critical database connection errors need to be logged into files. So I feel like I don't want to put too much work into this log mechanism when already working on UNB2...

As I said, the change of the log timezone to the board's default timezone will be included in the next release. I hope to get some more pending changes done tomorrow and put up a new code snapshot at last until the weekend.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Saxtus #25
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
About DST problems for servers hosted in US:
Does the current system can display correct time for all users in board (regardless of log files) with the current system that asks user about their UTC deviation (instead of town) or we have going to have weird times from this Sunday? :'(
The Answer to Life, the Universe, and Everything = 42
Avatar
Yves (Administrator) #26
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There's like a thousand different DST interval rules in the world and neither PHP4 nor UNB knows any of them. Users can select their base timezone and enable the DST option. This will add one hour to the base timezone whenever the server's OS thinks that now is summer. If your server is located in and configured for NY and you're in CA, and they have different DST intervals, you'll end up with the wrong time displayed. This has been and will always be in UNB1.

I've heard though that PHP 5.x shall include a more sophisticated logic for that. If it's useful, I'll use that in UNB2.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Saxtus #27
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
PHP5 already has everything you may need, take a look at post #10198 (here is the output of DateTimeZone::listAbbreviations() in my server running PHP5)
There is nothing like this in PHP4 so people are forced to use manual methods, like this.
My suggestion was to keep current time calculations as is when PHP4 is detected and implement the PHP5 functions when PHP5 is detected.
The only drawback I see is that if someone decides to move the board from PHP5, back to PHP4, will mess up the timezone settings.
The Answer to Life, the Universe, and Everything = 42
This post was edited on 2009-03-05, 09:28 by Saxtus.
jense #28
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
In reply to post #24
Quote by Yves on 2009-03-02, 18:51:
Any more suggestions as I'm applying that change?
Quote by Yves:
I'm checking in here too rarely...
This does not really fit, does it?
Alala, Alala, Gimme three wishes - CSS
Avatar
Saxtus #29
Member since Jan 2007 · 84 posts · Location: Athens, Greece
Group memberships: Members
Show profile · Link to this post
Real job probably interfered! :rolleyes:
I just hope that he appreciates our enthusiasm.
The Answer to Life, the Universe, and Everything = 42
jense #30
Member since Nov 2006 · 327 posts · Location: Dortmund
Group memberships: Members
Show profile · Link to this post
In reply to post #27
Quote by Saxtus:
The only drawback I see is that if someone decides to move the board from PHP5, back to PHP4, will mess up the timezone settings.
Well, we already have #10092.  So PHP4 somehow isn't a valid target platform anymore...
Alala, Alala, Gimme three wishes - CSS
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  previous  1  2  3  4  next 
Go to forum
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Page created in 391.1 ms (225.8 ms) · 141 database queries in 291.7 ms
Current time: 2013-05-23, 09:52:29 (UTC +02:00)