SAP Cloud for Customer Cloud Application Studio的Trace功能

147 阅读2分钟

You can activate tracing on any system that you can log on to with your developer user account. When a trace is
active, script files are logged as they are executed, and methods from the Trace class are evaluated and
recorded.

当trace激活后,script files被执行时,其执行明细会被记录下来。

The Trace class provides methods to record informational messages (Trace.Info) and error
messages (Trace.Error).

You can activate tracing for a business user. When tracing has been activated for a business user, the code that
is executed by that user is traced. Because tracing is a developer feature, business users cannot enable tracing
directly.

Business User无法为自己激活Trace,因为其无法登陆Cloud Application Studio. 但是Development User可以为某Business User激活trace,当该Business User执行代码时,script执行会被记录下来。

When you have started tracing, some information is traced automatically, including the identity of each script file that is executed, and the time taken by the script file to execute.

当trace被激活时,某些信息会自动被记录下来,包括执行script文件的用户id,和执行时间。

You can enhance the information that is recorded during a trace by adding methods from the Trace class to your script files. This way, you can record informational and error messages, and output variable values.

应用开发人员可以通过ABSL namespace下的Trace类提供的info或者error方法,记录更多的信息。

Local Trace的含义:

Local traces are the traces that are created when you start tracing on the system that you are logged on with your developer user account. You can use local traces to evaluate code that is in development, or to investigate
issues that have been reproduced on a local system.

Local trace for development users

When you start tracing, the script files that you run under your developer user account are recorded and
the methods from the Trace class are evaluated and recorded.

Local trace for business users

You can configure tracing to record the actions of a business user instead of tracing the actions performed
under your developer user account. This enables you to observe workflows that are performed by a business user in the cloud solution. Business users cannot activate tracing directly because tracing is a developer feature that is accessed only in the studio. When you run a trace for a business user, the script files and the trace statements in the code that are executed by the business user are evaluated and recorded.

SAP Cloud for Customer的Trace方法对运行时性能有无影响?

Trace information is only recorded while an active trace is running. When tracing is not active, no system resources are allocated for tracing. The methods from the Trace class are only evaluated when a trace is active; therefore you can include them in your script files without incurring any performance penalty during the course of regular operation.

Trace.info, Trace.error此类方法,如果trace未处于激活状态,根本不会得到执行,因此即使在script file里使用Trace类,对性能也不会有影响。

Tracing is automatically stopped if it is left running.

script file执行完毕之后,trace自动停止。