Debugging
=========

Debug mode
----------

When debug mode is enabled ownCloud, a variety of debugging features are enabled - see debugging documentation. Add the following to the very end of :file:`/config/config.php` to enable it::

  define( "DEBUG", 1);


Identifying errors
------------------

ownCloud uses custom error PHP handling that prevents errors being printed to web server log files or command line output. Instead, errors are generally stored in ownCloud's own log file, located at: :file:`/data/owncloud.log`


Debugging variables
-------------------

You should use exceptions if you need to debug variable values manually, and not alternatives like trigger_error() (which may not be logged).

e.g.:

.. code-block:: php

  <?php throw new \Exception( "\$user = $user" ); // should be logged in ownCloud ?>

not:

.. code-block:: php

  <?php trigger_error( "\$user = $user" ); // may not be logged anywhere ?>

To disable custom error handling in ownCloud (and have PHP and your web server handle errors instead), see Debug mode.


Debugging Javascript
--------------------

By default all Javascript files in ownCloud are minified (compressed) into a single file without whitespace. To prevent this, see Debug mode.


Debugging HTML and templates
----------------------------

By default ownCloud caches HTML generated by templates. This may prevent changes to app templates, for example, from being applied on page refresh. To disable caching, see Debug mode.


Using alternative app directories
---------------------------------

It may be useful to have multiple app directories for testing purposes, so you can conveniently switch between different versions of applications. See the configuration file documentation for details.
