Append Line not Working with Orchestrator

Hi there!
I have a job that populates a file name log.txt after it checks a database, based on a SQL query. If the number of rows returned are 0, it should populate the log file saying “No Incidents Reported” along with a time stamp and send a mail to me saying no incidents returned. However if n rows are returned, it populates the log file saying “n incidents reported” and sends me a mail with a csv file having the incidents.
I am populating the log file using “Append Line” feature.
Whenever I am manually running the bot through studio, everything is working properly. However, whenever I am running it through Orchestrator, or through UI Robot, I get the mail but the append line does not work.
I am clueless about how I should proceed with this. I also created a dummy flow with just append line feature and published it into orchestrator and still it is not working with orchestrator. Can someone help me out with the resolution?

When Orchestrator executes workflow it will create your log.txt file as per the current location of package.

so it might be creating in C:\ProgramData\UiPath\Packages (one level up in UiPath folder).

Yes, I see the file getting created with values when I am running the bot through the studio. However, nothing happens when I run the same bot through orchestrator or uipath robot. It’s strange since all other activities like saving data into csv, sending mails, everything works.

This is what I am getting when running the dummy flow through the Uipath studio. But I ran it more than 15 times through orchestrator and this file does not get populated, no matter what.

Hi,

the append line like you set it up will create and append the line relative to the folder in which the project is stored (for example C:\User\Documents\UiPathProcessName\log.txt) - when you run it through the Orchestrator the package will be deployed in the Robot (beginning with version 2018.2 and greater) in %userprofile%.Nuget\packages\Processname - so the log would be created in that location and not the location the file would be created in when you run it through the studio.

2 Likes

Thanks Frank! So is there a way I can dynamically access this log file so that I can send them as attachment? The reason why I am asking this is because if I make changes to the flow, I see it gets saved in a new folder with the version number.
For example, for 1.0.3 the address would be: C:\Users\abchakraborty.nuget\packages\P1P2\1.0.3\lib\net45\log
For 1.0.8 it would be:
C:\Users\abchakraborty.nuget\packages\P1P2\1.0.8\lib\net45\log

So, is there a way that the log file is picked up on its own from the newest version folder?

Hi @abchakraborty as the path to the log-file is relative you could also just use “./log.txt” to access the file regardless of the version the package is using.
Another way would be to store the log in a location like C:\Logs\Projectname\log.txt where the path would be the same.
Another way would be to use Environment.CurrentDirectory to get the current directory where the main is running and read out the file accordingly - check this post for further details

Thanks Frank! This helps.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.