NetTalk Central

Author Topic: WebServer Logging to Disk issue  (Read 1628 times)

kboller

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
WebServer Logging to Disk issue
« on: June 11, 2025, 10:37:35 AM »
I'm trying to turn on Logging to Disk.  I'm using an ASCII file and have entered the file information in the WebServer logging extension.  However when I do that, the log file is never created (and no log file records as well obviously).

I then added code in the AddLog procedure to manually create the record.  However it only creates the first entry and then stops adding records after that.

Any suggestions as to what's going on and how to resolve it?  Here is my code where the record is added:

      ! Start of "Before Adding to Log Queue"
      ! [Priority 5000]
      !Before add to Log Que
      If web:EnableLogging = 2
        Clear(WebLogFile:Record)
        Log:Line = format(Today(),@D3)&format(Clock(),@T3)&' -- '&clip(p_Data)&','&p_ip   
        Access:WebLogFile.Insert()
      end
      ! End of "Before Adding to Log Queue"
      Add(LogQueue,1)
      Loop While Records(LogQueue) > 500
        Get(LogQueue,501)
        Delete(LogQueue)
      End

Thanks,

Kurt

rjolda

  • Sr. Member
  • ****
  • Posts: 372
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #1 on: June 12, 2025, 08:09:30 AM »
Hi Kurt,
I have not played with the Save to Disk function for logs and I am on the road. I have found that many things in NT get solved by snooping around and trying to make sense of the stuff around what you are trying to do.
First, I believe it is an ASCII file.   Is there a RETURN added at the end of each line?  I am not sure if it is added automatically but if there isn't any and the line length is BIG - it may appear to have only one record?
The logins are apparently recorded in a queue.  I would look at the queue and see what is there and make sure that you have the correct item to write to your file.  eg -  I am not sure if it takes each addition to the queue and runs the record from this routine or if this routine needs to fetch the last queue record to have it to write to disk.
I might use and ADD(record) as opposed to Insert record as it is an AScII file.
Poking around with some messages or trace statements will help you sort this out.
Sorry I don't have an answer but I find that with some information and direction, the answer can often be sorted out.
Ron

kboller

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #2 on: June 12, 2025, 12:38:40 PM »
Hi Ron,

     Regarding the RETURN, I think it is adding one.  If you close the webapp and reopen it, it does add an additional record to the log file.  The record length is currently 1024 so it is large but doesn't appear to fill the record with blanks.  You can open it with notepad and see it's performing a carriage return at the end of the record.

      I did use the Add(record) and got the same results as the Insert record.  It only adds the one record even though with trace statements it shows that the code is being executed.

Thanks,

Kurt

Alberto

  • Hero Member
  • *****
  • Posts: 1888
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: WebServer Logging to Disk issue
« Reply #3 on: June 12, 2025, 05:48:02 PM »
Hi,
Had you checked the insert error in
Access:WebLogFile.Insert()
Are you sure the file is open?
-----------
Regards
Alberto

rjolda

  • Sr. Member
  • ****
  • Posts: 372
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #4 on: June 14, 2025, 03:25:13 AM »
Hi Kurt,
FWIW, I have a separate table of LOGINS.  It is a TPS file.  I am able to use this to record each VALID login to the system.  I write a record to it after I validate each login.  That may be a better solution for you if you are trying to track valid logins.  BTW, make sure that the additional table is OPENED when you write to it - either have the procedure open and close it or you must do it yourself.
Ron

kboller

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #5 on: June 16, 2025, 06:39:28 AM »
Thanks for the help Alberto and Ron.

I updated my code to look for an error after the insert however it was error free so I then added open and close statements with no success.

      !Before add to Log Que
      If web:EnableLogging = 2 
        glo:st.Trace('*** Adding Log Record')
        Access:WebLogFile.Open()
        Clear(WebLogFile:Record)
        Log:Line = format(Today(),@D3)&format(Clock(),@T3)&' -- '&clip(p_Data)&','&p_ip   
        Access:WebLogFile.Insert()
        IF ERRORCODE() then glo:st.Trace('*** Write error -' &ERROR()).     
        Access:WebLogFile.Close()
      end

Ron, I'm trying to track down a "memory freed twice error" so I"m trying to capture all the log entries up to the time the program crashes. 


I've even moved it to different embed points within the ThisWebServer.AddLog PROCEDURE but it doesn't seem to matter.  I see the trace statements but no log activity is being written.


Thanks,

Kurt

rjolda

  • Sr. Member
  • ****
  • Posts: 372
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #6 on: June 16, 2025, 11:40:43 AM »
Hi Kurt,
 "memory freed twice error"   - ooooh. I work hard to avoid these.... 
I am not sure how logging is going to help with that.  I am reaching way back - that may occur when an object is instantiated and Killed too many times??? I think I used to see this with apps having DLLs also.  So, I would look at any objects that you create and look at how and why they are disposed of.  Capesoft has GUTS - not sure if it works with Net Talk but I don't see why not. 
If i was going to look at this I might put a trace statement in each "procedure" maybe at starting and ending of each procedure.  have Debugview to capture and look at them and if you follow them, the traces should end when the program crashes.  This might help you reconstruct the process and then focus your trace statements to the actual procedure and events causing the crash. 
Some folks look for clues in the CRASH report.  May be of some use.
Ron

 


kboller

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: WebServer Logging to Disk issue
« Reply #7 on: Today at 05:21:28 AM »
Thanks Ron. 

I like the DebugView idea as with that error I'm just trying to "buy a vowel" at this point.  I'm not doing anything wild and crazy that I know of.   

The only commonality is it seems to occur when there have been a lot of gps lookups and a call to google maps may be occurring.  I did find where if the user wasn't allowing access to their location it would pass 0,0 to google maps as the from location and google maps would fail.  I did substitute the Company location under that condition which made google maps happy and google errors have gone away.

Thanks,

Kurt