Setup & access Python logs
Zerops provides 3 different logs:
How to access logs​
Build log​
Zerops GUI​
To access a build log in Zerops GUI, go to the service detail and choose Service dashboard & runtime containers in the left menu. Then open the pipeline detail of an application version and click on Build log. The build log button is available only if the build pipeline was triggered for the selected deploy.
zCLI​
To access a build log in Zerops CLI use
Read more about the zcli service log command.
Prepare runtime log​
Zerops GUI​
To access a prepare runtime log in Zerops GUI, go to the service detail and choose Service dashboard & runtime containers in the left menu. Then open the pipeline detail of an application version and click on Prepare runtime log. The prepare runtime log button is available only if the prepare runtime pipeline was triggered for the selected deploy.
zCLI​
Prepare runtime log is currently not supported in zCLI.
Runtime log​
Zerops GUI​
To access a runtime log in Zerops GUI, go to the service detail and choose Runtime log in the left menu.
Each runtime container has its own log. If your service has multiple containers, select the container in the log header.
You can filter log records by minimum severity or by time.
zCLI​
To access the log of the first runtime container in Zerops CLI use
For an aggregate log from all service's runtime containers omit the @1
Read more about the zcli service log command.
Python logging configuration​
Zerops logs all messages sent
- to the standard error (
stderr
) - to the standard output (
stdout
) - via the Python
print
orlogger.Info
methods
Severity level​
By default the print
or logger.XXX
methods create a message with the Informational (6)
severity.
Add a severity number in the <N>
format as a prefix to set a custom severity as shown below:
import logging
logger = logging.getLogger(__name__)
logger.Info('A message with the informational severity ...')
logger.Info('<0>Emergency (0) severity > system is unusable.')
logger.Info('<1>Alert (1) severity > action must be taken immediately.')
logger.Info('<2>Critical (2) severity > critical conditions.')
logger.Info('<3>Error (3) severity > error conditions.')
logger.Info('<4>Warning (4) severity > warning conditions.')
logger.Info('<5>Notice (5) severity > normal, but significant, condition.')
logger.Info('<6>Informational (6) severity > informational message.')
logger.Info('<7>Debug (7) severity > debug-level message.')
logger.Info
, logger.Warning
, logger.Debug
, logger.Error
and logger.Critical
are just aliases to
the logger.Info
method. They don't set the appropriate severity
number. Use the <N>
prefix instead. :::