Forum Discussion
Hi,
The standard TestComplete log file contains datestamp, but in Unix (Epoch) format. So you should perform some conversions to use it for your needs.
Anyway your requirement looks like rather complex task to the moment. You need a script, which will find a proper xml data among all log files, parse data, make all required conversions, make correct structure etc...
Hi,
https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/from-tests.html might provide some useful info/code samples.
- shantlk7 years agoContributor
Hi Alex,
Thank you for the link. I was able to generate a customized log by modifying the given sample code.
Thanks a lot everyone for their help too.
below is a peice of my script which I used to get the timestamp and the log message for each row of the test log.
# Checks the data type of the log data
if LogDataType == ldtTable:
# Obtain the total number of rows in the dataset
Num = DataSet.RowCount
for i in range(0, Num):
Row = DataSet.Rows[i]
# Obtai the time of the current row & write this to the log file
TimeVal = Row.ValueByName["Time"]
ExportFile.WriteLine(aqConvert.VarToStr(TimeVal))
# Obtain the message of the current row & write this to the log file
MsgVal = Row.ValueByName["Message"]
ExportFile.WriteLine(aqConvert.VarToStr(MsgVal))- AlexKaras7 years agoChampion Level 3
Hi,
Thank you for sharing your solution here. Hopefully, it will help others who may have similair question.
- shantlk7 years agoContributor
Thanks everyone.
I also managed to capture the type of the message to send to sumologic. Not sure if this is the best way to do it. But works very well for me. Thought of sharing so it might be helpful for someone.
# Checks the data type of the log data
if LogDataType == ldtTable:
# Obtain the total number of rows in the dataset
Num = DataSet.RowCount
for i in range(0, Num):
Row = DataSet.Rows[i]
# Obtain the time of the current row & write this to the log file
TimeVal = Row.ValueByName["Time"]
ExportFile.WriteLine(aqConvert.VarToStr(TimeVal))
# Obtain the type of the current row & write this to the log file
TypeVal = Row.ValueByName["Type"]
if (TypeVal == 822415382):
Type = "Event"
elif (TypeVal == 990187621):
Type = "Message"
elif (TypeVal == 18446744073223342617):
Type = "Checkpoint"
elif (TypeVal == 1174736231):
Type = "Warning"
elif (TypeVal == 923080487):
Type = "Error"
ExportFile.WriteLine(Type)# Obtain the message of the current row & write this to the log file
MsgVal = Row.ValueByName["Message"]
ExportFile.WriteLine(aqConvert.VarToStr(MsgVal))--------------------------------------------
So the output looks something like this:
28/08/18 15:29:31
Event
The process "firefox" was closed.
28/08/18 15:29:32
Message
Mozilla Firefox was launched.
Related Content
- 6 years ago
- 2 years ago
- 4 years ago
Recent Discussions
- 11 hours ago