title: How to name a log file based on date and time? how to print all exception and how to make directory in java?
body: <p>I have a situation in which i have to make a different directory to put my logs.
   i tried </p>
  
  <pre><code>File file = new File("c:\\className").mkdir();   But got the error incompatible type,
  Found:boolean Required java.io.File, although i have imported java.io.File.
  </code></pre>
  
  <p>For the log file name i want to use something that make difference in log file name so that i can see all logs for several attempts to rub the application? how to achieve that... Please guide me to minimal code that make it...</p>
  
  <p>And in a try statement i did so many thing like  </p>
  
  <pre><code>try{
          File file=new File("C:\\className").mkdir();
          fh = new FileHandler("C:\\className\\className.log");   
              logger.addHandler(fh); 
          logger.setUseParentHandlers(false);
          SimpleFormatter formatter = new SimpleFormatter();  
                fh.setFormatter(formatter);  
              }
           catch(Exception e){ }
  </code></pre>
  
  <p>I want to add a log in catch block so that any kind of exception can be printed in my log file. Kindly help ... Thanks in Advance</p>