jboss-logging

MESSAGE_FORMAT with {x.y}


How can I add the string value of the property (from a User-instance) within the message format?

// I want to access a property from the user and put it into the message
@Message(value = "the user: {user.id} - {user.name}", format = Message.Format.MESSAGE_FORMAT)
void test(User user);

How can I do that?


Solution

  • Expressions like that are not currently supported. You'd need to do it manually with something like:

    @Message(value = "the user: {0} - {1}", format = Message.Format.MESSAGE_FORMAT)
    void test(String id, String name);