NetTalk Central

Author Topic: Logging to a TPS file - example?  (Read 3821 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Logging to a TPS file - example?
« on: December 30, 2013, 04:56:47 PM »
NT 7.31 C9

I'm trying to have server logging done to a TPS file, and even though I set up a TPS file in accordance with the template, including a name variable, and on starting the server, set the logging selection to screen and disc, I never see the TPS file being written to.  It does not appear in the \log folder (it does appear in the app folder but is empty).

I'm sure that I'm missing something simple, but it is escaping me.  Is there an example where logging is done to a file in the dictionary?  Or, is there some simple step I am overlooking?
Mike Springer

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Logging to a TPS file - example?
« Reply #1 on: December 30, 2013, 06:09:54 PM »
I ran example 26 and it generates a text file log in the \log folder.  That looked good. Then, I changed the dictionary for the log file to be a TPS file instead of the DOS file type.  That is the only change I made.  Compiled fine but when I start the app, I get an error:

WebLog.Log could not be opened - possible data corruption 1194.

Never got to the point of the server coming up so I could select the option to log to screen and disc.

The log file in the example dictionary is named NetWebLog.  I don't know why the file "WebLog.Log" is trying to be opened.  Surely I am misunderstanding how to get the logging to use a TPS file.

Mike


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Logging to a TPS file - example?
« Reply #2 on: January 02, 2014, 12:04:58 AM »
Hi Mike,

um - perhaps this is obvious - but did you delete the existing DOS file when you changed it to be a TPS? If the DOS file was still there then it would try and Open it as a TPS and you'd get the error.

>> The log file in the example dictionary is named NetWebLog.  I don't know why the file "WebLog.Log" is trying to be opened.

In example 26, in the dictionary, NetWebLog has the "Full Path Name" set to !glo:WebLogName. This means that the name of the table on disk is not NetWebLog.Tps, but rather whatever is set in the variable glo:WebLogName. The variable defaults to WebLog.Log. the program is opening this file because it has been added to the "Other Files" list of theWebServer procedure in that example.

When the actual data is logged it doesn't use the WebLog.log disk file. Rather the name is calculated based on the date and time, and placed in the log folder. A new log file is created whenever the log file grows larger than 10 Megs(*), or when you set the Server.LogOpen property (build 7.32 or later, in earlier builds it's server._LogOpen) to false.

(*) In build 7.32 or later this number is set in server.MaxLogSize

cheers
Bruce





springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Logging to a TPS file - example?
« Reply #3 on: January 02, 2014, 04:37:41 AM »
Re: Example App 26

Bruce,
Well, regarding the error, it was that I needed to delete the old text log files.  But, the one that was causing the error was not in the \log file but was in the app folder.

I can now see a log file created in the \log folder, but it does not appear to be a TPS file.  However, if I open it with TopScan, I get the correct record structure, but no data.  I've attached a copy of the file FYI.  I do have the log to screen and disc checked on, and I see the get/posts showing on the screen log.  I'm missing something here - unless it takes more than simply changing the DCT driver to Topspeed for the weblog file.

I assume that as each transaction occurs that it is written to the file.  Maybe that assumption is wrong - is the transaction queued up in memory and written later?  If that is the case, what is the timing of that write - I'm wanting to be able to review the logs from a different application, but is the data only written at some scheduled/later time?

Mike

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Logging to a TPS file - example?
« Reply #4 on: January 02, 2014, 05:34:08 AM »
>> I assume that as each transaction occurs that it is written to the file.

yes, there is no caching of log output.

the problem is in NetWeb.Clw in the NetWebServer.AddLog method, circa line 2036. It says;

add(p_File,len(clip(p_Field)))

but that is a function supported by the DOS driver, not the other drivers. I've changed it to

  if p_file{prop:driver} ='DOS'
    add(p_File,len(clip(p_Field)))
  else 
    add(p_File)
  end 


that said, if you want more sophisticated logging - ie logging to a structured data file, you may want to inspect the MultiSite example. As I recall that uses a much more complicated logging setup, with a file suitable to be searched etc.

Cheers
Bruce


springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Logging to a TPS file - example?
« Reply #5 on: January 02, 2014, 10:58:00 AM »
Thanks Bruce