#43380 - 2003-07-26 01:08 PM
Re: writing to log file on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The solution I use which avoids any contention at all is to use WriteLog2() ,in the UDF library, and write to a file name based on the computername. Then use another process to collect and consolidate the information.
|
|
Top
|
|
|
|
#43381 - 2003-07-26 01:52 PM
Re: writing to log file on remote server
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
For workstation logging (initial inventory purposes) I just left it alone with possible contentions but after a few days, all the workstation data gets in, as even on a perfect day, very few people log in at the same time consistently.
However subsequently, I have implemented an Access MDB for inventory, will allows multiple concurrent connections...
NTDOC's preferred method is to create the log files on the client machine (@wksta.log) and then copy to the server. no contentions, old data is overwritten by new, and an admin script he uses appends all their data into a single sheet
|
|
Top
|
|
|
|
#43383 - 2003-07-26 03:06 PM
Re: writing to log file on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Caution should be exercised when having multiple accesses to an INI file.
See: WriteProfileString() Internals?
|
|
Top
|
|
|
|
#43385 - 2003-07-26 03:16 PM
Re: writing to log file on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
A locked file is a locked file. Only one person, the one that has the lock can write to it.
Using unique files names like those based on @wksta will eliminate this issue. Please review the link I posted above about WriteProfileString.
|
|
Top
|
|
|
|
#43387 - 2003-07-26 03:49 PM
Re: writing to log file on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Actually, someone else write locally and copies. I would just write to "\\server\share\" + @wksta + ".log"
Depending how you format the file would determine what needs to be done to consolidate the data.
You could enumerate the file names, open each one, read the data, parse if necessary, and write a new file.
Or I think you could do something as simple as:
copy *.log newfile.txt [ 26. July 2003, 15:50: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#43391 - 2003-07-26 04:06 PM
Re: writing to log file on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry about the copy thing.
Try this:
type *.log >> completelog.txt
|
|
Top
|
|
|
|
#43395 - 2003-07-26 05:24 PM
Re: writing to log file on remote server
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
or go to my site and see the example inventory script for Access there.
|
|
Top
|
|
|
|
#43397 - 2003-07-26 06:15 PM
Re: writing to log file on remote server
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
That's why there is DBCommand() - Executes a SQL statement and returns a recordset if applicable , it's a superset of the other database UDFs. Example code, see also the UDF headerscode:
$dsn='DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\\server\writableshare\database.mdb' $sql="INSERT INTO Table1 VALUES('eee','fff')" $recordset = DBCommand($dsn,$sql) ? 'Error = '+@ERROR+' - '+@SERROR $sql="SELECT Field1, Field2 FROM Table1" $recordset = DBCommand($dsn,$sql) ? 'Error = '+@ERROR+' - '+@SERROR for $row=0 to ubound($recordset,1) for $column=0 to ubound($recordset,2) ? 'Field(row='+$row+', column='+$column+') ='+$recordset[$row,$column] next next
[ 26. July 2003, 18:15: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#43398 - 2003-07-26 09:46 PM
Re: writing to log file on remote server
|
ChristopheM
Hey THIS is FUN
   
Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
|
hello JohnQ,
what is the problem with combining all log files ? if you use kix script for login script or other, it wouldn't be a problem to concatenate I have been using this method with more than 2800 workstation for four years and it's very efficient.
Now, i also use this for "heavy" distribution. for current software installation, I use SMS but for service pack installation and other big updates, i have kix script that write log file named @wksta.log on a shared directory. I can see workstation that are installing, installation OK and KO, installation that will come because the start of installation is based on a host file with hostname and date for installation.
I don't know what is important for you : having information immediately online or not having problem of lock file
in my case, i have choiced : no lock problem. I prefer to wait one or two minutes to concatenate 2800 files and load the result in an excel sheet. [ 26. July 2003, 21:48: Message edited by: Christophe Melin ]
_________________________
Christophe
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 874 anonymous users online.
|
|
|