With The Django Debug Toolbar
Somewhere in your Python code (not a template):
import logging
logging.debug(something_you_want_to_log)
With Firebug
Somewhere in your JavaScript or the Firebug Console:
console.log(something_you_want_to_log);
That was easy.