https://github.com/arnulfojr/sanic_apache_accesslogs
Sanic Plugin to log access logs in common or combined format
https://github.com/arnulfojr/sanic_apache_accesslogs
accesslog apache plugin python3 sanic
Last synced: 6 months ago
JSON representation
Sanic Plugin to log access logs in common or combined format
- Host: GitHub
- URL: https://github.com/arnulfojr/sanic_apache_accesslogs
- Owner: arnulfojr
- License: mit
- Created: 2018-04-25T15:13:28.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-04T11:35:07.000Z (about 8 years ago)
- Last Synced: 2025-09-22T21:38:33.315Z (9 months ago)
- Topics: accesslog, apache, plugin, python3, sanic
- Language: Python
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sanic Apache Access Logs
Sanic Plugin to log access logs in common or combined format
## How to use
```python
from sanic import Sanic
from sanic.response import json
from sanic_apache_accesslogs import AccessLogPlugin
# If using gunicorn, for example, the logging configuration should
# ignore `sanic.access`
app = Sanic(__name__)
AccessLogPlugin(app)
@app.route('/', methods=['GET'])
async def hello(request):
return json({'hello': 'world'})
if __name__ == '__main__':
# do not use sanic's access logs
app.run(host='localhost', port=5000, access_log=False)
```
## Common or Combined?
For choosing the format set the environment variable `ACCESSLOG_USE_COMBINED` to choose combined over common.
## TODO(s)
* Use Sanic configuration context to choose between the logging format.
## Contact
Arnulfo Solis
arnulfojr94@gmail.com