Author Topic: How do I read an open log file ?  (Read 1300 times)

fasu

  • Newbie
  • *
  • Posts: 6
How do I read an open log file ?
« on: June 06, 2022, 01:22:02 AM »
Hi there,
It looks like VA can't read a .txt file which is already open (in my case it's a log file which is updated in real time).
Is there a solution to work around this problem?

EDIT :
Finally, one solution is to make a copy of the log file each time a query is needed.
To make this copy, an In-line C# like this works:
Code: [Select]
using System;

public class VAInline
{
public void main()
{
string fileName = "data03.txt";
        string sourcePath = @"C:\Users\..........\Logs\va";
        string targetPath = @"C:\Users\..........\Logs\va\va2";
       
         // Use Path class to manipulate file and directory paths.
         string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
         string destFile = System.IO.Path.Combine(targetPath, fileName);

         // To copy a file to another location and
         // overwrite the destination file if it already exists.
         System.IO.File.Copy(sourceFile, destFile, true);
}
}