Class Say

java.lang.Object
de.galan.commons.logging.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");

You can omit the curly braces in the message by setting the environment-variable SAY_FIELDS_ENCLOSED to "false".
  • Constructor Details

    • Say

      public Say()
  • Method Details