Page 1 of 2 12>
Topic Options
#129750 - 2004-11-17 06:13 PM Tracking/log system
1984 Offline
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 Offline
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
#129752 - 2004-11-17 06:45 PM Re: Tracking/log system
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
this is a kixform, so you should be able to know when a user starts it and when they are closing it, right?

Code:

;----------------------------------------------
; Start the form
;----------------------------------------------
LogIt("Open")
While $Form.Visible
$=Execute($Form.DoEvents)
Loop
LogIt("Close")
Exit 1
.
.
.
function LogIt($action)
$ = open(1,"Your Log",5)
$ = writeline(1, @date + " " + @time + " " + @userid + ": " + $action + @crlf)
$ = close(1)
endfunction



I don't think that you will have to worry much about the file being locked. how many users will be trying to open or close the form at the same exact time? Plus, is locking even an issue with .txt files? i didn't think it was for some reason.
_________________________
Eric

Top
#129753 - 2004-11-17 07:33 PM Re: Tracking/log system
1984 Offline
Starting to like KiXtart

Registered: 2003-08-14
Posts: 150
ahh typo, $Sfile should be $file.

Acctually the problem occured when I tried to update the program on network share by remove or overwright it. I found it locked/inuse. "there has been sharing violation"...

I remember on NT4 using winfile with admin rights it was possible to see which users are holding on a specific shared file on fileserver... and then kick them out...

Im not sure how I could check this out from a client on fileserver, W2K , without having full admin rights on server.

It should be possible to see on the folder which i have full permission, who are holding the program...

Hmmm, wonder if there is a tool which we could use to acctually see who are using/holding a file on network share?


Edited by 1984 (2004-11-17 07:38 PM)
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"

Top
#129754 - 2004-11-17 08:07 PM Re: Tracking/log system
1984 Offline
Starting to like KiXtart

Registered: 2003-08-14
Posts: 150
Using Windows 2000 Resource Kit, command INUSE, I could overwright the program on networkshare by new updated one.
However its not much help, it requires reboot of machine to take effect.
And I will certainly NOT reboot the file server :-)



Edited by 1984 (2004-11-17 08:08 PM)
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"

Top
#129755 - 2004-11-17 08:14 PM Re: Tracking/log system
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
1984

Reviewing many of your posts you do not appear to typically come back and let those that are helping you know if the suggestion worked or not. Not saying you have to thank them, but would be nice to acknowledge that the problem was resolved by their idea/suggestion/code.

Please take the time to come back and end the thread.

Here are just a few of the examples where you have not come back and completed the threads. You have participated, but there appears to be other questions or comments made that you don't always respond to.


http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=127538&page=&view=&sb=5&o=&fpart=2&vc=1
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=126639&page=&view=&sb=5&o=&fpart=2&vc=1
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=112399&page=&view=&sb=5&o=&fpart=2&vc=1

Top
#129756 - 2004-11-17 08:15 PM Re: Tracking/log system
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Two things wrong with this line:
$path = '\\server\folder\logdir

First off, it should be share, not folder and second, there is no closing quote.

$path = '\\server\share\logdir'
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129757 - 2004-11-17 08:44 PM Re: Tracking/log system
1984 Offline
Starting to like KiXtart

Registered: 2003-08-14
Posts: 150
oh, my bad. I am truly sorry about that. I hope nobody thinks that Im ignoring them or so. I am very greatfull for all help and ideas I get from you people, and I truly mean it. Not an excuse but just a explanation is my private situation, which has been very hard these past mounth, and affacting my time and mind.... The life is pain without end.

However I will fulfil the topics and once again thanx a lot all of u kind people who helping a confused mind!

/1984
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"

Top
#129758 - 2004-11-17 09:18 PM Re: Tracking/log system
1984 Offline
Starting to like KiXtart

Registered: 2003-08-14
Posts: 150
I have now completed some threads.

:-)
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"

Top
#129759 - 2004-11-17 09:21 PM Re: Tracking/log system
1984 Offline
Starting to like KiXtart

Registered: 2003-08-14
Posts: 150
U r right Les, on both! just as u always r. :-)
_________________________
"... Great minds talk about idea' s, average minds talk about events and samll minds talks about people...!"

Top
#129760 - 2004-11-17 09:52 PM Re: Tracking/log system
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I have been worng once or twice.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129761 - 2004-11-17 10:03 PM Re: Tracking/log system
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
1) once I said I will never be wrong
2) now as I said I was wrong once

ja, that makes 2...
_________________________
!

download KiXnet

Top
#129762 - 2004-11-18 07:45 PM Re: Tracking/log system
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
There are many posts on using UDF for checking and waiting for open file handles to write a central .INI or LOG file, but my personal preference is to have each user write their own log file to a central share location and then I copy all of them into a single file and import with Excel for reporting.

COPY *.TXT SYSINFO.TXT

There is never any file contention or script waiting. The process can be fully automated by script as well.

Top
#129763 - 2004-11-18 07:52 PM Re: Tracking/log system
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
One can also write to the event log instead. Never any contention AFAIK. Might want Stevie's custom DLL for that though.

Speaking of the DLL, I seem to have misplaced my copy and can't find a link.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129764 - 2004-11-18 08:07 PM Re: Tracking/log system
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Off-Topic, but here you go Les. OR did you mean some other DLL?

KiXtart Messages DLL (Freeware)
http://www.itripoli.com/ikm.asp
iTripoli KiXtart Messages DLL
Install this free KiXtart Messages DLL for clean KiXtart event log entries.

http://www.itripoli.com/downloads/kixtartmessages/kixmsgs_b1.exe

Top
#129765 - 2004-11-18 08:12 PM Re: Tracking/log system
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Off-Topic, I think not!
Re: Tracking/log system
Quote:


Install this free KiXtart Messages DLL for clean KiXtart event log entries.





Event log is logging.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129766 - 2004-11-18 08:23 PM Re: Tracking/log system
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Okay, I take it back.
Top
#129767 - 2004-11-18 08:27 PM Re: Tracking/log system
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Thanks!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129768 - 2004-11-19 04:03 AM Re: Tracking/log system
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Or write to an Acces Database or SQL database.

Edited by sealeopard (2004-11-20 01:08 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#129769 - 2004-11-19 10:48 AM Re: Tracking/log system
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Has somebody already mentioned WriteProfileString() ???
Hint: INI-files.

Sorry, if I don't understand or even read the entire thread word by word, but that's only because my personal situation at the moment ... In other words I am tired to death atm.

K, back to topic. Logging to textfiles is for obvious reasons not applicable.

SQL/Access database for logging the use of a kixforms script???
That is like shooting on a cat with a cruise missile.

Event logging by a dll ... hmmm ... nice to keep in mind, but administrative overhead for the simple cause.

Conclusion: use a centrally located ini-format file and let the kixforms script write the user with the start time to it, at closing just let the script deleting the section in question.

Am I right or what?

I could even hack a little 'real time' usage statistics form if you ask kindly
_________________________



Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.047 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org