Beispiel #1
0
  /**
   * @param event the event
   * @throws Exception
   */
  public void post(final Event event) throws LogpileException {

    final Map<String, String> map = new HashMap<String, String>();
    map.put(PROP_APPLICATION, encode(event.getApplication()));
    map.put(PROP_COMPONENT, encode(event.getComponent()));
    map.put(PROP_MESSAGE, encode(event.getMessage()));
    map.put(PROP_STACK, encode(event.getStacktrace()));
    map.put(PROP_DATE, encode(event.getDate()));

    if (connector != null) {
      connector.send(getUrl(), HttpConnector.Method.GET, map);
    } else {
      throw new LogpileException("connector null");
    }
  }
Beispiel #2
0
  @Override
  protected void append(final ILoggingEvent eventObject) {

    try {
      final Event event = new Event();
      event.setApplication(application);
      event.setComponent(eventObject.getLoggerName());

      Calendar instance = Calendar.getInstance();
      instance.setTimeInMillis(eventObject.getTimeStamp());
      event.setDate(instance.getTime());
      event.setMessage(eventObject.getMessage());

      event.setStacktrace(createStackTrace(eventObject));

      engine.post(event);
    } catch (Exception e) {
      addStatus(new ErrorStatus("Error in logpile treament.", this, e));
    }
  }