Add DEBUG logging if debug is enabled.
Use file backend or memcached if it's enabled.