title: Generate unique ID in Java, to label groups of related entries in a log
body: <p>There are several posts on SO on this topic. Each of those talk about a specific approach so wanted to just get a comparison in one question.</p>
  
  <p><a href="https://stackoverflow.com/questions/17970873/using-new-date-as-unique-identifier">Using new Date() as unique identifier</a></p>
  
  <p><a href="https://stackoverflow.com/questions/192920/generating-a-globally-unique-identifier-in-java">Generating a globally unique identifier in Java</a></p>
  
  <p>I am trying to implement a feature where we are able to identify certain events in the log file. These events need to be associated with a unique id.
  I am trying to come up with a strategy for this unique ID generation.
  The ID has to have 2 parts :
  some static information + some dynamic information
  The logs can be searched for the pattern when debugging of events is needed.
  I have three ways :</p>
  
  <ul>
  <li>static info + Joda Date time("abc"+2014-01-30T12:36:12.703)</li>
  <li>static info + Atomic Integer</li>
  <li>static info + UUID</li>
  </ul>
  
  <p>For the scope of this question, multiple JVMs is not a consideration.
  I need to generate unique IDs in an efficient manner on one JVM. Also, I will not be able to use a database dependent solution.</p>
  
  <p>Which of the 3 above mentioned strategies works best ?</p>
  
  <ul>
  <li>If not one from the above, any other strategy ?</li>
  <li>Is the Joda time based strategy robust ? The JVM is single but there will be concurrent users so there can be concurrent events.</li>
  <li>In conjunction with one of the above/other strategies, Do I need to make my method thread-safe / synchronized ?</li>
  </ul>