Skip to main content
Version: Next

Logging

Configures the logger, see the runtime documentation.

Log formatting

Logs are automatically pretty-printed by pino-pretty to improve readability when running Platformatic DB in a terminal environment where standard out stdout supports TTY

$ npx platformatic db start
[11:20:33.466] INFO (337606): server listening
url: "http://127.0.0.1:3042"

In non-TTY environments, such as when logs are redirected to a file or a log management system, logs are formatted as newline-delimited JSON for easier parsing:

$ npx platformatic db start | head
{"level":30,"time":1665566628973,"pid":338365,"hostname":"darkav2","url":"http://127.0.0.1:3042","msg":"server listening"}

Query Logging

Enable detailed query logging by setting the log level to trace. This is especially useful during development for monitoring the queries executed against the database:

[12:09:13.810] INFO (platformatic-db/9695): incoming request
[12:09:13.819] TRACE (platformatic-db/9695): query
query: {
"text": "SELECT \"id\", \"title\"\n FROM \"movies\"\nLIMIT ?"
}
[12:09:13.820] INFO (platformatic-db/9695): request completed
responseTime: 10.350167274475098
info

Note extensive logging, especially at the trace level, can impact performance and should be used judiciously in production environments.

Issues

If you run into a bug or have a suggestion for improvement, please raise an issue on GitHub or join our Discord feedback channel.