Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6619057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:55:04+00:00 2026-05-25T20:55:04+00:00

Are there any lightweight alternatives to django-sentry for error logging in a Django environment?

  • 0

Are there any lightweight alternatives to django-sentry for error logging in a Django environment?

I used django-db-log earlier which now known as django-sentry. Some of the others I found were pretty much dead as they had no commits in the last two years almost.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:55:04+00:00Added an answer on May 25, 2026 at 8:55 pm

    Sentry being overkill and Djangodblog being deprecated, I rolled my own, cannibalising the necessary parts from both.

    How it works is by catching the error signal. Then it uses Django’s inbuilt exception reporter to generate the fancy 500 error page that Django displays when debugging is enabled. We store this in the DB and render it in the admin console.

    Here’s my implementation:

    Model:

    class Error(Model):
        """
        Model for storing the individual errors.
        """
        kind = CharField( _('type'),
            null=True, blank=True, max_length=128, db_index=True
        )
        info = TextField(
            null=False,
        )
        data = TextField(
            blank=True, null=True
        )
        path = URLField(
            null=True, blank=True, verify_exists=False,
        )
        when = DateTimeField(
            null=False, auto_now_add=True, db_index=True,
        )
        html = TextField(
            null=True, blank=True,
        )
    
        class Meta:
            """
            Meta information for the model.
            """
            verbose_name = _('Error')
            verbose_name_plural = _('Errors')
    
        def __unicode__(self):
            """
            String representation of the object.
            """
            return "%s: %s" % (self.kind, self.info)
    

    Admin:

    class ErrorAdmin(admin.ModelAdmin):
        list_display    = ('path', 'kind', 'info', 'when')
        list_display_links = ('path',)
        ordering        = ('-id',)
        search_fields   = ('path', 'kind', 'info', 'data')
        readonly_fields = ('path', 'kind', 'info', 'data', 'when', 'html',)
        fieldsets       = (
            (None, {
                'fields': ('kind', 'data', 'info')
            }),
        )
    
        def has_delete_permission(self, request, obj=None):
            """
            Disabling the delete permissions
            """
            return False
    
        def has_add_permission(self, request):
            """
            Disabling the create permissions
            """
            return False
    
        def change_view(self, request, object_id, extra_context={}):
            """
            The detail view of the error record.
            """
            obj = self.get_object(request, unquote(object_id))
    
            extra_context.update({
                'instance': obj,
                'error_body': mark_safe(obj.html),
            })
    
            return super(ErrorAdmin, self).change_view(request, object_id, extra_context)
    
    admin.site.register(Error, ErrorAdmin)
    

    Helper:

    class LoggingExceptionHandler(object):
        """
        The logging exception handler
        """
        @staticmethod
        def create_from_exception(sender, request=None, *args, **kwargs):
            """
            Handles the exception upon receiving the signal.
            """
            kind, info, data = sys.exc_info()
    
            if not issubclass(kind, Http404):
    
                error = Error.objects.create(
                    kind = kind.__name__,
                    html = ExceptionReporter(request, kind, info, data).get_traceback_html(),
                    path = request.build_absolute_uri(),
                    info = info,
                    data = '\n'.join(traceback.format_exception(kind, info, data)),
                )
                error.save()
    

    Init:

    from django.core.signals import got_request_exception
    
    from modules.error.signals import LoggingExceptionHandler
    
    got_request_exception.connect(LoggingExceptionHandler.create_from_exception)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any lightweight mvc webframework which is not necessary to install to the
is there any lightweight command line batch image cropping tool(Linux or Windows) which can
Is there any query which can return me the number of revisions made to
Is there any known way of listing the WMI classes and their properties available
Is there any lightweight validation library available for PHP that easily can check if
is there any simple/lightweight solution to change at least some of non-ASCII symbols to
Are there any lightweight frameworks out there for this task. I have a collection
Is there any free, open source lightweight SCORM 2004 player in Javascript? I am
Is there any lightweight *nix OS dedicated for programming purposes? Actually, I have a
I'm wondering if there are any extremelly lightweight and compact web servers with implemented

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.