title: Real world user activity logging strategy for web applications
body: <p>I have a web application and my client requests that he wants to know.<br> </p>
  
  <p>I have come up with two ideas.<br/>
  I would like to have my ideas verified if they are correct.<br/></p>
  
  <p><br/>
  These are the client requirements.<br/><br/>
  who: who the visitor is(e.g. remoteAddress-IP)<br/>
  when: what time the visitor did something on the web application<br/>
  what: what exact action did the visitor take, such as "pushed print button"<br/>
  where: which page, e.g. a URL the visitor accessed<br/><br/></p>
  
  <p>My idea 1.<br/>
  Simply issue an SQL query to log user activities for everyone visiting the web site.
  If the visitor clicked on a link to a page, the web application would write the user activity to the database and render the requested page.<br/>
  I think this will have a bad impact on user experience. Page rendering could get slower because it has to do extra work. Will this method end up issuing too many SQL queries and ultimately be a bad idea ?<br/>
  <br/>
  My idea 2.<br/>
  Start a new thread for each user or each user activity such as clicking print button.
  Page rendering go on at its own speed and logging will be seperately done in the thread.<br/> I think this might create too many threads. Is this a good idea or would it end up using too much resources ? <br/></p>
  
  <p>I wonder if any of those are a good, real world practice. If there is a better way, please share. :)</p>