<p>My view is below</p>
<pre><code>@api_view(['GET'])
def get_test(request):
    return HttpResponse('Ok', status.HTTP_200_OK)
</code></pre>
<p>and my path in urls.py in urlpatterns is as below.</p>
<pre><code>path('api/test', views.get_test),
</code></pre>
<p>EDIT:- I did not ask the right question before. I keep getting &quot;[DEBUG] GET /api/test&quot; in the console every 3 seconds because of the liveness probe and I need to disable the console log for this endpoint.</p>

Vinny
<p>One way to do that is to create a separate logger with that level. In your <code>settings.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>LOGGING = {
    &quot;version&quot;: 1,
    &quot;disable_existing_loggers&quot;: False,
    &quot;loggers&quot;: {
        &quot;&quot;: {
            &quot;level&quot;: &quot;ERROR&quot;,
        },
        &quot;critical_only&quot;: {
            &quot;level&quot;: &quot;CRITICAL&quot;,
        },
    },
}
</code></pre>
<p>Then in your critical-only view you can use that logger, e.g.:</p>
<pre class="lang-py prettyprint-override"><code>critical_only_logger = logging.getLogger(&quot;critical_only&quot;)
critical_only_logger.error(&quot;error&quot;)
</code></pre>
<p>The last line above will not print, as expected. For the other, &quot;normal&quot; logger you can do the usual <code>logger = logging.getLogger(__name__)</code> in other views where you might need more details.</p>
<p>To disable logging, just do that at the top of your view: <code>logging.disable(logging.CRITICAL)</code></p>
