### Question:
LogstashEventFormat implements LoggingEventFormat { public String toString(PaxLoggingEvent event) { JSONObject object = new JSONObject(); try { object.put(MESSAGE, event.getMessage()); object.put(SOURCE, event.getLoggerName()); object.put(TIMESTAMP, TIMESTAMP_FORMAT.format(new Date(event.getTimeStamp()))); JSONObject fields = new JSONObject(); for (Object property : event.getProperties().entrySet()) { Map.Entry<String, Object> entry = (Map.Entry<String, Object>) property; fields.put(entry.getKey(), entry.getValue().toString()); } object.put(FIELDS, fields); JSONArray tags = new JSONArray(); tags.put(event.getLevel().toString()); object.put(TAGS, tags); } catch (JSONException e) { return "{ \"" + MESSAGE + "\" : " + event.getMessage() + "}"; } return object.toString(); }  String toString(PaxLoggingEvent event);  }### Answer:
@Test public void testBasicLogstashFormat() throws JSONException { PaxLoggingEvent event = MockEvents.createInfoEvent(); JSONObject object = new JSONObject(format.toString(event)); assertEquals(MockEvents.LOG_MESSAGE, object.get(LogstashEventFormat.MESSAGE)); assertEquals(MockEvents.LOGGER_NAME, object.get(LogstashEventFormat.SOURCE)); assertEquals("INFO", object.getJSONArray(LogstashEventFormat.TAGS).get(0)); assertEquals(MockEvents.LOG_PROPERTY_VALUE, object.getJSONObject(LogstashEventFormat.FIELDS).get(MockEvents.LOG_PROPERTY_ID)); assertNotNull(object.get(LogstashEventFormat.TIMESTAMP)); System.out.println(object); }