You can store function execution logs to Log Service, and then perform operations
such as debugging, fault analysis, and data analysis based on the logs. This topic
shows you how to configure projects and Logstores for Function Compute in the Function
Compute console and view function execution logs in the Log Service console.
Background information
Log Service is an end-to-end logging service developed by Alibaba Cloud. To store function execution
logs by using Log Service, you must configure projects and Logstores in corresponding
services and authorize the services to access Log Service. Function execution logs
are stored in Logstores. All function execution logs of a service are stored in the
same Logstore.
Procedure
- Log on to the Function Compute console and configure a project and a Logstore for a service.
- You can select Bind Log when you create a service. For more information, see Create a service.
After the service is created, Function Compute creates and binds the corresponding
project and Logstore in the background and authorizes you to write function execution
logs to Log Service resources.
Note Log Service resources created by Function Compute in the background are charged in
pay-as-you-go mode. For more information, see
Billing overview.

- You can configure a project and a Logstore when you update a service. For more information,
see Modify a service. Before you configure them, make sure that the corresponding Log Service resources
have been created. For more information about how to create the Log Service resources,
see the "Step 1: Create a project and a Logstore" section of the Quick Start of Log Service topic.
You must set the Log Project and Logstore parameters to the created project and Logstore in the Log Config section. In addition, you must set the parameters in the Role Config section to authorize Function Compute to write function execution logs to Log Service,
as shown in the following figure. For more information, see Permissions.

- Log on to the Log Service console to view logs. For more information, see the "Step 3: Query and analyze logs" section
of the Quick Start of Log Service topic.
In the service for which the project and Logstore are configured, create a default
function whose output is hello world. When the function is executed, the generated
logs are stored in the Logstore. You can view the logs in the Log Service console.

References
You can also use Function Compute Command Line Interface (fcli) to configure Log Service
resources and view function execution logs. For more information, see Use fcli for the first time.