Ask IFIN: Logging to different directories

I want to have a discussion about logging strategies when writing code and thinking about use cases for two different paths ‘/var/’ and ‘/srv/’

I have found that generally when working with a web server or similar component I like the application level logs to ‘/srv/code’

When working through problems it has been helpful to have application errors in that path, rather than ‘/var/’ generally I have system components go to ‘/var/’, with naming conventions that help identify what the application is and important details of the log.

Oh, I very much want all my logs in /var/log. That way I can hunt for things in one directory with rg or grep -iRl if necessary.

Also, canonically /srv is meant for anything served to the network, which logs are not.

Seconding /var/log/ for logs. I find it very annoying to look for logs and find them in random places when there’s a directory for it in my opinion.

Yeah have to agree, /var/log or bust for me. Especially since I usually like to put /var/log on its own partition.