Change location of robot execution logs

Hi all,

Is it possible to change the target for the robot execution logs?
According to this documentation the target of the execution log is set to the %localAppData% folder of the users on the machine.
However, we would like to change this to one folder for all of our robot users so that we can easily archive the log files.

In order to achieve this, which part of the nlog.config file do we have to change? And what values do we have to use?

Thanks in advance,

Jasper

Location of robot’s log can be customised on “NLog.config” file

You will need to change “LogDirectory” variable and “File” target

Cheers


  <variable name="LogDirectory" value="${specialfolder:folder=LocalApplicationData}/UiPath/Logs" />
  <targets>
    <!-- VisionHost tracing -->
    <target xsi:type="File" name="visionHostFile" fileName="${LogDirectory}/${shortdate}_VisionHost.log" layout="${time} ${level} ${message}" concurrentWrites="true" />
    
    <target xsi:type="File" name="executionFile" fileName="${LogDirectory}/${shortdate}_Execution.log" layout="${time} ${level} ${message}" concurrentWrites="true" />
    <target xsi:type="EventLog" name="eventLog" layout="${callsite:className=false:includeSourcePath=true:methodName=false} ${message}" source="UiPath" log="Application" />
  </targets>
1 Like

Hi @maesjasper,

You will have to change values as shown below:

Instead of this:
value=“${specialfolder:folder=LocalApplicationData}/UiPath/Logs”
you can change it to as below(just an example, please note $ sign was only required coz localapplicationdata is variable):
value=“C:/username/UiPath/Logs”

And location of Nlog.config file would be as below:
C:\Program Files (x86)\UiPath\Studio

Regards
Sonali

1 Like

Hi!

Thank you for your response, I have managed to change the location of the execution logs to one generic folder. However, I feel this isn’t very useful as the logs of the different robots will just be mixed together in one file. Do you think there is a possibility to make this variable?

For example:
D:\ExecutionLogs${RobotName}

Thank you once again for your response.

Jasper

Hi @maesjasper,

Glad to know it worked.

Regarding making it separate for diff processes, you can utilize existing variable itself, may be attach process name to the execution log file so all logs with same process can be referred directly?

Regards
Sonali

As I wrote in the earlier reply - you should also modify the “File” target to prevent duplicate log file name

<target type="File" name="WorkflowLogFiles" fileName="${WorkflowLoggingDirectory}/${shortdate}_Execution.log" layout="${time} ${level} ${message}" keepFileOpen="true" openFileCacheTimeout="5" concurrentWrites="true" encoding="utf-8" writeBom="true" />

E.g. you could add USERNAME environment variable in the file name

fileName=“${WorkflowLoggingDirectory}/${shortdate}_${environment:variable=USERNAME}_Execution.log”

For more Nlog configuration options refer to reference:

https://nlog-project.org/config/?tab=layout-renderers

Cheers

1 Like

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