r-anchor" href="#logging-accessdenied-exception" aria-label="Permalink to &quot;Logging AccessDenied Exception&quot;">​</a></h2><p>If you think the <code>CanCan::AccessDenied</code> exception is being raised and you are not sure why, you can log this behavior to help debug what is triggering it.</p><div class="language-ruby vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ruby</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><sp