Application Logs
Many times we may be interested in consulting the logs of an application or a specific component,
Pre-requirements
- Playground is installed
- An application is deployed
playground login
Login success
Checking application logs
Suppose you have an application deployed,
playground apps
NAME STATUS
<appName> APP_OK
To retrieve the logs of all components of that application execute:
playground apps logs <appName>
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.401703900Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.694353300Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.703567900Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.998947300Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Initializing database files
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:10.089821100Z 2021-04-20T19:12:10.084794Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:11.824240300Z 2021-04-20T19:12:11.823032Z 0 [Warning] InnoDB: New log files created, LSN=45790
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.003747300Z 2021-04-20T19:12:12.003462Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.063374000Z 2021-04-20T19:12:12.062918Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4f6aa729-a20c-11eb-811a-8a4a70cada5e.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.065024200Z 2021-04-20T19:12:12.064740Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
...
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:34.552046300Z
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:34.552069700Z MySQL Connection Error: (2002) Connection refused
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:37.553334700Z
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:37.553374400Z
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:37.553687500Z MySQL Connection Error: (2002) Connection refused
[comp-2-6fdbdbf9b8-p4nsg] [comp-2] 2021-04-20T19:12:37.553499100Z Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22
Notice that the logs are being automatically streamed to your terminal. To stop retrieving logs use ctrl+c
.
Checking component logs
Other times you may be interested in retrieving the log of a single component. To do that, retrieve the list of components associated with an application as follows:
playground apps info <appName>
NAME STATUS
<appName> APP_OK
COMPONENT STATUS SCOPES TRAITS
<comp-1> OK
<comp-2> OK
To retrieve the logs of comp-1
, execute:
playground apps logs appName/comp-1
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.401703900Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.694353300Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.703567900Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:09.998947300Z 2021-04-20 19:12:09+00:00 [Note] [Entrypoint]: Initializing database files
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:10.089821100Z 2021-04-20T19:12:10.084794Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:11.824240300Z 2021-04-20T19:12:11.823032Z 0 [Warning] InnoDB: New log files created, LSN=45790
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.003747300Z 2021-04-20T19:12:12.003462Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.063374000Z 2021-04-20T19:12:12.062918Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4f6aa729-a20c-11eb-811a-8a4a70cada5e.
[comp-1-864b6b49-f47l8] [comp-1] 2021-04-20T19:12:12.065024200Z 2021-04-20T19:12:12.064740Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
What’s next
- Check our deploy tutorials on the different methods to deploy applications.