Package pt.opensoft.logging

Examples of pt.opensoft.logging.Logger


      for (int i = 0; i < resourcesNames.length; i++) {
        resourceName = resourcesNames[i];
        resourceFullName.append("resource.").append(resourceName).append(".");

        type = parameters.getString(resourceFullName + "type");
        Logger _logger = Logger.getDefault().getWrapper();

        resourceConfigParams.setValue("loggerInstance", _logger);

        Vector properties = parameters.getVector(resourceFullName + "properties");
        for (int j = 0; j < properties.size(); j++) {
View Full Code Here


    String host = null;
    int port = 0;
    String file = null;

    Logger logger = Logger.getDefault();

    try {
      if (args.length == 3) {
        port = Integer.parseInt(args[0]);
        host = args[1];
View Full Code Here

  public void schedule (Daemon daemon) {
    timer = new Timer(true);
    daemonTask = new DaemonTimerTask(daemon);

    Logger logger = daemon.getLogger();
    if (!daemon.canSchedule()) {
      logger.warning("NOT STARTED!");
      return;
    }
    boolean atFixedRate = daemon.hasFixedRate();
    if (daemon.hasStartAt()) {
      DateTime startAt = daemon.getStartAt();
      if (daemon.hasPolling()) {
        DateTime polling = daemon.getPolling();
        if (atFixedRate) {
          logger.info("startAt(" + startAt + ", " + polling + ")");
          timer.scheduleAtFixedRate(daemonTask, startAt, daemon.getPeriod());
        } else {
          logger.info("startAt(" + startAt + ", " + polling + ", constantRate)");
          timer.schedule(daemonTask, startAt, daemon.getPeriod());
        }
        return;
      }
      logger.info("runOnceAt(" + startAt + ")");
      timer.schedule(daemonTask, startAt);
      return;
    }
    if (daemon.hasDelay()) {
      DateTime delay = daemon.getDelay();
      if (daemon.hasPolling()) {
        DateTime polling = daemon.getPolling();
        if (atFixedRate) {
          logger.info("delay(" + delay + ", " + polling + ")");
          timer.scheduleAtFixedRate(daemonTask, daemon.getDelayMillis(), daemon.getPeriod());
        } else {
          logger.info("delay(" + delay + ", " + polling + ", constantRate)");
          timer.schedule(daemonTask, daemon.getDelayMillis(), daemon.getPeriod());
        }
        return;
      }
      logger.info("runOnceOnDelay(" + delay + ")");
      timer.schedule(daemonTask, daemon.getDelayMillis());
      return;
    }
    logger.warning("NOT SCHEDULED!");
    return;
  }
View Full Code Here

    String resourceName = getResourceName();
    long resourceTimeout = parameters.getLongValue("resource." + resourceName + ".resourceTimeout");
    resource = resourceManager.get(resourceName, resourceTimeout);

    Logger resourceLogger = actionWrapper.getLogger().getWrapper();
    resourceLogger.push(resourceName + "|" + resource.getId());

    actionWrapper.getLogger().push(resourceName + "|" + resource.getId());
    mustPop = true;

    afectActionWithResource(resource, resourceLogger, actionWrapper);
View Full Code Here

        boolean removesNewLines = false;
        //Argumentos para o servidor de mensagens remoto
        String proxyHost = null;
        int proxyPort = 0;

        Logger logger = Logger.getDefault();

        try {
            if (args.length == 6) {
                port = Integer.parseInt(args[0]);
                localHost = args[1];
View Full Code Here

        String localHost = null;
        int port = 0;
        File dir = null;
        boolean removesNewLines = false;

        Logger logger = Logger.getDefault();

        try {
            if (args.length == 4) {
                port = Integer.parseInt(args[0]);
                localHost = args[1];
View Full Code Here

    // Obter o entityManager
    entityManager = JPAUtil.getEntityManager(persistenceUnitId);

    // Preparar o log com informa��o do entityManager
    Logger resourceLogger = actionWrapper.getLogger().getWrapper();
    resourceLogger.push(persistenceUnitId);

    actionWrapper.getLogger().push(persistenceUnitId);
    mustPop = true;

    afectActionWithResource(entityManager, resourceLogger, actionWrapper, debug);
View Full Code Here

        this.resourceManager = resourceManager;
    }

    public void beforeActionExecute(HttpRequest request, ActionWrapper actionWrapper) throws ResourceException {

    Logger resourceLogger = actionWrapper.getLogger().getWrapper();

    resourceLogger.debug("REQUEST WS: ");
      resourceLogger.debug(request);
      resourceLogger.debug("REQUEST WS ENDED");

      resourceLogger.fine("Tentando obter acesso ao resource do webservice...");

      resourceTimer.start();

      String resourceName = getResourceName();
    long resourceTimeout = getResourceTimeout();

    resource = resourceManager.get(resourceName, resourceTimeout);

    resourceLogger.push(resourceName + "|" + resource.getId());

    actionWrapper.getLogger().push(resourceName + "|" + resource.getId());

    mustPop = true;
View Full Code Here

  public ResultSet executeQuery () throws SQLException {
    Timer timer = new Timer();
    timer.start();
    ResultSet results = null;
    Exception ex = null;
    Logger logger = _dbc.getLogger();
    logger.push("query");
    try {
      results = ((CallableStatement) _stmt).executeQuery();
    } catch (SQLException e) {
      ex = e;
      throw e;
    } finally {
      boolean tooLong = (_dbc.getThreshold() > 0 && timer.ellapsed() > _dbc.getThreshold());
      if (tooLong) logger.push("too long");
      if (ex != null) {
        logger.error(timer.ellapsed(), getSQLString() + " -> " + ex.getMessage());
      } else if (tooLong) {
        logger.warning(timer.ellapsed(), getSQLString());
      } else {
        logger.debug(timer.ellapsed(), getSQLString());
      }
    }
    return results;
  }
View Full Code Here

    timer.start();
    if(_doQueryTimeout)
    _stmt.setQueryTimeout(_queryTimeout);
    int count = 0;
    Exception ex = null;
    Logger logger = _dbc.getLogger();
    logger.push("update");
    try {
      count = ((CallableStatement) _stmt).executeUpdate();
    } catch (SQLException e) {
      ex = e;
      throw e;
    } finally {
            _dbc.setDbChanged(true);
            logger.push(count + " ROWS");
      boolean tooLong = (_dbc.getThreshold() > 0 && timer.ellapsed() > _dbc.getThreshold());
      if (ex != null) {
        logger.error(timer.ellapsed(), getSQLString() + " -> " + ex.getMessage());
      } else if (tooLong) {
        logger.warning(timer.ellapsed(), getSQLString());
      } else {
        logger.debug(timer.ellapsed(), getSQLString());
      }
    }
    return count;
  }
View Full Code Here

TOP

Related Classes of pt.opensoft.logging.Logger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.