NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Offline Processing Utiltity (ORPU) log file issue

I tried to pipe the ORPU log output to a file according to the documentation (command-line), but couldn't get it to work.

Logging Offline Results Processing Utility Messages to a File - TestStand 2017 Help - National Instr...

An empty file is created, but it is never populated with any log data - did anyone have any luck doing this?

 

- I made sure that the log file was created in a user-file area

- Checked after ORPU closed (to make sure it was flushed to disk)

 

I looked into the ORPU code too (and built it), and when providing the documented arguments as debug parameters, it actually created a log file with content. But still, it doesn't work with the included ORPU that comes with the installation when started from CMD-context or within a sequence.

I would have preferred that ORPU could actually create a log file itself, instead of having to deal with console redirecting.

 

However, creating a process in C# .NET as below, it is possible to re-direct the logging output, but then I also would have to create a mechanism to auto-start ORPU with this wrapper, if ORPU it was closed. TestStand already have this auto-start feature for ORPU (but then again, without the logging).

 

 

      public static void CaptureOrpuLog()
      {
            var processStartInfo = new ProcessStartInfo
            {
                FileName = @"C:\Program Files (x86)\National Instruments\TestStand 2017\Components\
Tools\Offline Results Processing
 Utility\Win32\OfflineResultsProcessingUtility.exe",

                Arguments = @"/tray /log-level Debug",
                UseShellExecute = false,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                CreateNoWindow = true,
                WorkingDirectory = @"C:\Program Files (x86)\National Instruments\TestStand 2017\Bin\",
            };

            using (Process process = new Process())
            {
                process.StartInfo = processStartInfo;
                process.OutputDataReceived += p_OutputDataReceived;
                process.ErrorDataReceived += p_ErrorDataReceived;
                process.Start();

                // Read the output asynchronously to prevent the buffer to overflow.
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();

                if (!process.WaitForExit(-1))
                {
                    try
                    {
                        process.Kill();
                        process.WaitForExit();
                    }
                    catch (Exception)
                    {
                        if (process.HasExited)
                        {
                            // Ignore if the process is already killed.
                            Debug.WriteLine("ORPU process is already killed. PID: {0}", process.Id);
                        }
                        else
                        {
                            throw;
                        }
                    }
                }
            }
        }

        private static void p_ErrorDataReceived(object sender, DataReceivedEventArgs e)
        {
            Debug.WriteLine(e.Data);
        }
        private static void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            Debug.WriteLine(e.Data);
        }

 

 

0 Kudos
Message 1 of 3
(124 Views)

Interesting, it does seem that the shipping version of the Offline Results Processing Utility does not operate as expected with the commands documented. 

 

  • Does the log window in the shipping version of ORPU have the appropriate log messages? 
  • When you build and provide debug parameters from source did you make any other changes or simply build from source?
  • Does building a new debug version of ORPU and calling that version from the command line work with the redirects?

Feel free to add ORPU having a create log file option built in to the TestStand Idea Exchange as I'm sure it is a potential feature others may like to see as well. 

Dane S.
Product Support Engineer
National Instruments
Message 2 of 3
(73 Views)

Hi Dane!

 

Thanks for your response and confirming the issue. Would you mind filing an internal CAR on this issue with the TestStand team, please?

 

Regarding your questions:

 

Shipping version of ORPU

- Yes, the log windows in ORPU (File / Show Log) have appropriate log messages.

 

Debug build of ORPU (with arguments in Debug/Visual Studio)

- I built ORPU from the source included with (TestStand 2017), no modifications made - and used the documented arguments as input to the Command line arguments fieldin the project start options (Project / Debug tab in Visual Studio 2019). This way I finally got log the output from ORPU to file, when ORPU was closed.

 

Debug build of ORPU (with arguments in command console)

- The built debug version of have the same problem as the shipping version, it creates an empty file but no log output is written to the file when closing ORPU. 

 

Regarding ORPU logfile support, we do have some Idea's - I'll be happy to share them to the exchange.

 

BR

/Magnus

 

0 Kudos
Message 3 of 3
(59 Views)