1

I have this exact error on my site.

I am trying to troubleshoot the error using dd(debug_backtrace()); through the Devel module as is described on the link above.

Being the noob on developing I can't figure out how to print the output in a drupal_debug.txt file under the tmp folder in the root of my Drupal Installation (As is described in the in the link above).

I have tried dd(debug_backtrace()); but I don't see any error file being created so I also tried dd(debug_backtrace('drupal_debug.txt')); but I get the error:

Warning: file_put_contents(): Only 0 of 1 bytes written, possibly out of free disk space in drupal_debug() (line 1793 of /home/bigcypru/public_html/sites/all/modules/devel/devel.module).

Devel was unable to write to /tmp/drupal_debug.txt.

I created the file manually and set 777 permissions to be sure is writable but still get the same error and I am sure I have enough space in my hosting plan.

2 Answers 2

1

You can run:

dd(debug_backtrace());

which prints the output to drupal_debug.txt file by default in your temporary folder which can be found in your tmp folder (See: Where Drupal creates temporary files?). You can specify different file, but in Drupal settings related to file system.

The call to dd(debug_backtrace('drupal_debug.txt')); is invalid, since debug_backtrace() accepts int $options, not the file.

Regarding this warning:

Only 0 of 1 bytes written, possibly out of free disk space in drupal_debug(). Devel was unable to write to /tmp/drupal_debug.txt.

it says you're likely to be out of free disk space on your hard drive. So you should remove this file from your temporary folder at /tmp, then try again.

To make it more light, use the following version:

dd(debug_backtrace(FALSE, 5));

which won't populate all objects (FALSE) and limit number of stack frames returned to 5.

If your function is called too many times, try adding die() or exit(); to avoid multiple calls.

You can also use the following one-liner:

array_walk(debug_backtrace(),create_function('$a,$b','print "<pre>{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']});</pre>\\n";'));

which will print even more minimalized version of the backtrace to avoid out-of-space issues.

1

I also can recommend the Past Log module.

It offers you enhanced logging capabilites (including backtrace) out of the box!

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.