Announcement

Collapse
No announcement yet.

Read all log files from all sub folders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read all log files from all sub folders

    I have a server that creates multiple log files everyday. The log files are created in a subfolder with the date. For example:

    C:\Mainfolder
    C:\Mainfolder\2016-03-03\logfile1.log
    C:\Mainfolder\2016-03-03\logfile2.log
    C:\Mainfolder\2016-03-02\logfile1.log
    C:\Mainfolder\2016-03-02\logfile2.log
    C:\Mainfolder\2016-03-01\logfile1.log
    C:\Mainfolder\2016-03-01\logfile2.log

    Every log file is build up the same, but the information is different. For example:

    C:\Mainfolder\2016-03-03\logfile1.log
    NAME,4324,54326754,2016-03-03,765456,1,6543,65654,76547

    C:\Mainfolder\2016-03-03\logfile2.log
    NAME,4324,54326754,2016-03-03,765456,2,6543,65654,76547

    I want to create a programm that can read this information and put the latest date/last log file on top so I can alway see the newest results. It would be nice if the output of this files can be shown in tables and manipulated, for instance:

    Logfile1.log NAME1,4324,54326754,2016-03-03,2048,2,6543,65654,76547
    Logfile2.log NAME1,4325,54326754,2016-03-03,1024,1,6543,65654,76547

    NAME ID ID2 DATE SIZE RESULT (Last 3 not shown/irrelevant)
    NAME1 4324 54326754 2016-03-03 2 MB OK
    NAME2 4325 54326754 2016-03-03 1 MB FAILED

    I asked on codeproject what is the best language to create such a tool, but then I remember creating something in the past in AMS that was relatively easy. Now I wonder, is this also easy to create with AMS, and if so, can you tell me where to start?

  • #2
    Hi. This should be possible with the Grid object (its a table with rows and cells like in excel). You can load the log contents with the "TextFile" Actions (read to string or read to table) and then add the logfile contents with the Grid actions.
    Bl4ckSh33p-Soft - Custom Software and Indie Games

    Comment


    • #3
      Oh, I forgot to add one step. To read all logs use "File.Find" "*.log" in your logs folder. this saves all file paths to a table and then you can load the contents of all files with a "for i,v in pairs (tablename) do" loop. Hope this helps.
      Bl4ckSh33p-Soft - Custom Software and Indie Games

      Comment

      Working...
      X