Re: Can one class log to different files depending on context?

2017-04-05 Thread Gerard Gagliano
I didn’t know about the Routing appender. I’ll check it out next week. Thanks. > On Apr 3, 2017, at 9:45 AM, Mikael Ståldal wrote: > > Have you tried to use RoutingAppender ( > https://logging.apache.org/log4j/2.x/manual/appenders.html#RoutingAppender >

Re: Kafka Appender with Programmatic Configuration

2017-04-05 Thread Ralph Goers
Probably not without making a specific class to support it. As I said previously, the raw component methods are there so that they can configure anything. All the specific classes and methods do is hide that in a more user friendly interface. Ralph > On Apr 5, 2017, at 7:04 AM, Mikael Ståldal

Re: Kafka Appender with Programmatic Configuration

2017-04-05 Thread Mikael Ståldal
It works to do it like this: gelfBuilder.addComponent(builder.newComponent("KeyValuePair").addAttribute( "key", "foo").addAttribute("value", "bar")); Is there no simpler way to do it? On Wed, Apr 5, 2017 at 2:01 PM, Mikael Ståldal wrote: > But how do you do this for

Re: Kafka Appender with Programmatic Configuration

2017-04-05 Thread Mikael Ståldal
But how do you do this for KeyValuePair? When I do: LayoutComponentBuilder gelfBuilder = builder.newLayout("GelfLayout"); gelfBuilder.addAttribute("host", "myself"); gelfBuilder.addComponent(builder.newComponent("foo", "KeyValuePair", "bar")); it doesn't work and I get this error message: