Gossamer Forum
Home : Products : DBMan : Customization :

Default.log

Quote Reply
Default.log
Up until recently I havn't had much need to look into my log file.
I noticed it is not logging the date correctly. It's loging as:
qwerty logged on at 07:55:00 on 31-Dec-1969 from
and It's also not logging $ENV{'REMOTE_HOST'}.
It was logging ok offline on windows as:
admin added record: 356 at 00:04:10 on 22-Mar-2000 from 127.0.0.1
I,m using &get_date elsewhere on the site, and the dates are fine.
Any thoughts?

thanks
Bob
http://totallyfreeads.com


Quote Reply
Re: Default.log In reply to
lanerj:

I think this one where you will need to search the forums for "1969" and see what others have done to fix this.

I believe there are some solutions provided, but which would depend on how you have your date display setup.

As far as not logging $ENV{'REMOTE_HOST'}, I have discovered that Hypermart for example does not recognize this .. but in the FAQ noted below there is a fix which may also help with your host provider.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Default.log In reply to
Bob, could you post two subroutines here, so I can get a look at them? I need to see sub get_date from the db.cgi file and sub auth_logging from the auth.pl file. There are so many different permutations of these going around, that I'm not sure what you have to be sure what to tell you. Smile


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Default.log In reply to
JPD,
this is my sub_get date:

sub get_date {
# --------------------------------------------------------
# Returns the date in the format "dd-mmm-yyyy".
# Warning: If you change the default format, you must also modify the &date_to_unix
# subroutine below which converts your date format into a unix time in seconds for sorting
# purposes.
my ($time) = $_[0];
($time) or ($time = time());
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day-$months[$mon]-$year";
}

And this is my auth_logging :

sub auth_logging {
# --------------------------------------------------------
# Logs an action to the database. Takes as input an action, and
# optionally a user id. If no user id is passed in, it get's one from
# the global $db_userid.

my ($action, $uid) = @_;
my ($time) = &get_time; # Change time/date format globally
my ($date) = &get_date; # in get_time and get_date.
if (!$uid) {
$db_userid ?
($uid = $db_userid) :
($uid = "UNKNOWN"); # Hopefully we shouldn't see this..
}
open (LOG, ">>$auth_log_file") || &cgierr("unable to open log file: $auth_log_file. Reason: $!\n");
flock (LOG, 2) unless (!$db_use_flock);
print LOG "$uid $action at $time on $date from $ENV{'REMOTE_HOST'}\n";
close AUTH; # releases file lock.
}

I'm using get_date in two other areas - as a date field, and in autodelete. These two dates return fine.

thanks

Bob
http://totallyfreeads.com


Quote Reply
Re: Default.log In reply to
LoisC,

Searched your site for $ENV{'REMOTE_HOST'}, and a few variants, which returned some results but nothing relating to this subject.
Please let me know where I should look.

Thanks

Bob
http://totallyfreeads.com

Quote Reply
Re: Default.log In reply to
Okay. In auth.pl, try changing the &get_date line to

my ($date) = &get_date(time()); # in get_time and get_date.

See if that works any better.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Default.log In reply to
lanerj

The fix is called "Hypermart fix for auth.pl file" listed under the "Admin" section of the FAQ below.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Default.log In reply to
Thanks JPD and LoisC, both those fixes worked.

thanks

BoB
http://totallyfreeads.com