#129750 - 2004-11-17 06:13 PM
Tracking/log system
|
1984
Starting to like KiXtart
Registered: 2003-08-14
Posts: 150
|
Need some brain storm here, boys n girls!
I’ve done a small program using kixfroms, placed on a network share, and executed by several users directly from the share.
And now:
I need to collect info (logfile) about which users are currently using the program. A logfile generated containing @Userid and date/time for when that user start the program and when exiting the program. Some kind of time stamp, in and out!
Function TDinout $date = Join(Split(@date,"/"),"") $file = $date+'.log' $path = '\\server\folder\logdir
if $form.visible $ = Open(1,$path +'\'+$Sfile,5) $ = WriteLine(1,@USERID+ " Open instance"+@CRLF) $ = WriteLine(1,@DATE+" "+@TIME+ @CRLF) $ = Close(1) endif
if $form.hide $ = Open(1,$path +'\'+$Sfile,5) $ = WriteLine(1,@USERID+ " Close instance"+@CRLF) $ = WriteLine(1,@DATE+" "+@TIME+ @CRLF) $ = Close(1) endif
EndFunction
Suggestion please :-)
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"
|
Top
|
|
|
|
#129751 - 2004-11-17 06:35 PM
Re: Tracking/log system
|
Bryce
KiX Supporter
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
a few of the problems that happen with many users accessing a single file using kix.
using open() will lock the file to that current user. you will get errors if another user tried to open() the same file while the file is locked.
Also, you have
$file = $date+'.log'
but you are using the variable $Sfile in the open() code... is this a typo?
About the only way to get aroud the file lock problem is to use a seperate log file for each user.
Code:
Function TDinout $date = Join(Split(@date,"/"),"") $file = $date + '.' + @userid + '.log' $path = '\\server\folder\logdir if $form.visible $ = Open(1,$path +'\'+$file,5) $ = WriteLine(1,@USERID+ " Open instance"+@CRLF) $ = WriteLine(1,@DATE+" "+@TIME+ @CRLF) $ = Close(1) endif
if $form.hide $ = Open(1,$path +'\'+$file,5) $ = WriteLine(1,@USERID+ " Close instance"+@CRLF) $ = WriteLine(1,@DATE+" "+@TIME+ @CRLF) $ = Close(1) endif EndFunction
|
Top
|
|
|
|
#129766 - 2004-11-18 08:23 PM
Re: Tracking/log system
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Okay, I take it back.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 557 anonymous users online.
|
|
|