Best practice for logging?

What is the best practice for logging setup?

In my case https://github.com/jedie/pyinventory_ynh (a Django app with gunicorn app server and nginx reverse proxy) i have at least these output:

  • logging nginx
  • logging from the app
  • logging from app server

All these three logger output can be setup to destinations like:

  • syslog
  • log file somewhere under /var/log/…

What is the best solution here? Currently i make this:

  • add nothing about logging in my app nginx.conf
  • log gunicorn and django into the same file: /var/log/$app/pyinventory.log

I use in Django the Python WatchedFileHandler.
In install i done this: ynh_use_logrotate "$log_file"
So these log file will be rotated, right?

Is that the best way?

Or it’s better to log to syslog?!? Use seperate log files?!?

Maybe use systemd.journal.JournaldLogHandler in Django ?
But systemd · PyPI seems not to be up-to-date? Last release from 2018