test_class.declarator: format = new LogstashEventFormat()
test_class.modifier: private final
test_class.original_string: private final LoggingEventFormat format = new LogstashEventFormat();
test_class.type: LoggingEventFormat
test_class.var_name: format
test_class.file: logging/jms-appender/src/test/java/org/apache/servicemix/logging/jms/LogstashEventFormatTest.java
test_class.identifier: LogstashEventFormatTest
test_case.body: @Test
      public void testBasicLogstashFormat() throws JsonException {
          PaxLoggingEvent event = MockEvents.createInfoEvent();
  
          JsonObject object = Json.createReader(new StringReader(format.toString(event))).readObject();
          assertEquals(MockEvents.LOG_MESSAGE, object.getString(LogstashEventFormat.MESSAGE));
          assertEquals(MockEvents.LOGGER_NAME, object.getString(LogstashEventFormat.SOURCE));
          assertEquals("INFO", object.getJsonArray(LogstashEventFormat.TAGS).getString(0));
          assertEquals(MockEvents.LOG_PROPERTY_VALUE,
                       object.getJsonObject(LogstashEventFormat.FIELDS).getString(MockEvents.LOG_PROPERTY_ID));
          assertNotNull(object.get(LogstashEventFormat.TIMESTAMP));
  
          System.out.println(object);
      }
test_case.class_method_signature: LogstashEventFormatTest.testBasicLogstashFormat()
test_case.full_signature: @Test public void testBasicLogstashFormat()
test_case.identifier: testBasicLogstashFormat
test_case.invocations: createInfoEvent readObject createReader toString assertEquals getString assertEquals getString assertEquals getString getJsonArray assertEquals getString getJsonObject assertNotNull get println
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBasicLogstashFormat()
focal_class.declarator: TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
focal_class.modifier: protected static final
focal_class.original_string: protected static final DateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
focal_class.type: DateFormat
focal_class.var_name: TIMESTAMP_FORMAT
focal_class.declarator: FIELDS = "@fields"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String FIELDS = "@fields";
focal_class.type: String
focal_class.var_name: FIELDS
focal_class.declarator: MESSAGE = "@message"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String MESSAGE = "@message";
focal_class.type: String
focal_class.var_name: MESSAGE
focal_class.declarator: SOURCE = "@source"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String SOURCE = "@source";
focal_class.type: String
focal_class.var_name: SOURCE
focal_class.declarator: TAGS = "@tags"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String TAGS = "@tags";
focal_class.type: String
focal_class.var_name: TAGS
focal_class.declarator: TIMESTAMP = "@timestamp"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String TIMESTAMP = "@timestamp";
focal_class.type: String
focal_class.var_name: TIMESTAMP
focal_class.file: logging/jms-appender/src/main/java/org/apache/servicemix/logging/jms/LogstashEventFormat.java
focal_class.identifier: LogstashEventFormat
focal_class.interfaces: implements LoggingEventFormat
focal_class.class_method_signature: LogstashEventFormat.toString(PaxLoggingEvent event)
focal_class.full_signature: public String toString(PaxLoggingEvent event)
focal_class.identifier: toString
focal_class.modifiers: public
focal_class.parameters: (PaxLoggingEvent event)
focal_class.return: String
focal_class.signature: String toString(PaxLoggingEvent event)
focal_method.body: public String toString(PaxLoggingEvent event) {
          JsonObjectBuilder object = Json.createObjectBuilder();
          try {
              object.add(MESSAGE, event.getMessage());
              object.add(SOURCE, event.getLoggerName());
              object.add(TIMESTAMP, TIMESTAMP_FORMAT.format(new Date(event.getTimeStamp())));
  
              JsonObjectBuilder fields = Json.createObjectBuilder();
              for (Object property : event.getProperties().entrySet()) {
                  Map.Entry<String, Object> entry = (Map.Entry<String, Object>) property;
                  fields.add(entry.getKey(), entry.getValue().toString());
              }
  
              object.add(FIELDS, fields);
  
              JsonArrayBuilder tags = Json.createArrayBuilder();
              tags.add(event.getLevel().toString());
              object.add(TAGS, tags);
          } catch (JsonException e) {
              // let's return a minimal, String-based message representation instead
              return "{ \"" + MESSAGE + "\" : " + event.getMessage() + "}";
          }
          return object.build().toString();
      }
focal_method.class_method_signature: LogstashEventFormat.toString(PaxLoggingEvent event)
focal_method.full_signature: public String toString(PaxLoggingEvent event)
focal_method.identifier: toString
focal_method.invocations: createObjectBuilder add getMessage add getLoggerName add format getTimeStamp createObjectBuilder entrySet getProperties add getKey toString getValue add createArrayBuilder add toString getLevel add getMessage toString build
focal_method.modifiers: public
focal_method.parameters: (PaxLoggingEvent event)
focal_method.return: String
focal_method.signature: String toString(PaxLoggingEvent event)