订阅

UiPath 机器人

UiPath 机器人指南

机器人日志

About

日志是带有时间戳的文件,其中包含与应用程序相关的信息事件、错误和警告消息。

机器人执行日志

机器人执行日志是由流程执行生成的消息。其中包含与其行为相关的信息以及工作流中用户定义的消息。

执行日志由以下内容生成:

  • “写入行”活动会创建“Trace”级别的日志。
  • “日志消息”活动,用于创建在活动的“级别”属性字段中指定的级别的日志。
  • 运行自动化项目,该项目会生成包含每个活动行为的日志。如果 Assistant 的“Orchestrator 设置”窗口中的“级别”设置设置为“详情”,则这些日志使用 Trace 级别。

执行日志的日志记录级别

默认的日志记录级别由“Orchestrator 设置”窗口中的“级别”设置控制。该设置默认为“Information”

📘

备注:

在 Orchestrator 中为机器人设置的日志级别将覆盖在 UiPath Assistant 中设置的日志级别。

通过 Assistant 更改默认日志记录级别:

  1. 在 UiPath Assistant 中,转到“首选项”菜单,然后访问“Orchestrator 设置”
  2. 在“日志记录”部分的“日志级别”下拉菜单中,选择所需的日志记录级别。
640

📘

备注:

如果机器人以服务模式安装,则需要管理员权限才能编辑此设置。

Orchestrator 目标

If the Robot is connected to Orchestrator, all execution logs are sent to Orchestrator and can be seen in the Logs page.

如果 Orchestrator 处于不可用状态,则在连接恢复前,系统会将日志存储在可用磁盘空间的本地数据库 (C:\Windows\SysWOW64\config\systemprofile\AppData\Local\UiPath\Logs\execution_log_data) 中。恢复连接后,系统会按日志的生成顺序将其分批发送。

📘

备注:

将日志成功发送至 Orchestrator 后,系统不会删除此数据库。

NLog 目标

另外,可以通过编辑 <Installation Folder>\NLog.config 文件来配置日志目标和内容。

The target location of the logs is controlled by the <Installation Folder>\NLog.config file. The Diagnostic logs are collected by the Internal type logger and are forwarded by using NLog targets.

By default, Execution Logs are stored in a file in the %LocalAppData%\UiPath\Logs folder. The messages are collected by the WorkflowLogging logger and can be forwarded by using NLog targets, as specified by the following parameters in the NLog.config file:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <variable name="WorkflowLoggingDirectory" value="${specialfolder:folder=LocalApplicationData}/UiPath/Logs" />
  <rules>
    <logger name="WorkflowLogging" writeTo="WorkflowLogFiles" final="true" />
  </rules>
  <targets>
    <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" />
  </targets>
</nlog>

删除旧的工作流日志文件

为避免创建大量日志文件占用计算机上的磁盘空间,您可以选择在达到特定文件数量后存档日志文件。

为此,请在 <target> 标签 NLog.config 中添加以下参数:

  • archiveNumbering="Date"
  • archiveEvery="Day"
  • archiveDateFormat="yyyy-MM-dd"
  • archiveFileName="${WorkflowLoggingDirectory}/{#}_Execution.log"
  • maxArchiveFiles="10"
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <variable name="WorkflowLoggingDirectory" value="${specialfolder:folder=LocalApplicationData}/UiPath/Logs" />
  <rules>
    <logger name="WorkflowLogging" writeTo="WorkflowLogFiles" final="true" />
  </rules>
  <targets>
    <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"
      archiveNumbering="Date"
      archiveEvery="Day"
      archiveDateFormat="yyyy-MM-dd"
      archiveFileName="${WorkflowLoggingDirectory}/{#}_Execution.log"
      maxArchiveFiles="10"
    />
  </targets>
</nlog>

:information-source: The maxArchiveFiles is the parameter controlling the number of archive files.

📘

备注:

Editing the NLog.config file requires administrator permissions. The robot service does not need to be restarted for the changes to take effect.

深入编辑日志

如果日志记录级别设置为“详情”,则消息将包含有关在执行时运行的活动的所有详细信息。可以通过编辑 C:\Program Files\UiPath\Studio 文件夹中的 UiPath.Executor.exe.config 文件来自定义此日志输出。

为此,必须在 <system.serviceModel> 标签下添加以下 XML 代码。

<tracking>
    <profiles>
        <trackingProfile name="StandardProfile">
         <workflow>
          <activityStateQueries>  
            <activityStateQuery activityName="*">
                <states>  
                    <state name="Faulted"/>  
                </states>
                <arguments>  
                    <argument name="*"/>  
                </arguments> 
                 <variables>  
                    <variable name="*"/>  
                </variables>             
            </activityStateQuery>
          </activityStateQueries>    
         </workflow>
        </trackingProfile>       
    </profiles>
</tracking>

鉴于 <states> 标签仅包含 <state name="Faulted"/>,因此插入以上代码只能记录拥有“Faulted”(出错)状态的活动。在 <states> 标签下添加其他参数(例如 <state name="Executing"/>)也会记录拥有其他状态的活动。

Not only activity states can be modified, but also variables and arguments. More information about customization can be found here.

📘

备注:

修改 UiPath.Executor.exe.config 文件后,您需通过重启机器人服务使更改生效。

机器人诊断日志

机器人诊断日志提供与机器人本身及其上下文相关的信息。这些信息可用于确定特定错误的原因。

机器人诊断日志保存在以下位置:

  • On Windows, diagnostic logs related to errors are logged in the Event Viewer.
  • 在包括 Windows 在内的所有平台上,Verbose 日志都将写入文件:
    • Windows 上的 %LocalAppData%\UiPath\Logs\internal\Robot.log(当机器人以用户模式安装时)。
    • Windows 上的 %PROGRAMDATA%\UiPath\Logs\internal\Robot.log(当机器人以服务模式安装时)。
    • ~/.share/local/UiPath/Logs/internal/Robot.log 在其他平台上。

驱动程序诊断日志

驱动程序跟踪已写入 .etl 文件。
要启用驱动程序跟踪,请以管理员权限打开命令提示符,使用 cd 参数(例如 cd C:\Program Files\UiPath\Studio)访问安装目录,然后运行 UiRobot.exe --enableLowLevel 命令。
要禁用驱动程序跟踪,请以管理员权限打开命令提示符,使用 cd 参数(例如 cd C:\Program Files\UiPath\Studio)访问安装目录,然后运行 UiRobot.exe --disableLowLevel 命令。

📘

驱动程序跟踪注意:

我们建议仅在调查问题时启用“低级别追踪”,并在调查会话结束后将其禁用。
此外,仅在禁用该功能后,才会生成包含追踪信息的 .etl 文件。
无需重新启动机器人即可使更改生效。

3个月前更新


机器人日志


建议的编辑仅限用于 API 参考页面

您只能建议对 Markdown 正文内容进行编辑,而不能建议对 API 规范进行编辑。