protected static void setupSidlogger(Level lvl) {
    if (!Level.OFF.equals(lvl)) {
      Filter bslf = new BoshSidLoggerFilter();

      Logger BoshConnectionManagerLogger = Logger.getLogger(BoshConnectionManager.class.getName());
      Logger BoshSessionLogger = Logger.getLogger(BoshSession.class.getName());

      if (BoshConnectionManagerLogger.getLevel() == null
          || BoshSessionLogger.getLevel() == null
          || BoshConnectionManagerLogger.getLevel().intValue() < lvl.intValue()) {
        BoshConnectionManagerLogger.setLevel(lvl);
        BoshConnectionManagerLogger.setFilter(bslf);
        BoshSessionLogger.setLevel(lvl);
        BoshSessionLogger.setFilter(bslf);

        BoshConnectionManagerLogger.getParent().setFilter(bslf);
      }

      try {
        if (null == sidFilehandler) {
          sidFilehandler = new FileHandler("logs/bosh_sid.log", 10000000, 5, false);
          sidFilehandler.setLevel(lvl);
          sidFilehandler.setFilter(bslf);
          BoshConnectionManagerLogger.getParent().addHandler(sidFilehandler);
        }
      } catch (IOException ex) {
        log.log(Level.CONFIG, "Error creating BOSH SID logger" + ex);
      }
    }
  }
 @BeforeClass
 public static void before() {
   originalLogLevel = INSTANCE_CONFIG_LOGGER.getLevel();
   publisherOriginalLogLevel = CALLABLE_PUBLISHER_LOGGER.getLevel();
   INSTANCE_CONFIG_LOGGER.setLevel(Level.OFF);
   CALLABLE_PUBLISHER_LOGGER.setLevel(Level.OFF);
 }
  /** Construct a new BasicWMSRenderer */
  public BasicWMSRenderer2() {
    ClassLoader current = Thread.currentThread().getContextClassLoader();
    try {
      Thread.currentThread().setContextClassLoader(WebMapServer.class.getClassLoader());
      Logger logger = Logger.getLogger("org.geotools.data.ows"); // $NON-NLS-1$
      if (WMSPlugin.isDebugging(Trace.RENDER)) {
        logger.setLevel(Level.FINE);
        logger.addHandler(
            new Handler() {

              @Override
              public void publish(LogRecord record) {
                System.err.println(record.getMessage());
              }

              @Override
              public void flush() {
                System.err.flush();
              }

              @Override
              public void close() throws SecurityException {}
            });
      } else {
        logger.setLevel(Level.SEVERE);
      }
    } finally {
      Thread.currentThread().setContextClassLoader(current);
    }
  }
Exemplo n.º 4
0
  /** @param args */
  public static void main(String[] args) {
    //		 Logger logger = Logger.getLogger(MyJdkLog.class.toString());
    Logger logger = Logger.getLogger("");
    logger.setLevel(Level.FINE);
    Logger sublogger = Logger.getLogger("a.b.c");
    sublogger.setLevel(Level.FINEST);
    sublogger.log(Level.FINE, "sfsdf");
    // System.out.println("(MyLog32.java:11) 2011-09-03 14:31:26,873 [DEBUG] This is a 'DEBUG' test
    // message");
    Handler[] handlers = logger.getHandlers();
    System.out.println("handlers size :" + handlers.length);

    for (int i = 0; i < handlers.length; i++) {
      System.out.println(handlers[i].getClass());
      System.out.println(handlers[i].getFormatter().getClass());
    }
    handlers[0].setFormatter(new MyFormatter());
    // logger.info("MyJdkLog.............");
    // logger.log(Level.WARNING, "fsodjfoaf....");
    MyLoggerUtil.printDebug("com.logger.test.MyJdkLog", "11111message");

    // StackTraceElement[] stackTraceElements= throwable.getStackTrace();
    // System.out.println("size :"+stackTraceElements.length);
    // stackTraceElements[0].getLineNumber();
    // String str = "" + "(" + stackTraceElements[0].getFileName()+":" +
    // stackTraceElements[0].getLineNumber()+")";
    // System.out.println(str);

  }
Exemplo n.º 5
0
  void initLogger() {
    final boolean VERBOSE_LOGGING = true;
    final int LOG_SIZE = 512 * 1024; // max log file size (in bytes)

    Logger globalLogger = Logger.getLogger("");
    // Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); // doesn't work on os x
    if (VERBOSE_LOGGING) {
      globalLogger.setLevel(Level.INFO);
    } else {
      globalLogger.setLevel(Level.WARNING);
    }

    // enable logging to file
    try {
      // settings is writable for built-in modes, mode folder is not writable
      File logFolder = Base.getSettingsFile("debug");
      if (!logFolder.exists()) {
        logFolder.mkdir();
      }
      File logFile = new File(logFolder, "DebugMode.%g.log");
      Handler handler = new FileHandler(logFile.getAbsolutePath(), LOG_SIZE, 10, false);
      globalLogger.addHandler(handler);

    } catch (IOException ex) {
      Logger.getLogger(JavaMode.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
      Logger.getLogger(JavaMode.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Exemplo n.º 6
0
  /**
   * Resets the logging configuration by removing all handlers for
   * registered named loggers and setting their level to <code>null</code>.
   * The level of the root logger will be set to <code>Level.INFO</code>.
   *
   * @throws SecurityException if a security manager exists and
   *         the caller is not granted the permission to control
   *         the logging infrastructure.
   */
  public synchronized void reset()
    throws SecurityException
  {
    /* Throw a SecurityException if the caller does not have the
     * permission to control the logging infrastructure.
     */
    checkAccess();

    properties = new Properties();

    Iterator iter = loggers.values().iterator();
    while (iter.hasNext())
    {
      WeakReference  ref;
      Logger         logger;

      ref = (WeakReference) iter.next();
      if (ref != null)
      {
	logger = (Logger) ref.get();

	if (logger == null)
	  iter.remove();
	else if (logger != rootLogger)
	  logger.setLevel(null);
      }
    }

    rootLogger.setLevel(Level.INFO);
  }
Exemplo n.º 7
0
  public static synchronized void createLoggers(boolean reinit) {

    if (m_initialized == true && reinit == false) {
      return;
    }

    if (!m_initialized) {
      Logger.getLogger("").removeHandler(Logger.getLogger("").getHandlers()[0]);
    }

    if (m_initialized) {
      m_severeLogger.removeHandler(m_severeLogger.getHandlers()[0]);
      m_nonSevereLogger.removeHandler(m_nonSevereLogger.getHandlers()[0]);
    }

    Handler severeHandler = new AMyConsoleHandler(System.err);
    severeHandler.setFormatter(new SingleLineFormatter());
    m_severeLogger.addHandler(severeHandler);
    m_severeLogger.setLevel(getLoggingLevel());

    Handler nonSevereHandler = new AMyConsoleHandler(System.out);
    nonSevereHandler.setFormatter(new SingleLineFormatter());
    m_nonSevereLogger.addHandler(nonSevereHandler);
    m_nonSevereLogger.setLevel(getLoggingLevel());

    m_initialized = true;
  }
Exemplo n.º 8
0
  public static synchronized void setLoggingLevel(String loggingLevel) {

    if (loggingLevel.toLowerCase().equals("severe")) {
      m_loggingLevel = Level.SEVERE;
    } else if (loggingLevel.toLowerCase().equals("warning")) {
      m_loggingLevel = Level.WARNING;
    } else if (loggingLevel.toLowerCase().equals("info")) {
      m_loggingLevel = Level.INFO;
    } else if (loggingLevel.toLowerCase().equals("config")) {
      m_loggingLevel = Level.CONFIG;
    } else if (loggingLevel.toLowerCase().equals("fine")) {
      m_loggingLevel = Level.FINE;
    } else if (loggingLevel.toLowerCase().equals("finer")) {
      m_loggingLevel = Level.FINER;
    } else if (loggingLevel.toLowerCase().equals("finest")) {
      m_loggingLevel = Level.FINEST;
    } else {
      m_loggingLevel = Level.WARNING;
    }

    if (m_initialized) {
      m_severeLogger.setLevel(m_loggingLevel);
      m_nonSevereLogger.setLevel(m_loggingLevel);
    }
  }
  /**
   * Private constructor
   *
   * @throws SimulatorException
   */
  private SimulatorLogger() throws SimulatorException {
    try {
      config = SimulatorConfig.getInstance();
      logger = Logger.getLogger("it.univaq.mancoosi.simulator");

      if (config.isConsoleLog() || config.isSaveFileLog()) {

        if (config.isConsoleLog()) {
          logger.setUseParentHandlers(false);
          Handler ch = new MyHandler();
          logger.addHandler(ch);
        }

        if (config.isSaveFileLog()) {
          fh = new FileHandler(config.getDirLog() + "log_" + getTime() + ".txt");

          fh.setFormatter(new SimpleFormatter());
          logger.addHandler(fh);
        }

        logger.setLevel(Level.ALL);

      } else {
        logger.setLevel(Level.OFF);
      }

    } catch (SecurityException e) {
      throw new SimulatorException("Error logger security ", e);
    } catch (IOException e) {
      throw new SimulatorException("IO error in logger", e);
    }
  }
Exemplo n.º 10
0
 public void saveDefaultConfig(boolean force) {
   Level ll = log.getLevel();
   log.setLevel(Level.SEVERE);
   try {
     saveResource("General.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("Advanced.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("ModModifications.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("DisableClick.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("DisableItems.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("HackDupe.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("LimitedCreative.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("Logging.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("TPerformance.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("GroupPermissions.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("SafeZones.config.yml", force);
   } catch (Exception e) {
   }
   try {
     saveResource("Database.config.yml", force);
   } catch (Exception e) {
   }
   try {
     if (linkEEPatch()) {
       saveResource("EEPatch.config.yml", force);
     }
   } catch (Exception e) {
   }
   log.setLevel(ll);
 }
Exemplo n.º 11
0
  public static void setVerbose(boolean verbose) {

    if (verbose) {
      logger.setLevel(Level.ALL);

      logger.info(printParams());

    } else {
      logger.setLevel(Level.WARNING);
    }
  }
Exemplo n.º 12
0
  @Before
  public void setUp() throws FileNotFoundException, IOException {
    outStream = new FileOutputStream(basedir + "/target/run-junit-embed.log", true);
    Handler handler = new StreamHandler(outStream, new SimpleFormatter());
    logger0.addHandler(handler);
    logger0.setUseParentHandlers(false);
    logger0.setLevel(Level.INFO);
    logger1.setUseParentHandlers(false);
    logger1.addHandler(new ConsoleHandler());
    logger1.setLevel(Level.WARNING);

    writer = new FileWriter(basedir + "/target/run-junit-embed.txt", true);
  }
Exemplo n.º 13
0
  @Before
  public void setUp() throws FileNotFoundException {
    System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");

    outStream = new FileOutputStream(basedir + "/build/test-results/run-junit-embed.log", true);
    Handler handler = new StreamHandler(outStream, new SimpleFormatter());
    logger0.addHandler(handler);
    logger0.setUseParentHandlers(false);
    logger0.setLevel(Level.INFO);
    logger1.setUseParentHandlers(false);
    logger1.addHandler(new ConsoleHandler());
    logger1.setLevel(Level.WARNING);
  }
  private ApplicationSession() {
    /* Definir US comme locale par défaut */
    Locale.setDefault(new Locale("US"));

    locale = Locale.getDefault();
    resourceBundle = ResourceBundle.getBundle("edu/iut/resources/strings/res", locale);
    /* Initialiser le logger */
    sessionGuiLogger = Logger.getLogger("GuiLogger");
    /* Touls les message doivent être affiché */
    sessionGuiLogger.setLevel(Level.ALL); // pour le ALL c'est obligatoire de mettre max
    /* Logger pour exception */
    sessionExceptionLogger = Logger.getLogger("Exception");
    /* Touls les message doivent être affiché */
    sessionExceptionLogger.setLevel(Level.ALL);
  }
  /*
   * (non-Javadoc)
   *
   * @see net.sf.borg.ui.options.OptionsView.OptionsPanel#applyChanges()
   */
  @Override
  public void applyChanges() {

    if (verboseLogging.isSelected()) log.setLevel(Level.ALL);
    else log.setLevel(Level.INFO);

    OptionsPanel.setBooleanPref(colorprint, PrefName.COLORPRINT);

    OptionsPanel.setBooleanPref(splashbox, PrefName.SPLASH);
    OptionsPanel.setBooleanPref(stackbox, PrefName.STACKTRACE);

    OptionsPanel.setBooleanPref(useSysTray, PrefName.USESYSTRAY);
    OptionsPanel.setBooleanPref(startToSysTray, PrefName.BACKGSTART);
    OptionsPanel.setBooleanPref(dateInSysTray, PrefName.SYSTRAYDATE);
    OptionsPanel.setBooleanPref(dynamicLoading, PrefName.DYNAMIC_LOADING);
    OptionsPanel.setBooleanPref(verboseLogging, PrefName.DEBUG);
    OptionsPanel.setBooleanPref(useProxy, PrefName.USE_PROXY);

    Prefs.putPref(PrefName.BACKUPDIR, backupDir.getText());

    if (shutdownAction.getSelectedIndex() == 0)
      Prefs.putPref(PrefName.SHUTDOWN_ACTION, SHUTDOWN_ACTION.PROMPT.toString());
    else if (shutdownAction.getSelectedIndex() == 1)
      Prefs.putPref(PrefName.SHUTDOWN_ACTION, SHUTDOWN_ACTION.NONE.toString());
    else if (shutdownAction.getSelectedIndex() == 2)
      Prefs.putPref(PrefName.SHUTDOWN_ACTION, SHUTDOWN_ACTION.BACKUP.toString());
    else if (shutdownAction.getSelectedIndex() == 3)
      Prefs.putPref(PrefName.SHUTDOWN_ACTION, SHUTDOWN_ACTION.EMAIL.toString());

    // validate that socket is a number
    try {
      int socket = Integer.parseInt(socketPort.getText());
      Prefs.putPref(PrefName.SOCKETPORT, new Integer(socket));
    } catch (NumberFormatException e) {
      Errmsg.getErrorHandler().notice(Resource.getResourceString("socket_warn"));
      socketPort.setText("-1");
      Prefs.putPref(PrefName.SOCKETPORT, new Integer(-1));
    }

    Prefs.putPref(PrefName.PROXY_HOST, proxyHostText.getText());

    try {
      int port = Integer.parseInt(proxyPortText.getText());
      Prefs.putPref(PrefName.PROXY_PORT, new Integer(port));
    } catch (NumberFormatException e) {
      Errmsg.getErrorHandler().notice(Resource.getResourceString("proxy_warn"));
    }
  }
Exemplo n.º 16
0
  public static void init() {
    try {
      DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
      Calendar cal = Calendar.getInstance();
      String fileName = "log " + dateFormat.format(cal.getTime()) + ".txt";

      File f = new File("logs");
      if (!f.exists()) f.mkdir();

      fh = new FileHandler("logs/" + fileName);

      logger = Logger.getLogger("MyLog");
      logger.addHandler(fh);
      SimpleFormatter formatter = new SimpleFormatter();
      fh.setFormatter(formatter);

      // Comment next line to make logger put into file everything from level INFO
      // Now it will log only errors (severe)
      logger.setLevel(Level.WARNING);

    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 17
0
  public void handleInit(QuickServer quickserver) throws Exception {
    Logger logger = null;
    FileHandler xmlLog = null;
    File log = new File("./log/");
    if (!log.canRead()) log.mkdir();
    try {
      logger = Logger.getLogger("");
      logger.setLevel(Level.FINEST);

      logger = Logger.getLogger("org.quickserver.net.qsadmin");
      xmlLog = new FileHandler("log/FtpServer_QSAdmin%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("org.quickserver");
      xmlLog = new FileHandler("log/FtpServer_QuickServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("ftpserver");
      xmlLog = new FileHandler("log/FtpServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      quickserver.setAppLogger(logger); // img
    } catch (IOException e) {
      System.err.println("Could not create txtLog FileHandler : " + e);
      throw e;
    }
  }
Exemplo n.º 18
0
  public ChemWizard() {
    smrkMan = new SMIRKSManager(SilentChemObjectBuilder.getInstance());
    smrkMan.setFlagProcessResultStructures(true);
    smrkMan.setFlagAddImplicitHAtomsOnResultProcess(true);

    LOGGER.setLevel(Level.FINEST);
  }
Exemplo n.º 19
0
  @Override
  public SctpChannel accept()
      throws IOException, SctpException, InvalidKeyException, NoSuchAlgorithmException {
    logger.setLevel(Level.INFO);

    DatagramPacket receivePacket = new DatagramPacket(buffer, buffer.length);
    SctpPacket packet = null;
    while (true) {
      serverSocket.receive(receivePacket);
      try {
        packet = new SctpPacket(buffer, 0, receivePacket.getLength());
      } catch (SctpException e) {
        logger.log(Level.WARNING, e.getMessage());
        continue;
      }

      logger.log(Level.INFO, "receive new packet");

      InetSocketAddress address =
          new InetSocketAddress(receivePacket.getAddress(), receivePacket.getPort());
      packet.apply(address, this);

      Association association = pendingAssociations.get(address);
      if (association != null && association.getState() == State.ESTABLISHED) {
        return new SctpChannel(association);
      }
    }
  }
Exemplo n.º 20
0
  {
    String levelName = Base.preferences.get("replicatorg.debuglevel", Level.INFO.getName());
    Level l = Level.parse(levelName);
    logger.setLevel(l);

    /*
     * 	TODO: Add log-to-file option to preferences.
    		// Add logfile handler
    	    try {
    	      boolean append = true;
    	      FileHandler fh = new FileHandler("RepG.log", append);
    	      //fh.setFormatter(new XMLFormatter());
    	      fh.setFormatter(new SimpleFormatter());
    	      logger.addHandler(fh);
    	    }
    	    catch (IOException e) {
    	      e.printStackTrace();
    	    }

    		// Configure handlers to use selected level
    	    Handler[] handlers =
    	    logger.getHandlers();
    	    for ( int index = 0; index < handlers.length; index++ ) {
    	    	handlers[index].setLevel( l );
    	    }
    */
  }
Exemplo n.º 21
0
 /** Un-register {@link Handler log handler} from the list of root loggers. */
 private void unregisterLogHandler() {
   for (final Logger root : getRootLoggers()) {
     root.setLevel(logLevelMap.get(root));
     root.removeHandler(getLogHandler());
   }
   logHandler = null;
 }
Exemplo n.º 22
0
  /** Sets the level and the handler of the root-logger. */
  private void configLogger() {
    Logger rootLogger = Logger.getLogger("");
    rootLogger.setLevel(Level.FINE);
    rootLogger.addHandler(LogHandler.get());

    GWT.setUncaughtExceptionHandler(this);
  }
Exemplo n.º 23
0
  /**
   * @param args
   * @throws Exception
   */
  public static void main(String args[]) throws Exception {

    log.setLevel(Level.INFO);

    Configuration v_HadoopConf = new Configuration();
    s_HadoopConf = v_HadoopConf;
    s_Config = Config.getInstance();
    String v_PathPrefix = s_Config.getBaseDir() + s_Config.getDataDir() + "mahout/";
    String v_TextDir = s_Config.getTextPath();

    Path m_DocumentDir = new Path(v_TextDir);
    Path m_SequenceDir = new Path(v_PathPrefix, "sequence/");
    Path m_TokensDir = new Path(v_PathPrefix, "tokens");
    Path m_TF = new Path(v_PathPrefix, "termfreq/");
    String m_VecFolder = "Vectors";
    Path m_tf_idf = new Path(v_PathPrefix, "tfidf/");

    boolean m_Sequential = true;

    HadoopUtil.delete(v_HadoopConf, new Path(v_PathPrefix, "clusters/"));

    if (!s_Config.getReuseTFIDF()) {
      createTFIDF(
          v_HadoopConf, m_DocumentDir, m_SequenceDir, m_TokensDir, m_TF, m_VecFolder, m_tf_idf);
    }

    HierarchicalKMeansClusterer v_Hkmc = new HierarchicalKMeansClusterer();
    SetTree<ClusterDescriptor> v_Tree = v_Hkmc.run(s_HadoopConf, m_Sequential);

    saveAsTree(v_Tree);

    saveAsXml(v_Tree);
  }
  /** Aktiviert das Logging zum Level FINEST. */
  private static void activateFinestLogging() {
    Handler[] handlers;
    ConsoleHandler consoleHandler;
    Logger rootLogger, archiLogger;

    rootLogger = Logger.getLogger("");
    archiLogger = Logger.getLogger("de.unistuttgart.architeuthis");

    // log-Level für alle Logger von Architeuthis setzen
    archiLogger.setLevel(Level.FINEST);

    // der DefaultHandler hängt am root-Logger
    handlers = rootLogger.getHandlers();

    // einen ConsoleHandler finden:
    consoleHandler = null;
    for (int i = 0; i < handlers.length; i++) {
      if (handlers[i] instanceof ConsoleHandler) {
        consoleHandler = (ConsoleHandler) handlers[i];
      }
    }

    // Wenn kein ConsoleHandler am root-Logger vorhanden ist, einen
    // anhängen.
    if (consoleHandler == null) {
      consoleHandler = new java.util.logging.ConsoleHandler();
      Logger.getLogger("").addHandler(consoleHandler);
    }

    consoleHandler.setLevel(Level.FINEST);
  }
Exemplo n.º 25
0
  // retorna true cuando el usuario si ha particiado en la cc.
  private boolean esParticipanteCC(Formulario formulario, Usuario usuario) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "obtenerParticipantesCC");
    if (usuario.equals(formulario.getUsuarioidUsuario1())) {
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }
    List<Traslado> traslados = trasladoFacade.findByNue(formulario);

    if (traslados
        .get(0)
        .getUsuarioidUsuario()
        .equals(usuario)) { // valida 1er traslado, útil para digitador.
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }

    for (int i = 0; i < traslados.size(); i++) {
      if (traslados.get(i).getUsuarioidUsuario1().equals(usuario)) {
        logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
        return true;
      }
    }
    logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", false);
    return false;
  }
Exemplo n.º 26
0
  // se crea una nueva edicion para el formulario indicado.
  @Override
  public String edicionFormulario(Formulario formulario, String obsEdicion, Usuario usuarioSesion) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "edicionFormulario");
    if (obsEdicion == null) {
      logger.exiting(this.getClass().getName(), "edicionFormulario", "falta observación.");
      return "Se requiere la observación.";
    }

    // verificando que el usuario que edita si haya participado en la cc.
    if (!esParticipanteCC(formulario, usuarioSesion)) {
      logger.exiting(
          this.getClass().getName(), "edicionFormulario", "usuario no ha participado en cc");
      return "Ud no ha participado en esta cadena de custodia.";
    }

    // Creando el objeto edicion
    EdicionFormulario edF = new EdicionFormulario();

    edF.setFormularioNUE(formulario);
    edF.setUsuarioidUsuario(usuarioSesion);
    edF.setObservaciones(obsEdicion);
    edF.setFechaEdicion(new Date(System.currentTimeMillis()));

    // Actualizando ultima edicion formulario
    formulario.setUltimaEdicion(edF.getFechaEdicion());

    edicionFormularioFacade.edit(edF);
    formularioFacade.edit(formulario);

    logger.exiting(this.getClass().getName(), "edicionFormulario", "Exito");
    return "Exito";
  }
Exemplo n.º 27
0
  private Usuario crearExterno(Usuario usuario, String cargo) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "crearExterno");

    if (usuario != null) {
      Usuario nuevoExterno = usuario;
      Area areaExterno = areaFacade.findByArea("Otro");
      TipoUsuario tue = tipoUsuarioFacade.findByTipo("Externo");
      Cargo cargoExterno = cargoFacade.findByCargo(cargo);
      if (cargoExterno == null) {
        Cargo nuevo = new Cargo();
        nuevo.setNombreCargo(cargo);
        cargoFacade.create(nuevo);
        cargoExterno = cargoFacade.findByCargo(cargo);
      }

      nuevoExterno.setAreaidArea(areaExterno);
      nuevoExterno.setCargoidCargo(cargoExterno);
      nuevoExterno.setTipoUsuarioidTipoUsuario(tue);
      nuevoExterno.setEstadoUsuario(Boolean.TRUE);
      nuevoExterno.setMailUsuario("na");
      nuevoExterno.setPassUsuario("na");
      logger.finest("se inicia la persistencia del nuevo usuario externo");
      usuarioFacade.create(nuevoExterno);
      logger.finest("se finaliza la persistencia del nuevo usuario externo");

      nuevoExterno = usuarioFacade.findByRUN(usuario.getRutUsuario());
      if (nuevoExterno != null) {
        logger.exiting(this.getClass().getName(), "crearExterno", nuevoExterno.toString());
        return nuevoExterno;
      }
    }
    logger.exiting(this.getClass().getName(), "crearExterno", null);
    return null;
  }
  public void preprocess(Run run) {
    File logFile = new File(getRunDir(run), "genetik.log");

    try {
      SimpleFileHandler fh = new SimpleFileHandler(logFile);
      fh.setFormatter(new CompactFormatter());

      Logger logger = Logger.getLogger(GenetikConstants.LOGGER);
      logger.setLevel(Level.INFO);
      logger.setUseParentHandlers(false);
      Handler handlers[] = logger.getHandlers();

      logger.addHandler(fh);

      for (Handler h : handlers) {
        logger.removeHandler(h);

        if (h instanceof SimpleFileHandler) h.close(); // close our old one
      }
    } catch (Exception exp) {
      throw new IllegalArgumentException(
          "Unable to create log file at " + logFile.getAbsolutePath());
    }

    super.preprocess(run);
  }
 public Logger getLogger() {
   if (logger == null) {
     logger = Logger.getLogger(this.getClass().getCanonicalName());
   }
   logger.setLevel(Level.FINE);
   return logger;
 }
 @BeforeClass
 public static void setUp() {
   Logger logger = NanoBench.getLogger();
   logger.setUseParentHandlers(false);
   logger.setLevel(Level.INFO);
   logger.addHandler(new ConsoleHandler());
 }