Hello, is there a library function to get the full path to the current trace file at run time? I see GetUniqueRunID in HSLUtilLib but wondered if there is something easier than concatenating that file path.
I am not aware of an easier way. Mind you, I’d say concatenating three strings (log files folder, method name, run ID) is pretty straightforward already ![]()
Read the unique Run GUID for the latest execution from the Hamilton Vector Database (HamiltonVectorDB). Then, use this Run GUID to retrieve the full path of the trace log file of the corresponding run within the HAMILTON\LogFiles directory. The log file name follows the format: [Method Name]_[Run GUID]_Trace.trc.
Yes agreed it’s an easy concat. Our method names change with version, so it means the method name variable is something I’ll have to remember to update each time, was hoping I could just pull it automatically to have one less thing to button up ![]()
Hi @Automashe ,
Using some default libraries as well as the HSL Extensions: File library you can easily put the trace file path together:
{
variable strMethodName;
strMethodName = HSLExtensions::File::GetFileNameWithoutExtension(GetFileName());
t_strTraceFile = t_strLogFile + "\\" + strMethodName+"_"+t_strUniqueID+"_Trace.trc";
Trace(t_strTraceFile);
}
This will dynamically update as you change the name of the file.
Ah thank you Brandon! so GetFileNameWithoutExtension(GetFileName()) retrieves the current method name, this was the info I was looking for.
