Exemple #1
0
 private static void log(PrintWriter pw, String mensaje) {
   if (pw == null) {
     System.out.println(mensaje);
   } else {
     String cabecera = Utils.convertirFecha(Calendar.getInstance().getTime(), "ddMMyyy HH:mm:ss");
     synchronized (pw) {
       pw.print(cabecera);
       pw.print(" - ");
       pw.println(mensaje);
       pw.flush();
     }
   }
 }
Exemple #2
0
  static {
    synchronized (Log.class) {
      String pathLog = "./logs/";
      String mascara = Utils.convertirFecha(Calendar.getInstance().getTime(), "ddMMyyyy");
      try {
        log = new PrintWriter(new FileWriter(new File(pathLog, mascara + "_SriLanda.log"), true));
        exceptionLog =
            new PrintWriter(
                new FileWriter(new File(pathLog, mascara + "_SriLandaException.log"), true));
        scrapingLog =
            new PrintWriter(new FileWriter(new File(pathLog, mascara + "_Srapring.log"), true));

      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }