Katello/katello — pull request #1271 by lzap (2012-12-18 09:46:22+00:00)
Title: logging - orchestration logger and uuid request tracking

After several days fighting with a data integrity error, I have implemented new log for orchestration. It is written to log/production_orch.log and log/production_delayed_jobs_orch.log and it looks like this:

[ INFO 2012-12-18 09:41:38 cceb795a72befdd0229dc92f0c6e5e5d #26389] Task create candlepin consumer: bb.lan_DK57x8wB42Wt (1/2) > System.set_candlepin_consumer()
[ INFO 2012-12-18 09:41:38 cceb795a72befdd0229dc92f0c6e5e5d #26389] Task create pulp consumer: bb.lan_DK57x8wB42Wt (2/2) > System.set_pulp_consumer()
[ INFO 2012-12-18 09:41:42 fd49febbb199527bfb35b5291a3c9e5e #26389] Task update candlepin consumer: bb.lan_DK57x8wB42Wt (1/2) > System.find(10).update_candlepin_consumer()
[ INFO 2012-12-18 09:41:42 47b9998d542933f97e20ac753a31e753 #26389] Task delete candlepin consumer: bb.lan_DK57x8wB42Wt (1/2) > System.find(10).del_candlepin_consumer()
[ INFO 2012-12-18 09:41:43 47b9998d542933f97e20ac753a31e753 #26389] Task delete pulp consumer: bb.lan_DK57x8wB42Wt (2/2) > System.find(10).del_pulp_consumer()

As you can see, it shows you:

* Request uuid - cceb795a72befdd0229dc92f0c6e5e5d
* Task name - create candlepin consumer: bb.lan_DK57x8wB42Wt
* Task number and queue length - 1/2
* Method on model that has been called - > System.find(10).del_pulp_consumer()

Also this patch adds request uuids into production log (only - not in the development mode). Now with simple grep we can find all the relevant log records when something goes wrong in the production both orchestration logs and rails logs.

I will push logrotate configuration for this soon, please review. Thanks to Petr and Dmitri for helping me with this.