Logging

<< 点击显示目录 >>

主页  exOS使用助手 > exOS Automation Help > Development > Programming >

Logging

exOS API 具备从整个系统的各种程序中收集日志信息并将其收集到中央日志记录器中的功能。默认情况下,这就是 AR 日志记录器。

集中收集

日志在每个系统中集中收集,这意味着 Linux 和 AR 中各有一个日志服务器。

在 exOS TP 中,Linux 中的日志服务器会将所有日志信息转发到 AR 日志服务器,并写入 AR 日志记录器。

当然,除了将 Linux 日志信息写入 AR 日志记录器之外,AR 日志服务器还会收集来自 AR 应用程序的所有本地日志信息,并将这些信息写入日志记录器。

Logging

由于向系统中所有模块分发日志配置的机制,如果过滤器不匹配,使用exos_log的应用程序将不会转发任何信息。换句话说,exos_log_xxx()只会快速返回,因为过滤是在本地进行的。

在应用程序中,所有日志都可以通过传递给 exos_log_init() 函数的名称来区分 。
 

运行时更改

AutomationStudio中的exostarget配置会为系统启动设置初始日志配置。

在运行时,可通过以下方式配置当前日志过滤器,即日志类型、日志级别和排除的模块

a.) ExLogConfig 功能块

b.)AR或Linux的C-API函数exos_log_change_config()。

EXOS_ERROR_CODEexos_log_change_config(exos_log_handle_t*log,constexos_log_config_t*config);

这些函数可随时调用,并将更改所有向系统记录日志的模块的配置。


The exOS API comes with the functionality to collect log messages from various programs throughout the system and collect them in a central logger. By default, this is the Automation Runtime logger.
 

Central collection

Logs are collected centrally on each system, meaning there is one log-server in Linux and one in AR.

In the exOS TP, the log-server in Linux forwards all log messages to the AR log-server, where they are written into the AR logger.

Additionally to writing the Linux log messages into the AR Logger, the AR log-server, of course, also collects all local log messages from AR applications and writes those to the logger, too.

Logging

Due to the mechanism of distributing a log configuration to all modules in the system, applications that are using the exos_log will not forward any information if the filters do not match. In other words, exos_log_xxx() will just have a quick return, as filtering occurs locally.

In the applications, all logs are separable by the name you pass to the exos_log_init() function.
 

Runtime changes

The exostarget configuration in Automation Studio sets the initial log configuration for the startup of the system.

During runtime, the current log filter, meaning log-type, log-level and excluded modules can be configured using

a.) the ExLogConfig function block

b.) the C-API function exos_log_change_config() from AR or Linux.

  EXOS_ERROR_CODE exos_log_change_config(exos_log_handle_t *log, const exos_log_config_t *config);

These functions can be called at any time and will change the configuration for all modules that log to the system.