title: OutputStreamWriter not writing text into text file
body: <p>In my Java Web Service I want to save each incoming request in a text file.</p>
  
  <p>This is my <code>Java</code> Web Service test Method:</p>
  
  <pre><code>@WebMethod(operationName = "hello")
  public String hello(@WebParam(name = "name") String txt) {
      String strFinal = "Hello " + txt + " !";
  
      MessageContext mc = wsContext.getMessageContext();
      HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST);
      csGlobal.RequestIP = req.getRemoteAddr();
  
      csGlobal.Logger(strFinal, csGlobal.RequestIP);
  
      return strFinal;
  }
  </code></pre>
  
  <p>This is my <code>csGlobal.Logger</code> function. csGlobal is <code>Java Class</code>:</p>
  
  <pre><code>public static void Logger(String Message, String strIP)
  {
      java.io.OutputStreamWriter SW = null;
  
      synchronized (exceptionLocker)
      {
          try
          {
              String DirectoryName = new Date().toLocaleString().substring(0, 10);
              String strLogFile = new Date().toLocaleString().substring(0, 13);
              if (!(new java.io.File(RootDir + "\\Exception\\Log\\" + DirectoryName)).isDirectory())
              {
                  (new java.io.File(RootDir + "\\Exception\\Log\\" + DirectoryName)).mkdir();
              }
              OutputStream oSW = new FileOutputStream(RootDir + "\\Exception\\Log\\" + DirectoryName + "\\" + strLogFile + ".log");
  
              SW = new java.io.OutputStreamWriter(oSW);
              SW.write("Date/Time: " + new Date().toLocaleString());
              SW.write(System.getProperty("line.separator"));
  
              SW.write("IP: " + strIP);
              SW.write(System.getProperty("line.separator"));
  
              SW.write("Log: " + Message);
              SW.write(System.getProperty("line.separator"));
          }
          catch(IOException ex)
          {
  
          }
          finally
          {
              if (SW != null)
              {
                  SW.close();
              }
          }
      }        
  }        
  </code></pre>
  
  <p>It returns the input string, but not saving any text into directory and not even creating the directory text file.</p>
  
  <p>What could be wrong?</p>