Package org.apache.log4j

Examples of org.apache.log4j.Category$PrivateFactory


     * @see BuildListener#taskFinished
     */
    public void taskFinished(BuildEvent event) {
        if (initialized) {
            Task task = event.getTask();
            Category cat = Category.getInstance(task.getClass().getName());
            if (event.getException() == null) {
                cat.info("Task \"" + task.getTaskName() + "\" finished.");
            } else {
                cat.error("Task \"" + task.getTaskName()
                    + "\" finished with error.", event.getException());
            }
        }
    }
View Full Code Here


                if (categoryObject == null) {
                    categoryObject = event.getProject();
                }
            }

            Category cat
                = Category.getInstance(categoryObject.getClass().getName());
            switch (event.getPriority()) {
                case Project.MSG_ERR:
                    cat.error(event.getMessage());
                    break;
                case Project.MSG_WARN:
                    cat.warn(event.getMessage());
                    break;
                case Project.MSG_INFO:
                    cat.info(event.getMessage());
                    break;
                case Project.MSG_VERBOSE:
                    cat.debug(event.getMessage());
                    break;
                case Project.MSG_DEBUG:
                    cat.debug(event.getMessage());
                    break;
                default:
                    cat.error(event.getMessage());
                    break;
            }
        }
    }
View Full Code Here

   *
   */
  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    final Category log = Category.getInstance(ResponderMsgAction.class
        .getName());
    DynaActionForm _form = (DynaActionForm) form;
    ActionMessages errorMsgs = new ActionMessages();

    // Recupera parámetros da requisição
    String lsTitulo = _form.getString("txtTitulo");
    String lsResp = _form.getString("txtResposta");
    String lidAcion = _form.getString("idAcionamento");
    String lsAcao = _form.getString("txtAcao");
    String lidRemetenteRedirec = _form.getString("idRemetenteRedirec");
    String stSolucao = _form.getString("idSolucao");
       
        Long idSolucao=null;
       
        if (stSolucao!=null && !stSolucao.trim().equals("")){
          idSolucao=(new Long(stSolucao));
        }

    // Responde ao acionamento
    try {

      AcionamentoCtrl ctrlAcion = new AcionamentoCtrl(getDaoFactory());

      // Recupera o acionamento a partir do id
      Acionamento acionamento = ctrlAcion.get(new Long(lidAcion));

      if (acionamento == null) {
        errorMsgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
            "error.mensagem.notFound"));

        saveMessages(request, errorMsgs);
      } else if (lidRemetenteRedirec != null
          && !lidRemetenteRedirec.equals("")) {

        // retorna ao ouvidor que redirecionou a msg ao especialista
        // consultor
        RedirecionarMensagemCtrl redirecionarMensagemCtrl = new RedirecionarMensagemCtrl(
            getDaoFactory());
        Funcionario ouvidor = null;

        ouvidor = redirecionarMensagemCtrl.obterOuvidor(new Long(lidRemetenteRedirec));
       
        if (ouvidor != null) {
          acionamento.setFuncionario(ouvidor);
        }

        Timestamp hoje = new Timestamp(System.currentTimeMillis());
        // Finaliza resposta ao acionamento
        acionamento.finalizarRespostaConsultor(lsTitulo, lsResp, hoje, idSolucao);
        redirecionarMensagemCtrl.salvarAcionamento(acionamento);
        ctrlAcion.save(acionamento);
        // Repassa os parámetros para a tela de mensagem de sucesso
        request.setAttribute("idAcionamento", lidAcion);
        request.setAttribute("txtAcao", lsAcao);

      } else {
        Timestamp hoje = new Timestamp(System.currentTimeMillis());

        // Finaliza resposta ao acionamento
        acionamento
            .finalizarRespostaAcionamento(lsTitulo, lsResp, hoje, idSolucao);

        // acionamento.setEstadoAcionamento(EstadoAcionamento.RESPONDIDO);
        ctrlAcion.save(acionamento);

        // Verifica se a opção de recebimento da resposta for email.
        if (acionamento.getAcionador().getMeioEnvioRespostaOrgao()
            .getMeioEnvioResposta().getId().longValue() == MeioEnvioResposta.EMAIL
            .getId().longValue()) {

          EnviarEmailCtrl envioEmail = new EnviarEmailCtrl(
              getDaoFactory());
          Orgao orgao = getOrgao(request);

          String lsEnderecoUrl = "";

          try {

            int tamanho = request.getRequestURL().length();

            lsEnderecoUrl = request.getRequestURL().substring(0,
                (tamanho - 32));

            log.info("endereco: " + lsEnderecoUrl);

            String enc = Utilitario.encrypt(Constants.DES_KEY,
                orgao.getId().toString());
           
            Integer numProtocolo = acionamento.getNumeroProtocolo();
           
            String codigoAcesso = "";
           
            if (this.getOrgao(request).getConfiguracoes().getPossuiCodigoAcesso()
                .booleanValue()) {
              codigoAcesso = acionamento.getAcionador().getInformacoesConsultaAcionamento().getCodigoAcesso();
              codigoAcesso = "&codigoAcesso="+codigoAcesso+"&osessionid=".concat(enc);
            }
            lsEnderecoUrl=lsEnderecoUrl+"andamento/ExibirResposta.do?action=consultar&numeroProtocolo="+numProtocolo;
            lsEnderecoUrl=lsEnderecoUrl+codigoAcesso;
            lsEnderecoUrl=lsEnderecoUrl+"&osessionid=".concat(enc);

            log.info("endereco: " + lsEnderecoUrl);

          } catch (Exception e) {

            log.info("ERRO:::" + e.getMessage());
            log.info("ERRO:::" + e.getCause());
            log.info("ERRO:::" + e.getStackTrace());
            return (mapping.findForward("failure"));
          }

          boolean emailOK = envioEmail.enviarEmail(acionamento,
              orgao, lsEnderecoUrl);
View Full Code Here

  }
 
  @Override
  protected void append(LoggingEvent event) {
   
    Category logger = event.getLogger();
   
    // We synchronize on the logger, since our cache is per-logger
    synchronized (logger) {
     
      final String loggerName = logger.getName();
     
      // Append the event to the cachedEvents for this logger
      List<LoggingEvent> existingEvents = cachedEvents.get(loggerName);
      if (existingEvents == null) {
        // Has to be a synchronizedList because we'll traverse and update it in another thread (the
View Full Code Here

  private LoggingEvent consolidatedEvent(List<LoggingEvent> existingEvents, Layout layout) {
   
    Level highestLevel = null;
    StringBuilder consolidatedMessage = new StringBuilder();
    String consolidatedFqnOfCategoryClass = null;
    Category consolidatedLogger = null;
   
    String linesep = System.getProperty("line.separator");
    if ((existingEvents != null) && (!existingEvents.isEmpty())) {
     
      LoggingEvent firstEvent = existingEvents.get(0);
View Full Code Here

      }
      long ts = cal.getTimeInMillis();
      // If this event is not between the start and end dates, then skip it.
      if (null != dateFilter && !dateFilter.containsLong(ts))
        return null;
      Category c = Logger.getLogger(clazz);
      Level l = Level.toLevel(level);
      LoggingEvent event = new LoggingEvent(clazz, c, ts, l, message, threadName, (ThrowableInformation) null, (String) null, (LocationInfo) null,
          (Map<?,?>) null);
      // Check the log level filter
      if (null != levelFilter && (levelFilter.decide(event) == Filter.DENY)) {
View Full Code Here

         Thread.sleep(50);
         new Thread(new Runnable()
         {
            public void run()
            {
               Category log = Category.getInstance(getClass().getName());

               try
               {
                 
                  for (int j = 0; j < iterationCount; j++)
                  {
                     if (exc != null) break;
                    
                     teller.transfer(from,to,50);
                     teller.transfer(from,to,-50);
//                     Thread.currentThread().yield();
//                     logdebug(idx++);
                  }
               } catch (Exception e)
               {
                  exc = e;
               }
              
               synchronized(lock)
               {
                  iter--;
                  log.info("Only "+iter+" left");
                  lock.notifyAll();
               }
            }
         }).start();
      }
View Full Code Here

      TopicSubscriber topicSubscriber =
           topicSession.createDurableSubscriber(topic, "x");

     
      LoggingEvent event;
      Category remoteCategory;   

      while(true) {
  ObjectMessage msg = (ObjectMessage)topicSubscriber.receive();     
  event = (LoggingEvent) msg.getObject();
  remoteCategory = Category.getInstance(event.categoryName);
  remoteCategory.callAppenders(event)
 
  // dump the JMSMessage
  // remoteCategory.debug(msg);

      }
View Full Code Here

      }
      long ts = cal.getTimeInMillis();
      // If this event is not between the start and end dates, then skip it.
      if (null != dateFilter && !dateFilter.containsLong(ts))
        return null;
      Category c = Logger.getLogger(clazz);
      Level l = Level.toLevel(level);
      LoggingEvent event = new LoggingEvent(clazz, c, ts, l, message, threadName, (ThrowableInformation) null, (String) null, (LocationInfo) null,
          (Map<?,?>) null);
      // Check the log level filter
      if (null != levelFilter && (levelFilter.decide(event) == Filter.DENY)) {
View Full Code Here

      }
      long ts = cal.getTimeInMillis();
      // If this event is not between the start and end dates, then skip it.
      if (null != dateFilter && !dateFilter.containsLong(ts))
        return null;
      Category c = Logger.getLogger(clazz);
      Level l = Level.toLevel(level);
      LoggingEvent event = new LoggingEvent(clazz, c, ts, l, message, threadName, (ThrowableInformation) null, (String) null, (LocationInfo) null,
          (Map<?,?>) null);
      // Check the log level filter
      if (null != levelFilter && (levelFilter.decide(event) == Filter.DENY)) {
View Full Code Here

TOP

Related Classes of org.apache.log4j.Category$PrivateFactory

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.