So I'm used to JS where I can console.log() most errors to assess the best way to debug what's going on.

In Craft, as many of the sites I am working on are live and in production and I struggle (horribly) to find solutions to issues! Also because the site is live I cannot enable dev mode....

Is there a way to console log errors? (from looking at posts here I do not think there is, but I must ask directly).

If there is not, maybe someone could explain how they would handle this situation (Which I am currently in so this is not hypothetical).

I'm using SS twitter feed to populate a page with twitter tweets.

I would like to see what data is available to me, to use (or not use if some posts are different - and have to write conditions for).

In JS I would console log this i.e.

var tweets = getTweetsFunction 

this would display an array of objects and from there I could find out what fields are available.

But in Twig, posting

{% for tweet in craft.ssTwitterFeed.displayPost( '4' ) %}
{& endfor &}

just gives me the "Server error" message.

Side note here, I have enabled the craft dev tool bar

enter image description here

And can see that it has a log section, can you log twig variables to this section to review them?

I understand that this might be a really basic question but it's driving me mad that every wrong turn ends in Server Error.

Thanks for any help, W

As of craft 3.2 dump and die is enabled even for sites that are running without dev mode - dump and die is the solution to this issue.

1 Answer 1


The usual method for debugging a Craft site is to pull down a copy of the production database content, import it into your local development database and run a local copy of the site's code on your computer. You can run the site using Craft's Nitro development environment, or use other local development environment frameworks like Valet or MAMP.

Once you have this local development site running, you can make changes to the templates to help debug issues or view the properties of objects, just by modifying the Twig templates. The Twig dump function is useful for viewing the contents of an object to see which properties you have available:

{% for tweet in craft.ssTwitterFeed.displayPost( '4' ) %}
    {{ dump(tweet) }}
{% endfor %}

If you're running the site with devMode enabled, the dd tag (Dump-and-die) is also helpful. This will dump out the variable and nothing else, i.e. your page won't render but instead you will get a formatted dump of the variable you're inspecting:

{% dd(craft.ssTwitterFeed.displayPost('4')) %}
  • Awesome info thank you for sharing your knowledge - Random question, but is it possible to enable DEV mode against a single page in craft? I have added a dev page to the website so I can manipulate the template free of effecting a customer facing page - but cannot seem to get Dump to work on said page so imagine that DEV mode needs to be enabled for this.
    – Wally
    Mar 12, 2021 at 12:42
  • 1
    Unfortunately no, devMode is a global config setting that applies to the whole environment. Mar 12, 2021 at 13:01
  • 2
    You could enable devMode on individual pages with something like 'devMode' => ($_SERVER['REQUEST_URI'] == '/whatever/page') Mar 12, 2021 at 17:31
  • Clever! Very neat solution. Mar 13, 2021 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.