@Override
  public String getMessage() {
    String formatted = message;
    if ( arguments != null ) {
      // get all "tokens" enclosed by curly brackets within the message
      final List<String> tokens = new ArrayList<>();
      StringUtil.getUsedVariables( formatted, "{", "}", tokens, true );
      // perform MessageFormat.format( ... ) on each token, if we get an exception, we'll know that we have a
      // segment that isn't parsable by MessageFormat, likely a pdi variable name (${foo}) - in this case, we need to
      // escape the curly brackets in the message, so that MessageFormat does not complain
      for ( final String token : tokens ) {
        try {
          MessageFormat.format( "{" + token + "}", arguments );
        } catch ( final IllegalArgumentException iar ) {
          formatted = formatted.replaceAll( "\\{" + token + "\\}",  "\\'{'" + token + "\\'}'" );
        }
      }
      // now that we have escaped curly brackets in all invalid tokens, we can attempt to format the entire message
      formatted = MessageFormat.format( formatted, arguments );
    }
    return formatted;
  }
@Test
  public void testGetMessage() {
    LogMessage msg = new LogMessage( "m {0}, {1}, {2}, {3}, {4,number,#.00}, {5} {foe}", "Channel 01",
      new Object[] { "Foo", "{abc}", "", null, 123 }, LogLevel.DEBUG );
    assertEquals( "m Foo, {abc}, , null, 123.00, {5} {foe}", msg.getMessage() );
  }