title: Python logging to same file, different users
body: <p>I am using the logging module of python. </p>
  
  <p>In the case of unit tests (we use py.test) every time tests are launched, some log information goes to a certain file. In the integration server, everytime someone pushes code (we also use git :) we run the tests. </p>
  
  <p>The problem is that once the file is created, by user A when user B tries to run the tests, the tests will fail as user B has no permission to write on the same file. </p>
  
  <p>So far, we have changed the file permissions manually, but looks like a dirty solution. Also we though of creating a log file per user, but again, does not feel right. </p>
  
  <p>Our code for the logging in the tests is</p>
  
  <pre><code>logging.basicConfig(level=logging.DEBUG,
      format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
      datefmt='%m-%d %H:%M',
      filename='/tmp/py.test.log',
      filemode='w')
  log.setLevel(logging.DEBUG)
  log.addHandler(logging.StreamHandler())
  </code></pre>
  
  <p>Is there a way to avoid this problem? Maybe using filemode = 'a' could do it, but lets assume I want a new file everytime (to be honest this is more curiosity that a real problem, still I want to do it right)</p>
  
  <p>Thanks :)</p>