Ron schreef: > > How to watch new data that's added to a logfile? > > I want to make an apache log monitor, so I thought I could do that with > FILE READ WATCH, but thats not suited it seems, that one only seems keep > generating File_Read events continuous. > > In short: > I want to open a file readonly. > Then seek to end of file (or just before it) > Then only get file_read events when new lines/data are added (by apache).. > > Anyone has any ideas?
In response to my own question I have tested with this: It creates a file and reads it, event File_Read() keeps getting raised, even after end of file. ' Gambas module file PRIVATE hFile AS File PRIVATE hFile2 AS File PUBLIC SUB Main() ' create test file hFile = OPEN "/tmp/file" FOR WRITE CREATE PRINT #hFile, "0123456789"; CLOSE #hFile ' watch it hFile2 = OPEN "/tmp/file" FOR READ WATCH END PUBLIC SUB File_Read() DIM iByte AS Byte READ #hFile2, iByte PRINT " "; iByte; END It prints: 48 49 50 51 52 53 54 55 56 57 And then gives error "End of File" This is not what I expected, shouldn't it stop before end of file? Gambas 2.12, gb.qt Regards, Ron_2nd. ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
