Class Say


  • public class Say
    extends Object
    Facade for the logging-framework (currently Log4j2). Uses the PayloadContextMessage for parameterization of messages. Supports Parameterized messages, using {} as placeholder, eg.:
    info("Hello {}", "world"); // => "Hello {world}"
    info("Hello {} {}", "beautiful", "world"); // => "Hello {beautiful} {world}"
    error("Something failed: {}", ex, "do'h"); // => "Hello {beautiful} {world}"


    If the parameters should be available as json-encoded metadata for eg. logstash, you can provide names to the parameters. Example:
    info("Hello {location}", "world"); // ThreadContext will provide the json in a field called "payload"

    Additionally you can provide fields using a fluent interface using field(..) or f(..):
    Say.field("key", "value").field("other", someObject).info("Hello {location}", "world");