Menu

1 / 2

Stop Putting dd() Everywhere Debug the Database From the Source Instead

DEV Community: mysql·Tahsin Abrar·6 months ago
#51igY8Qv
#dev#enter#exit#query#article
Long article (910 words) — no AI summary yet.
Reading 0:00
15s threshold

Every backend developer has done this at some point.

A request fails.

Something is not inserting into the database.

And suddenly the codebase turns into this:

dd ( $request -> all ());

dd ( $user );

dd ( $campaign );

Log :: info ( $query );

Enter fullscreen mode

Exit fullscreen mode

You add logs in controllers.

Then services.

Then repositories.

Then queue workers.

Then event listeners.

And after two hours, you are still confused.

Because the real problem is not where you are looking.

The Day I Realized Controller Debugging Wasn’t Enough

A few months ago, a developer on a team I worked with faced a strange issue.

A simple form submission was supposed to:

create a user

assign a campaign

generate a lead

push a welcome email into queue

write an activity log

Pretty normal workflow.

But randomly, some users were being created without campaign data.

Sometimes the queue job worked.

Sometimes it didn’t.

Sometimes the transaction rolled back silently.

The first reaction?

Start adding…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.