Skip to content

ChromaticHQ/ddev-dblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tests project is maintained

DDEV dblog

Contributed and maintained by Chromatic.

What is ddev-dblog?

When using ddev to develop in a framework with a database abstraction layer, it can be finicky to set up the ability to see the actual database queries generated by the application.

dblog is a custom ddev command that allows a user to easily turn on or off database query logging and to (optionally) tail that log.

Due to the noisy nature of database query log output, the command does not add the database queries to the ddev logs output but uses its own file within your db container to store the queries.

Database query logging will slow down your application, so this command is intended to be used briefly during troubleshooting, which is why it is designed the way it is.

Getting started

Get and install your db log command

For DDEV v1.23.5 or above run

ddev add-on get chromatichq/ddev-dblog

For earlier versions of DDEV run

ddev get chromatichq/ddev-dblog

Using dblog

Following (Tailing) queries

To follow the logs live (tail), do

ddev dblog tail

which will tail the log file right in your current terminal window. ctrl+c to quit. When you quit tailing, the db query log is turned off automatically.

Turn on db query logging

If you just want to turn on the logging so you can capture a bunch of output and examine it later, do

ddev dblog on

You can find the logs in your db service at /tmp/dblog. Use

ddev ssh -s db
less /tmp/dblog

to page through it or search it.

Turn off db query logging

Remember to turn off the db query logging. The logging is a drain on your application performance.

ddev dblog off