- 入门指南
- 安装和升级
- 机器人类型
- 机器人组件
- 许可
- 将机器人连接到 Orchestrator
- 流程与活动
- 日志记录
- 机器人日志
- 日志记录和日志级别
- 特定场景
- 监管
- 故障排除

机器人管理员指南
机器人日志
日志是带有时间戳的文件,其中包含与应用程序相关的信息事件、错误和警告消息。
以下页面显示了日志的类型:
机器人执行日志
机器人执行日志是由流程执行生成的消息。其中包含与其行为相关的信息以及工作流中用户定义的消息。
执行日志由以下内容生成:
- “写入行”活动会创建“Trace”级别的日志。
- “日志消息”活动,用于创建在活动的“级别”属性字段中指定的级别的日志。
- 运行自动化项目,该项目会生成包含每个活动行为的日志。如果 Assistant 的“Orchestrator 设置”窗口中的“级别”设置设置为“详情”,则这些日志使用
Trace级别。
执行日志的日志记录级别
默认的日志记录级别由“Orchestrator 设置”窗口中的“级别”设置控制。该设置默认为“Information”。
在 Orchestrator 中为机器人设置的日志级别将覆盖在 UiPath Assistant 中设置的日志级别。 只有与 Assistant 或 Orchestrator 设置中指定的级别匹配的日志才会发送到 Orchestrator。
通过 Assistant 更改默认日志记录级别:
- 在 UiPath Assistant 中,转到“首选项”菜单,然后访问“Orchestrator 设置”
- 在“日志记录”部分的“日志级别”下拉菜单中,选择所需的日志记录级别。
备注:
如果机器人以服务模式安装,则需要管理员权限才能编辑此设置。
Orchestrator 目标
如果机器人已连接到 Orchestrator,则只有与 Assistant 或 Orchestrator 中设置的级别匹配的日志才会显示在“日志”页面上。
如果 Orchestrator 处于不可用状态,则在连接恢复前,系统会将日志存储在可用磁盘空间的本地数据库 (C:\Windows\System32\config\systemprofile\AppData\Local\UiPath\Logs\execution_log_data) 中。恢复连接后,系统会按日志的生成顺序将其分批发送。
将日志成功发送至 Orchestrator 后,系统不会删除此数据库。
NLog 目标
另外,可以通过编辑 <Installation Folder>\NLog.config 文件来配置日志目标和内容。
日志的目标位置由<Installation Folder>\NLog.config文件控制。诊断日志由内部类型记录器收集,并使用 NLog 目标进行转发。
默认情况下,执行日志存储在%LocalAppData%\UiPath\Logs文件夹中的文件中。“WorkflowLogging”记录器会收集消息,通过使用 NLog 目标即可转发该类日志,如下方 NLog.config 文件中的参数所示:
<?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>
<?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><?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>备注:maxArchiveFiles是控制存档文件数量的参数。备注:Editing the
NLog.configfile 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>
<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"/>)也会记录拥有其他状态的活动。
不仅可以修改活动状态,还可以修改变量和参数。有关自定义的更多信息,请参见此处。
修改 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(当机器人以服务模式安装时)。 ~/.local/share/UiPath/Logs/internal/Robot.log在其他平台上。
- Windows 上的
驱动程序诊断日志
驱动程序跟踪已写入 .etl 文件。
要启用驱动程序跟踪,请以管理员权限打开命令提示符,使用 cd 参数(例如 cd C:\Program Files\UiPath\Studio)访问安装目录,然后运行 UiRobot.exe --enableLowLevel 命令。
要禁用驱动程序跟踪,请以管理员权限打开命令提示符,使用 cd 参数(例如 cd C:\Program Files\UiPath\Studio)访问安装目录,然后运行 UiRobot.exe --disableLowLevel 命令。
我们建议仅在调查问题时启用“低级别追踪”,并在调查会话结束后将其禁用。
此外,仅在禁用该功能后,才会生成包含追踪信息的 .etl 文件。
无需重新启动机器人即可使更改生效。