Skip to main content
Django GitLab Logging
=====================

Django GitLab Logging is a custom log handler that has been written with the purpose of auto-opening (and assigning) issues on GitLab everytime something goes south with backend code.

Useful for production deployments, where you want to move the flood of 500 errors you get in your mailbox to your GitLab issue tracker.

Django GitLab Logging is smart enough to recognize similar errors, thus not opening blindly a new issue everytime. It is also capable of re-opening closed issues that are encountered again.

## Configuration

* Add `gitlab_logging` to your INSTALLED_APPS.

* Drop **those lines of configuration in your settings.py**, taking care of filling everything:

```python
# GitLab options
GITLAB_HOST = 'https://gitlab.server.tld' # Beware: no trailing slash there!
GITLAB_USER = 'gitlab.user'
GITLAB_TOKEN = 'USER_GITLAB_TOKEN' # Get this from GitLab user account information
GITLAB_PROJECT_ID = 114 # Get the project ID from the DB
GITLAB_ASSIGNEE_ID = 2 # Get the assignee ID from the DB (optional, you can drop this parameter)
```

* Then, **ensure you have Celery installed with Django**. Django GitLab Logging cannot work without a tasker (here, Celery), since GitLab API calls needs to be done asynchronously to avoid blocking your Web workers in case of network delays or GitLab remote server downtimes.

* **Proceed either** a `syncdb` or a `migrate` (depending on if you're using South or not)

* **Map the custom GitLab Logging handler**:

```python
'handlers': {
# (....)

'gitlab_issues': {
'level': 'ERROR',
'class': 'gitlab_logging.handlers.GitlabIssuesHandler',
},
},
```

* **Activate your GitLab logging handler** where you need it:

```python
LOGGING['loggers'] = {
'django.request': {
'handlers': ['all_console', 'django_file', 'gitlab_issues'],
'level': 'DEBUG',
'propagate': True,
},

# (....)
}
```

* You're done! :v:

## Notes

* This module is kept up-to-date with latest GitLab API changes. Thus, ensure you're running the latest GitLab version in time when using Django GitLab Logging!

* Django GitLab Logging has been built by the happy folks at [Waaave Network](https://waaave.com/), for their website needs.

* You may want to read the following tutorial about Django GitLab Logging: [Automatically open GitLab issues for Django errors](https://waaave.com/tutorial/django/automatically-open-gitlab-issues-for-django-errors/)

Metadata

Release files for django-gitlab-logging 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-gitlab-logging 0.2.2
File Size Uploaded
django-gitlab-logging-0.2.2.tar.gz 7.6 kB Details

Release files / django-gitlab-logging-0.2.2.tar.gz

Download URL django-gitlab-logging-0.2.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
37293aab481e974d1a0e8a032fab4a50914938570252452d5e74c8892f274f82
BLAKE2b-256 checksum
How to use checksums
3841b1a2a747e40557a64abe0705c5f72e73219f12501e9d8d60b9b6aba915ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page