Example #1
0
 public void close() throws IOException {
   final LogEvent event = new DefaultLogEventMapper().map(message);
   StringWriter w2 = out2;
   if (w2 == null) {
     w2 = (StringWriter) out;
   }
   String ct = (String) message.get(Message.CONTENT_TYPE);
   StringBuilder payload = new StringBuilder();
   try {
     writePayload(payload, w2, ct);
   } catch (Exception ex) {
     // ignore
   }
   event.setPayload(payload.toString());
   sender.send(event);
   message.setContent(Writer.class, out);
   super.close();
 }
Example #2
0
 public void close() throws IOException {
   LoggingMessage buffer = setupBuffer(message);
   if (count >= lim) {
     buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
   }
   StringWriter w2 = out2;
   if (w2 == null) {
     w2 = (StringWriter) out;
   }
   String ct = (String) message.get(Message.CONTENT_TYPE);
   try {
     writePayload(buffer.getPayload(), w2, ct);
   } catch (Exception ex) {
     // ignore
   }
   log(logger, formatLoggingMessage(buffer));
   message.setContent(Writer.class, out);
   super.close();
 }