Logs are an important tool for us to locate system issues. NocoBase's server logs mainly include interface request logs and system operation logs, supporting configuration of log level, rolling strategy, size, printing format, and more. This document mainly introduces the related content of NocoBase server logs, as well as how to use the logging plugin to package and download server logs.
Log-related parameters such as log level, output method, and printing format can be configured through environment variables.
NocoBase supports configuring four different log formats.
consoleThe default format in development environment, messages are highlighted in color.
jsonThe default format in production environment.
logfmtdelimiterSeparated by delimiter |.
The main directory structure of NocoBase log files is:
storage/logs - Log output directory
main - Main application name
request_YYYY-MM-DD.log - Request logsystem_YYYY-MM-DD.log - System logsystem_error_YYYY-MM-DD.log - System error logsql_YYYY-MM-DD.log - SQL execution logsub-app - Sub-application name
request_YYYY-MM-DD.logrequest_YYYY-MM-DD.log, interface request and response logs.
| Field | Description |
|---|---|
level | Log level |
timestamp | Log print time YYYY-MM-DD hh:mm:ss |
message | request or response |
userId | Only in response |
method | Request method |
path | Request path |
req / res | Request/Response content |
action | Requested resources and parameters |
status | Response status code |
cost | Request duration |
app | Current application name |
reqId | Request ID |
reqId will be carried to the front end via the X-Request-Id response header.
system_YYYY-MM-DD.log, application, middleware, plugins, and other system operation logs, error level logs will be printed separately to system_error_YYYY-MM-DD.log.
| Field | Description |
|---|---|
level | Log level |
timestamp | Log print time YYYY-MM-DD hh:mm:ss |
message | Log message |
module | Module |
submodule | Submodule |
method | Called method |
meta | Other related information, JSON format |
app | Current application name |
reqId | Request ID |
sql_YYYY-MM-DD.log, database SQL execution logs. INSERT INTO statements are limited to the first 2000 characters.
| Field | Description |
|---|---|
level | Log level |
timestamp | Log print time YYYY-MM-DD hh:mm:ss |
sql | SQL statement |
app | Current application name |
reqId | Request ID |
