title: What is the best practice for logging users activity?
body: <p>I'd like to implement users' activity logging for my web app (<code>php</code>+<code>js</code>+<code>mysql</code>).</p>
  
  <p>Previously, I've used this appoach: </p>
  
  <ul>
  <li>on users login create a temporary table in the database to store users id</li>
  <li>create triggers for all tables which insert row in <code>activity</code> table using users id from that temporary table</li>
  </ul>
  
  <p>Now I don't really want to put so much logic in the database, so my question is: what is the best practice? Should I stay with the described method, or should I use something else?</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/2488267/how-to-log-user-actions-with-php-and-mysql">this</a> question, but I'm intrested in comparing the described method with one in the answers.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>Why do I need logs: I need to know which user to blame if something goes wrong =)</p>
  
  <p>Logs have to contain changed data and new data to see what has actually changed.</p>
  
  <p>There won't be many users cause it's a corporate app and our company is not so large.</p>
  
  <p>The main question is where should I put logging logics: database or application (php backend) level?</p>