Moving over from django / python, I am having a little trouble getting the rails logger to log all the information I want. I am wondering how/if the following can be achieved:
- Having in the log format(ter) include the specific file, function name and line where the logging statement itself was found. Essentially the equivalent of
LOG_MSG_FORMAT = '%(asctime)s %(levelname)s %(filename)s:%(funcName)s(%(lineno)d) : %(message)s'in python logger? - Being able to log all requests, via something similar to a django request logging middleware. Particularly, being able to log the username (if logged in) of every request.
Am I missing something obvious? or does this require (lots of) custom code?
I just found this railtie gem that might help although I imagine it will take some “custom code” to append username to logs. See the Readme section on logging specific controllers and models.
logging-rails railtie