# Logging sometimes reports wrong database in multisite

**URL:** <https://meta.discourse.org/t/logging-sometimes-reports-wrong-database-in-multisite/69088>\
**Category:** Feature\
**Created:** [August 30, 2017, 5:03pm UTC](https://meta.discourse.org/t/logging-sometimes-reports-wrong-database-in-multisite/69088 "2017-08-30T17:03:53Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)\
**Post date:** [August 30, 2017, 5:03pm UTC](https://meta.discourse.org/t/logging-sometimes-reports-wrong-database-in-multisite/69088/1 "2017-08-30T17:03:53Z")

</div>

I was investigating an issue and it seems like the lines in `production.log` sometimes report the wrong database.

I’ve seen this a few times before, so this is not a single incident. Here’s a good and clear example where you can see that the third line has been logged as belonging to database `db3785` where it obviously is about the same request as the fourth line, which is logged as belonging to `db9210`.

![image](https://global.discourse-cdn.com/meta/original/3X/6/6/66c35d34ad9bf5989c5ba57db6fe512b87143894.png)

I was unable to pinpoint the responsible code, it might be deep inside Rails, and this is probably a race condition.

v1.8.x on Unicorn.

_No, we’re not using Docker, no, I don’t think that matters here, and no, I don’t expect a quick solution.  
Just letting you guys know what we are seeing 🙂_

---

_[View the full topic](https://meta.discourse.org/t/logging-sometimes-reports-wrong-database-in-multisite/69088)._
