On Feb 21, 2010, at 5:22 PM, Jess Holle wrote: > On 2/20/2010 11:16 AM, Ralph Goers wrote: >>> One thing I'd like to make sure is not lost is an easy way to pass an >>> Object rather than a String. >>> >> I'd prefer a Message instead of an Object. The primary difference is that >> the Message is an interface that looks like: >> > That initially seems reasonable (though I'm not sure about getMessageFormat() > -- if your formatted message is simple tab delimited would this then be a > string containing 'n' tabs?) > > Looking further, though, I'm less certain. For instance, I pass > DynamicMBeans as my message Object in cases. getParameters() could be > expensive here. Instead, my custom appenders are configured with the list of > attributes to obtain in the case of DynamicMBean messages -- so only those > getters are called. getParameters() denies the possibility of such "just > enough" data access.
Message is an interface with only those three methods being required. If you wish to create a Message class that adds support for additional features you would be free to do so. In that case your Appender would just do an instanceof to take advantage of the custom features. However, "regular" appenders would still be able to handle your objects because you would implement those methods appropriately. Ralph
