Kafka Appender with Programmatic Configuration

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Kafka Appender with Programmatic Configuration

Marvin Geitner
Hi all,

I'm trying to configure the Kafka Appender with the programmatic configuration described in the manuals. So I created the ConfigurationFactory and set up the AppenderComponentBuilder.

If I execute the Application I'll get following exception:

Caused by: org.apache.kafka.common.config.ConfigException: Missing required configuration "bootstrap.servers" which has no default value.

Obviously the property "bootstrap.servers" hasn't been set.

A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work. In XML the configuration looks like <Property name="bootstrap.servers">kafka.host</Property>.

But how do I set this in java?

The code looks like the following:

    static Configuration createConfiguration(final String name, ConfigurationBuilder<BuiltConfiguration> builder) {

        builder.setConfigurationName(name);
        builder.setStatusLevel(Level.INFO);

        AppenderComponentBuilder kafkaBuilder = builder.newAppender("KafkaLogger ", "Kafka")
                .addAttribute("topic", "testTopic");
        kafkaBuilder.add(builder.newLayout("PatternLayout")
                .addAttribute("pattern", "%d{HH:mm:ss:SSS} | %logger{20} | %msg%n%ex{5}"));

        builder.add(kafkaBuilder);

        builder.add(builder.newRootLogger(Level.INFO).add(builder.newAppenderRef("KafkaLogger")));

        return builder.build();
    }

Hope someone can help me.

Thanks and BR,
Marvin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Matt Sicker
Looks like a bug to me! Here's the issue: a Properties component is
injected into a kafka appender, but there is no way to create a Property or
Properties component directly via the configuration builder API. The top
level properties aren't injected in the kafka appender (and manager), so
they're unused.

Interestingly enough, I don't see a way to inject KeyValuePair components
either (which is a similar plugin class in log4j-core).

Could you make an issue here: https://issues.apache.org/jira/browse/LOG4J2

On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:

> Hi all,
>
> I'm trying to configure the Kafka Appender with the programmatic
> configuration described in the manuals. So I created the
> ConfigurationFactory and set up the AppenderComponentBuilder.
>
> If I execute the Application I'll get following exception:
>
> Caused by: org.apache.kafka.common.config.ConfigException: Missing
> required configuration "bootstrap.servers" which has no default value.
>
> Obviously the property "bootstrap.servers" hasn't been set.
>
> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
> In XML the configuration looks like <Property name="bootstrap.servers">
> kafka.host</Property>.
>
> But how do I set this in java?
>
> The code looks like the following:
>
>     static Configuration createConfiguration(final String name,
> ConfigurationBuilder<BuiltConfiguration> builder) {
>
>         builder.setConfigurationName(name);
>         builder.setStatusLevel(Level.INFO);
>
>         AppenderComponentBuilder kafkaBuilder = builder.newAppender("KafkaLogger
> ", "Kafka")
>                 .addAttribute("topic", "testTopic");
>         kafkaBuilder.add(builder.newLayout("PatternLayout")
>                 .addAttribute("pattern", "%d{HH:mm:ss:SSS} | %logger{20} |
> %msg%n%ex{5}"));
>
>         builder.add(kafkaBuilder);
>
>         builder.add(builder.newRootLogger(Level.INFO).add(
> builder.newAppenderRef("KafkaLogger")));
>
>         return builder.build();
>     }
>
> Hope someone can help me.
>
> Thanks and BR,
> Marvin
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
Have you tried this:

kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers",
"Property", "kafka.host:*9092*"));


On Wed, Mar 29, 2017 at 5:26 PM, Matt Sicker <[hidden email]> wrote:

> Looks like a bug to me! Here's the issue: a Properties component is
> injected into a kafka appender, but there is no way to create a Property or
> Properties component directly via the configuration builder API. The top
> level properties aren't injected in the kafka appender (and manager), so
> they're unused.
>
> Interestingly enough, I don't see a way to inject KeyValuePair components
> either (which is a similar plugin class in log4j-core).
>
> Could you make an issue here: https://issues.apache.org/jira/browse/LOG4J2
>
> On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
>
> > Hi all,
> >
> > I'm trying to configure the Kafka Appender with the programmatic
> > configuration described in the manuals. So I created the
> > ConfigurationFactory and set up the AppenderComponentBuilder.
> >
> > If I execute the Application I'll get following exception:
> >
> > Caused by: org.apache.kafka.common.config.ConfigException: Missing
> > required configuration "bootstrap.servers" which has no default value.
> >
> > Obviously the property "bootstrap.servers" hasn't been set.
> >
> > A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
> > In XML the configuration looks like <Property name="bootstrap.servers">
> > kafka.host</Property>.
> >
> > But how do I set this in java?
> >
> > The code looks like the following:
> >
> >     static Configuration createConfiguration(final String name,
> > ConfigurationBuilder<BuiltConfiguration> builder) {
> >
> >         builder.setConfigurationName(name);
> >         builder.setStatusLevel(Level.INFO);
> >
> >         AppenderComponentBuilder kafkaBuilder = builder.newAppender("
> KafkaLogger
> > ", "Kafka")
> >                 .addAttribute("topic", "testTopic");
> >         kafkaBuilder.add(builder.newLayout("PatternLayout")
> >                 .addAttribute("pattern", "%d{HH:mm:ss:SSS} | %logger{20}
> |
> > %msg%n%ex{5}"));
> >
> >         builder.add(kafkaBuilder);
> >
> >         builder.add(builder.newRootLogger(Level.INFO).add(
> > builder.newAppenderRef("KafkaLogger")));
> >
> >         return builder.build();
> >     }
> >
> > Hope someone can help me.
> >
> > Thanks and BR,
> > Marvin
> >
>
>
>
> --
> Matt Sicker <[hidden email]>
>



--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
But it would be nice to have a simpler way to do that.

On Wed, Mar 29, 2017 at 5:28 PM, Mikael Ståldal <[hidden email]>
wrote:

> Have you tried this:
>
> kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers", "Property", "kafka.host:*9092*"));
>
>
> On Wed, Mar 29, 2017 at 5:26 PM, Matt Sicker <[hidden email]> wrote:
>
>> Looks like a bug to me! Here's the issue: a Properties component is
>> injected into a kafka appender, but there is no way to create a Property
>> or
>> Properties component directly via the configuration builder API. The top
>> level properties aren't injected in the kafka appender (and manager), so
>> they're unused.
>>
>> Interestingly enough, I don't see a way to inject KeyValuePair components
>> either (which is a similar plugin class in log4j-core).
>>
>> Could you make an issue here: https://issues.apache.org/jira
>> /browse/LOG4J2
>>
>> On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
>>
>> > Hi all,
>> >
>> > I'm trying to configure the Kafka Appender with the programmatic
>> > configuration described in the manuals. So I created the
>> > ConfigurationFactory and set up the AppenderComponentBuilder.
>> >
>> > If I execute the Application I'll get following exception:
>> >
>> > Caused by: org.apache.kafka.common.config.ConfigException: Missing
>> > required configuration "bootstrap.servers" which has no default value.
>> >
>> > Obviously the property "bootstrap.servers" hasn't been set.
>> >
>> > A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
>> > In XML the configuration looks like <Property name="bootstrap.servers">
>> > kafka.host</Property>.
>> >
>> > But how do I set this in java?
>> >
>> > The code looks like the following:
>> >
>> >     static Configuration createConfiguration(final String name,
>> > ConfigurationBuilder<BuiltConfiguration> builder) {
>> >
>> >         builder.setConfigurationName(name);
>> >         builder.setStatusLevel(Level.INFO);
>> >
>> >         AppenderComponentBuilder kafkaBuilder =
>> builder.newAppender("KafkaLogger
>> > ", "Kafka")
>> >                 .addAttribute("topic", "testTopic");
>> >         kafkaBuilder.add(builder.newLayout("PatternLayout")
>> >                 .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
>> %logger{20} |
>> > %msg%n%ex{5}"));
>> >
>> >         builder.add(kafkaBuilder);
>> >
>> >         builder.add(builder.newRootLogger(Level.INFO).add(
>> > builder.newAppenderRef("KafkaLogger")));
>> >
>> >         return builder.build();
>> >     }
>> >
>> > Hope someone can help me.
>> >
>> > Thanks and BR,
>> > Marvin
>> >
>>
>>
>>
>> --
>> Matt Sicker <[hidden email]>
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> [hidden email]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Ralph Goers
In reply to this post by Matt Sicker
Mikael’s solution is correct. Every item in the ConfigurationBuilder is a Component. We have “special” Components for things that are always used, such as Loggers and Appenders. But we can’t know about every type of Component so in those cases you just use the generic Component.

Ralph

> On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
>
> Looks like a bug to me! Here's the issue: a Properties component is
> injected into a kafka appender, but there is no way to create a Property or
> Properties component directly via the configuration builder API. The top
> level properties aren't injected in the kafka appender (and manager), so
> they're unused.
>
> Interestingly enough, I don't see a way to inject KeyValuePair components
> either (which is a similar plugin class in log4j-core).
>
> Could you make an issue here: https://issues.apache.org/jira/browse/LOG4J2
>
> On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
>
>> Hi all,
>>
>> I'm trying to configure the Kafka Appender with the programmatic
>> configuration described in the manuals. So I created the
>> ConfigurationFactory and set up the AppenderComponentBuilder.
>>
>> If I execute the Application I'll get following exception:
>>
>> Caused by: org.apache.kafka.common.config.ConfigException: Missing
>> required configuration "bootstrap.servers" which has no default value.
>>
>> Obviously the property "bootstrap.servers" hasn't been set.
>>
>> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
>> In XML the configuration looks like <Property name="bootstrap.servers">
>> kafka.host</Property>.
>>
>> But how do I set this in java?
>>
>> The code looks like the following:
>>
>>    static Configuration createConfiguration(final String name,
>> ConfigurationBuilder<BuiltConfiguration> builder) {
>>
>>        builder.setConfigurationName(name);
>>        builder.setStatusLevel(Level.INFO);
>>
>>        AppenderComponentBuilder kafkaBuilder = builder.newAppender("KafkaLogger
>> ", "Kafka")
>>                .addAttribute("topic", "testTopic");
>>        kafkaBuilder.add(builder.newLayout("PatternLayout")
>>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} | %logger{20} |
>> %msg%n%ex{5}"));
>>
>>        builder.add(kafkaBuilder);
>>
>>        builder.add(builder.newRootLogger(Level.INFO).add(
>> builder.newAppenderRef("KafkaLogger")));
>>
>>        return builder.build();
>>    }
>>
>> Hope someone can help me.
>>
>> Thanks and BR,
>> Marvin
>>
>
>
>
> --
> Matt Sicker <[hidden email]>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: Kafka Appender with Programmatic Configuration

Marvin Geitner
Thank you very much,

kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers", "Property", "kafka.host:*9092*"));

is working.

BR
Marvin

-----Ursprüngliche Nachricht-----
Von: Ralph Goers [mailto:[hidden email]]
Gesendet: Mittwoch, 29. März 2017 17:46
An: Log4J Users List <[hidden email]>
Betreff: Re: Kafka Appender with Programmatic Configuration

Mikael’s solution is correct. Every item in the ConfigurationBuilder is a Component. We have “special” Components for things that are always used, such as Loggers and Appenders. But we can’t know about every type of Component so in those cases you just use the generic Component.

Ralph

> On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
>
> Looks like a bug to me! Here's the issue: a Properties component is
> injected into a kafka appender, but there is no way to create a
> Property or Properties component directly via the configuration
> builder API. The top level properties aren't injected in the kafka
> appender (and manager), so they're unused.
>
> Interestingly enough, I don't see a way to inject KeyValuePair
> components either (which is a similar plugin class in log4j-core).
>
> Could you make an issue here:
> https://issues.apache.org/jira/browse/LOG4J2
>
> On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
>
>> Hi all,
>>
>> I'm trying to configure the Kafka Appender with the programmatic
>> configuration described in the manuals. So I created the
>> ConfigurationFactory and set up the AppenderComponentBuilder.
>>
>> If I execute the Application I'll get following exception:
>>
>> Caused by: org.apache.kafka.common.config.ConfigException: Missing
>> required configuration "bootstrap.servers" which has no default value.
>>
>> Obviously the property "bootstrap.servers" hasn't been set.
>>
>> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
>> In XML the configuration looks like <Property
>> name="bootstrap.servers"> kafka.host</Property>.
>>
>> But how do I set this in java?
>>
>> The code looks like the following:
>>
>>    static Configuration createConfiguration(final String name,
>> ConfigurationBuilder<BuiltConfiguration> builder) {
>>
>>        builder.setConfigurationName(name);
>>        builder.setStatusLevel(Level.INFO);
>>
>>        AppenderComponentBuilder kafkaBuilder =
>> builder.newAppender("KafkaLogger ", "Kafka")
>>                .addAttribute("topic", "testTopic");
>>        kafkaBuilder.add(builder.newLayout("PatternLayout")
>>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
>> %logger{20} | %msg%n%ex{5}"));
>>
>>        builder.add(kafkaBuilder);
>>
>>        builder.add(builder.newRootLogger(Level.INFO).add(
>> builder.newAppenderRef("KafkaLogger")));
>>
>>        return builder.build();
>>    }
>>
>> Hope someone can help me.
>>
>> Thanks and BR,
>> Marvin
>>
>
>
>
> --
> Matt Sicker <[hidden email]>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Matt Sicker
Oh, I see. That's an interesting API...

On 29 March 2017 at 10:49, Marvin Geitner <[hidden email]> wrote:

> Thank you very much,
>
> kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers",
> "Property", "kafka.host:*9092*"));
>
> is working.
>
> BR
> Marvin
>
> -----Ursprüngliche Nachricht-----
> Von: Ralph Goers [mailto:[hidden email]]
> Gesendet: Mittwoch, 29. März 2017 17:46
> An: Log4J Users List <[hidden email]>
> Betreff: Re: Kafka Appender with Programmatic Configuration
>
> Mikael’s solution is correct. Every item in the ConfigurationBuilder is a
> Component. We have “special” Components for things that are always used,
> such as Loggers and Appenders. But we can’t know about every type of
> Component so in those cases you just use the generic Component.
>
> Ralph
>
> > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
> >
> > Looks like a bug to me! Here's the issue: a Properties component is
> > injected into a kafka appender, but there is no way to create a
> > Property or Properties component directly via the configuration
> > builder API. The top level properties aren't injected in the kafka
> > appender (and manager), so they're unused.
> >
> > Interestingly enough, I don't see a way to inject KeyValuePair
> > components either (which is a similar plugin class in log4j-core).
> >
> > Could you make an issue here:
> > https://issues.apache.org/jira/browse/LOG4J2
> >
> > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
> >
> >> Hi all,
> >>
> >> I'm trying to configure the Kafka Appender with the programmatic
> >> configuration described in the manuals. So I created the
> >> ConfigurationFactory and set up the AppenderComponentBuilder.
> >>
> >> If I execute the Application I'll get following exception:
> >>
> >> Caused by: org.apache.kafka.common.config.ConfigException: Missing
> >> required configuration "bootstrap.servers" which has no default value.
> >>
> >> Obviously the property "bootstrap.servers" hasn't been set.
> >>
> >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
> >> In XML the configuration looks like <Property
> >> name="bootstrap.servers"> kafka.host</Property>.
> >>
> >> But how do I set this in java?
> >>
> >> The code looks like the following:
> >>
> >>    static Configuration createConfiguration(final String name,
> >> ConfigurationBuilder<BuiltConfiguration> builder) {
> >>
> >>        builder.setConfigurationName(name);
> >>        builder.setStatusLevel(Level.INFO);
> >>
> >>        AppenderComponentBuilder kafkaBuilder =
> >> builder.newAppender("KafkaLogger ", "Kafka")
> >>                .addAttribute("topic", "testTopic");
> >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
> >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
> >> %logger{20} | %msg%n%ex{5}"));
> >>
> >>        builder.add(kafkaBuilder);
> >>
> >>        builder.add(builder.newRootLogger(Level.INFO).add(
> >> builder.newAppenderRef("KafkaLogger")));
> >>
> >>        return builder.build();
> >>    }
> >>
> >> Hope someone can help me.
> >>
> >> Thanks and BR,
> >> Marvin
> >>
> >
> >
> >
> > --
> > Matt Sicker <[hidden email]>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
Would it make sense to have shortcuts for Property and KeyValuePair, since
they are generic and used by several appenders/layouts?

On Wed, Mar 29, 2017 at 7:12 PM, Matt Sicker <[hidden email]> wrote:

> Oh, I see. That's an interesting API...
>
> On 29 March 2017 at 10:49, Marvin Geitner <[hidden email]> wrote:
>
> > Thank you very much,
> >
> > kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers",
> > "Property", "kafka.host:*9092*"));
> >
> > is working.
> >
> > BR
> > Marvin
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Ralph Goers [mailto:[hidden email]]
> > Gesendet: Mittwoch, 29. März 2017 17:46
> > An: Log4J Users List <[hidden email]>
> > Betreff: Re: Kafka Appender with Programmatic Configuration
> >
> > Mikael’s solution is correct. Every item in the ConfigurationBuilder is a
> > Component. We have “special” Components for things that are always used,
> > such as Loggers and Appenders. But we can’t know about every type of
> > Component so in those cases you just use the generic Component.
> >
> > Ralph
> >
> > > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
> > >
> > > Looks like a bug to me! Here's the issue: a Properties component is
> > > injected into a kafka appender, but there is no way to create a
> > > Property or Properties component directly via the configuration
> > > builder API. The top level properties aren't injected in the kafka
> > > appender (and manager), so they're unused.
> > >
> > > Interestingly enough, I don't see a way to inject KeyValuePair
> > > components either (which is a similar plugin class in log4j-core).
> > >
> > > Could you make an issue here:
> > > https://issues.apache.org/jira/browse/LOG4J2
> > >
> > > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]>
> wrote:
> > >
> > >> Hi all,
> > >>
> > >> I'm trying to configure the Kafka Appender with the programmatic
> > >> configuration described in the manuals. So I created the
> > >> ConfigurationFactory and set up the AppenderComponentBuilder.
> > >>
> > >> If I execute the Application I'll get following exception:
> > >>
> > >> Caused by: org.apache.kafka.common.config.ConfigException: Missing
> > >> required configuration "bootstrap.servers" which has no default value.
> > >>
> > >> Obviously the property "bootstrap.servers" hasn't been set.
> > >>
> > >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't
> work.
> > >> In XML the configuration looks like <Property
> > >> name="bootstrap.servers"> kafka.host</Property>.
> > >>
> > >> But how do I set this in java?
> > >>
> > >> The code looks like the following:
> > >>
> > >>    static Configuration createConfiguration(final String name,
> > >> ConfigurationBuilder<BuiltConfiguration> builder) {
> > >>
> > >>        builder.setConfigurationName(name);
> > >>        builder.setStatusLevel(Level.INFO);
> > >>
> > >>        AppenderComponentBuilder kafkaBuilder =
> > >> builder.newAppender("KafkaLogger ", "Kafka")
> > >>                .addAttribute("topic", "testTopic");
> > >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
> > >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
> > >> %logger{20} | %msg%n%ex{5}"));
> > >>
> > >>        builder.add(kafkaBuilder);
> > >>
> > >>        builder.add(builder.newRootLogger(Level.INFO).add(
> > >> builder.newAppenderRef("KafkaLogger")));
> > >>
> > >>        return builder.build();
> > >>    }
> > >>
> > >> Hope someone can help me.
> > >>
> > >> Thanks and BR,
> > >> Marvin
> > >>
> > >
> > >
> > >
> > > --
> > > Matt Sicker <[hidden email]>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> Matt Sicker <[hidden email]>
>



--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Matt Sicker
I think so. That'd be less confusing.

On 30 March 2017 at 02:43, Mikael Ståldal <[hidden email]> wrote:

> Would it make sense to have shortcuts for Property and KeyValuePair, since
> they are generic and used by several appenders/layouts?
>
> On Wed, Mar 29, 2017 at 7:12 PM, Matt Sicker <[hidden email]> wrote:
>
> > Oh, I see. That's an interesting API...
> >
> > On 29 March 2017 at 10:49, Marvin Geitner <[hidden email]> wrote:
> >
> > > Thank you very much,
> > >
> > > kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers",
> > > "Property", "kafka.host:*9092*"));
> > >
> > > is working.
> > >
> > > BR
> > > Marvin
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Ralph Goers [mailto:[hidden email]]
> > > Gesendet: Mittwoch, 29. März 2017 17:46
> > > An: Log4J Users List <[hidden email]>
> > > Betreff: Re: Kafka Appender with Programmatic Configuration
> > >
> > > Mikael’s solution is correct. Every item in the ConfigurationBuilder
> is a
> > > Component. We have “special” Components for things that are always
> used,
> > > such as Loggers and Appenders. But we can’t know about every type of
> > > Component so in those cases you just use the generic Component.
> > >
> > > Ralph
> > >
> > > > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
> > > >
> > > > Looks like a bug to me! Here's the issue: a Properties component is
> > > > injected into a kafka appender, but there is no way to create a
> > > > Property or Properties component directly via the configuration
> > > > builder API. The top level properties aren't injected in the kafka
> > > > appender (and manager), so they're unused.
> > > >
> > > > Interestingly enough, I don't see a way to inject KeyValuePair
> > > > components either (which is a similar plugin class in log4j-core).
> > > >
> > > > Could you make an issue here:
> > > > https://issues.apache.org/jira/browse/LOG4J2
> > > >
> > > > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]>
> > wrote:
> > > >
> > > >> Hi all,
> > > >>
> > > >> I'm trying to configure the Kafka Appender with the programmatic
> > > >> configuration described in the manuals. So I created the
> > > >> ConfigurationFactory and set up the AppenderComponentBuilder.
> > > >>
> > > >> If I execute the Application I'll get following exception:
> > > >>
> > > >> Caused by: org.apache.kafka.common.config.ConfigException: Missing
> > > >> required configuration "bootstrap.servers" which has no default
> value.
> > > >>
> > > >> Obviously the property "bootstrap.servers" hasn't been set.
> > > >>
> > > >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't
> > work.
> > > >> In XML the configuration looks like <Property
> > > >> name="bootstrap.servers"> kafka.host</Property>.
> > > >>
> > > >> But how do I set this in java?
> > > >>
> > > >> The code looks like the following:
> > > >>
> > > >>    static Configuration createConfiguration(final String name,
> > > >> ConfigurationBuilder<BuiltConfiguration> builder) {
> > > >>
> > > >>        builder.setConfigurationName(name);
> > > >>        builder.setStatusLevel(Level.INFO);
> > > >>
> > > >>        AppenderComponentBuilder kafkaBuilder =
> > > >> builder.newAppender("KafkaLogger ", "Kafka")
> > > >>                .addAttribute("topic", "testTopic");
> > > >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
> > > >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
> > > >> %logger{20} | %msg%n%ex{5}"));
> > > >>
> > > >>        builder.add(kafkaBuilder);
> > > >>
> > > >>        builder.add(builder.newRootLogger(Level.INFO).add(
> > > >> builder.newAppenderRef("KafkaLogger")));
> > > >>
> > > >>        return builder.build();
> > > >>    }
> > > >>
> > > >> Hope someone can help me.
> > > >>
> > > >> Thanks and BR,
> > > >> Marvin
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > Matt Sicker <[hidden email]>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> >
> > --
> > Matt Sicker <[hidden email]>
> >
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> [hidden email]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
https://issues.apache.org/jira/browse/LOG4J2-1860

On Thu, Mar 30, 2017 at 5:27 PM, Matt Sicker <[hidden email]> wrote:

> I think so. That'd be less confusing.
>
> On 30 March 2017 at 02:43, Mikael Ståldal <[hidden email]>
> wrote:
>
> > Would it make sense to have shortcuts for Property and KeyValuePair,
> since
> > they are generic and used by several appenders/layouts?
> >
> > On Wed, Mar 29, 2017 at 7:12 PM, Matt Sicker <[hidden email]> wrote:
> >
> > > Oh, I see. That's an interesting API...
> > >
> > > On 29 March 2017 at 10:49, Marvin Geitner <[hidden email]>
> wrote:
> > >
> > > > Thank you very much,
> > > >
> > > > kafkaBuilder.addComponent(builder.newComponent("bootstrap.servers",
> > > > "Property", "kafka.host:*9092*"));
> > > >
> > > > is working.
> > > >
> > > > BR
> > > > Marvin
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Ralph Goers [mailto:[hidden email]]
> > > > Gesendet: Mittwoch, 29. März 2017 17:46
> > > > An: Log4J Users List <[hidden email]>
> > > > Betreff: Re: Kafka Appender with Programmatic Configuration
> > > >
> > > > Mikael’s solution is correct. Every item in the ConfigurationBuilder
> > is a
> > > > Component. We have “special” Components for things that are always
> > used,
> > > > such as Loggers and Appenders. But we can’t know about every type of
> > > > Component so in those cases you just use the generic Component.
> > > >
> > > > Ralph
> > > >
> > > > > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
> > > > >
> > > > > Looks like a bug to me! Here's the issue: a Properties component is
> > > > > injected into a kafka appender, but there is no way to create a
> > > > > Property or Properties component directly via the configuration
> > > > > builder API. The top level properties aren't injected in the kafka
> > > > > appender (and manager), so they're unused.
> > > > >
> > > > > Interestingly enough, I don't see a way to inject KeyValuePair
> > > > > components either (which is a similar plugin class in log4j-core).
> > > > >
> > > > > Could you make an issue here:
> > > > > https://issues.apache.org/jira/browse/LOG4J2
> > > > >
> > > > > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]>
> > > wrote:
> > > > >
> > > > >> Hi all,
> > > > >>
> > > > >> I'm trying to configure the Kafka Appender with the programmatic
> > > > >> configuration described in the manuals. So I created the
> > > > >> ConfigurationFactory and set up the AppenderComponentBuilder.
> > > > >>
> > > > >> If I execute the Application I'll get following exception:
> > > > >>
> > > > >> Caused by: org.apache.kafka.common.config.ConfigException:
> Missing
> > > > >> required configuration "bootstrap.servers" which has no default
> > value.
> > > > >>
> > > > >> Obviously the property "bootstrap.servers" hasn't been set.
> > > > >>
> > > > >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't
> > > work.
> > > > >> In XML the configuration looks like <Property
> > > > >> name="bootstrap.servers"> kafka.host</Property>.
> > > > >>
> > > > >> But how do I set this in java?
> > > > >>
> > > > >> The code looks like the following:
> > > > >>
> > > > >>    static Configuration createConfiguration(final String name,
> > > > >> ConfigurationBuilder<BuiltConfiguration> builder) {
> > > > >>
> > > > >>        builder.setConfigurationName(name);
> > > > >>        builder.setStatusLevel(Level.INFO);
> > > > >>
> > > > >>        AppenderComponentBuilder kafkaBuilder =
> > > > >> builder.newAppender("KafkaLogger ", "Kafka")
> > > > >>                .addAttribute("topic", "testTopic");
> > > > >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
> > > > >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
> > > > >> %logger{20} | %msg%n%ex{5}"));
> > > > >>
> > > > >>        builder.add(kafkaBuilder);
> > > > >>
> > > > >>        builder.add(builder.newRootLogger(Level.INFO).add(
> > > > >> builder.newAppenderRef("KafkaLogger")));
> > > > >>
> > > > >>        return builder.build();
> > > > >>    }
> > > > >>
> > > > >> Hope someone can help me.
> > > > >>
> > > > >> Thanks and BR,
> > > > >> Marvin
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Matt Sicker <[hidden email]>
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > > >
> > >
> > >
> > > --
> > > Matt Sicker <[hidden email]>
> > >
> >
> >
> >
> > --
> > [image: MagineTV]
> >
> > *Mikael Ståldal*
> > Senior software developer
> >
> > *Magine TV*
> > [hidden email]
> > Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
> >
> > Privileged and/or Confidential Information may be contained in this
> > message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may
> not
> > copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply
> > email.
> >
>
>
>
> --
> Matt Sicker <[hidden email]>
>



--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
In reply to this post by Ralph Goers
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:

ERROR KeyValuePair contains an invalid element or attribute "name"

It seems like the problem is that KeyValuePair have a "key" field, but
builder.newComponent()
assumes that it has a "name" field (like Property).

On Wed, Mar 29, 2017 at 5:46 PM, Ralph Goers <[hidden email]>
wrote:

> Mikael’s solution is correct. Every item in the ConfigurationBuilder is a
> Component. We have “special” Components for things that are always used,
> such as Loggers and Appenders. But we can’t know about every type of
> Component so in those cases you just use the generic Component.
>
> Ralph
>
> > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
> >
> > Looks like a bug to me! Here's the issue: a Properties component is
> > injected into a kafka appender, but there is no way to create a Property
> or
> > Properties component directly via the configuration builder API. The top
> > level properties aren't injected in the kafka appender (and manager), so
> > they're unused.
> >
> > Interestingly enough, I don't see a way to inject KeyValuePair components
> > either (which is a similar plugin class in log4j-core).
> >
> > Could you make an issue here: https://issues.apache.org/
> jira/browse/LOG4J2
> >
> > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]> wrote:
> >
> >> Hi all,
> >>
> >> I'm trying to configure the Kafka Appender with the programmatic
> >> configuration described in the manuals. So I created the
> >> ConfigurationFactory and set up the AppenderComponentBuilder.
> >>
> >> If I execute the Application I'll get following exception:
> >>
> >> Caused by: org.apache.kafka.common.config.ConfigException: Missing
> >> required configuration "bootstrap.servers" which has no default value.
> >>
> >> Obviously the property "bootstrap.servers" hasn't been set.
> >>
> >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't work.
> >> In XML the configuration looks like <Property name="bootstrap.servers">
> >> kafka.host</Property>.
> >>
> >> But how do I set this in java?
> >>
> >> The code looks like the following:
> >>
> >>    static Configuration createConfiguration(final String name,
> >> ConfigurationBuilder<BuiltConfiguration> builder) {
> >>
> >>        builder.setConfigurationName(name);
> >>        builder.setStatusLevel(Level.INFO);
> >>
> >>        AppenderComponentBuilder kafkaBuilder = builder.newAppender("
> KafkaLogger
> >> ", "Kafka")
> >>                .addAttribute("topic", "testTopic");
> >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
> >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} | %logger{20}
> |
> >> %msg%n%ex{5}"));
> >>
> >>        builder.add(kafkaBuilder);
> >>
> >>        builder.add(builder.newRootLogger(Level.INFO).add(
> >> builder.newAppenderRef("KafkaLogger")));
> >>
> >>        return builder.build();
> >>    }
> >>
> >> Hope someone can help me.
> >>
> >> Thanks and BR,
> >> Marvin
> >>
> >
> >
> >
> > --
> > Matt Sicker <[hidden email]>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

Mikael Ståldal-3
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 <[hidden email]>
wrote:

> 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:
>
> ERROR KeyValuePair contains an invalid element or attribute "name"
>
> It seems like the problem is that KeyValuePair have a "key" field, but
> builder.newComponent()
> assumes that it has a "name" field (like Property).
>
> On Wed, Mar 29, 2017 at 5:46 PM, Ralph Goers <[hidden email]>
> wrote:
>
>> Mikael’s solution is correct. Every item in the ConfigurationBuilder is a
>> Component. We have “special” Components for things that are always used,
>> such as Loggers and Appenders. But we can’t know about every type of
>> Component so in those cases you just use the generic Component.
>>
>> Ralph
>>
>> > On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
>> >
>> > Looks like a bug to me! Here's the issue: a Properties component is
>> > injected into a kafka appender, but there is no way to create a
>> Property or
>> > Properties component directly via the configuration builder API. The top
>> > level properties aren't injected in the kafka appender (and manager), so
>> > they're unused.
>> >
>> > Interestingly enough, I don't see a way to inject KeyValuePair
>> components
>> > either (which is a similar plugin class in log4j-core).
>> >
>> > Could you make an issue here: https://issues.apache.org/jira
>> /browse/LOG4J2
>> >
>> > On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]>
>> wrote:
>> >
>> >> Hi all,
>> >>
>> >> I'm trying to configure the Kafka Appender with the programmatic
>> >> configuration described in the manuals. So I created the
>> >> ConfigurationFactory and set up the AppenderComponentBuilder.
>> >>
>> >> If I execute the Application I'll get following exception:
>> >>
>> >> Caused by: org.apache.kafka.common.config.ConfigException: Missing
>> >> required configuration "bootstrap.servers" which has no default value.
>> >>
>> >> Obviously the property "bootstrap.servers" hasn't been set.
>> >>
>> >> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't
>> work.
>> >> In XML the configuration looks like <Property name="bootstrap.servers">
>> >> kafka.host</Property>.
>> >>
>> >> But how do I set this in java?
>> >>
>> >> The code looks like the following:
>> >>
>> >>    static Configuration createConfiguration(final String name,
>> >> ConfigurationBuilder<BuiltConfiguration> builder) {
>> >>
>> >>        builder.setConfigurationName(name);
>> >>        builder.setStatusLevel(Level.INFO);
>> >>
>> >>        AppenderComponentBuilder kafkaBuilder =
>> builder.newAppender("KafkaLogger
>> >> ", "Kafka")
>> >>                .addAttribute("topic", "testTopic");
>> >>        kafkaBuilder.add(builder.newLayout("PatternLayout")
>> >>                .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
>> %logger{20} |
>> >> %msg%n%ex{5}"));
>> >>
>> >>        builder.add(kafkaBuilder);
>> >>
>> >>        builder.add(builder.newRootLogger(Level.INFO).add(
>> >> builder.newAppenderRef("KafkaLogger")));
>> >>
>> >>        return builder.build();
>> >>    }
>> >>
>> >> Hope someone can help me.
>> >>
>> >> Thanks and BR,
>> >> Marvin
>> >>
>> >
>> >
>> >
>> > --
>> > Matt Sicker <[hidden email]>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> [hidden email]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



--
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
[hidden email]
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Kafka Appender with Programmatic Configuration

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 <[hidden email]> wrote:
>
> 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 <[hidden email]>
> wrote:
>
>> 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:
>>
>> ERROR KeyValuePair contains an invalid element or attribute "name"
>>
>> It seems like the problem is that KeyValuePair have a "key" field, but
>> builder.newComponent()
>> assumes that it has a "name" field (like Property).
>>
>> On Wed, Mar 29, 2017 at 5:46 PM, Ralph Goers <[hidden email]>
>> wrote:
>>
>>> Mikael’s solution is correct. Every item in the ConfigurationBuilder is a
>>> Component. We have “special” Components for things that are always used,
>>> such as Loggers and Appenders. But we can’t know about every type of
>>> Component so in those cases you just use the generic Component.
>>>
>>> Ralph
>>>
>>>> On Mar 29, 2017, at 8:26 AM, Matt Sicker <[hidden email]> wrote:
>>>>
>>>> Looks like a bug to me! Here's the issue: a Properties component is
>>>> injected into a kafka appender, but there is no way to create a
>>> Property or
>>>> Properties component directly via the configuration builder API. The top
>>>> level properties aren't injected in the kafka appender (and manager), so
>>>> they're unused.
>>>>
>>>> Interestingly enough, I don't see a way to inject KeyValuePair
>>> components
>>>> either (which is a similar plugin class in log4j-core).
>>>>
>>>> Could you make an issue here: https://issues.apache.org/jira
>>> /browse/LOG4J2
>>>>
>>>> On 29 March 2017 at 09:27, Marvin Geitner <[hidden email]>
>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I'm trying to configure the Kafka Appender with the programmatic
>>>>> configuration described in the manuals. So I created the
>>>>> ConfigurationFactory and set up the AppenderComponentBuilder.
>>>>>
>>>>> If I execute the Application I'll get following exception:
>>>>>
>>>>> Caused by: org.apache.kafka.common.config.ConfigException: Missing
>>>>> required configuration "bootstrap.servers" which has no default value.
>>>>>
>>>>> Obviously the property "bootstrap.servers" hasn't been set.
>>>>>
>>>>> A builder.addProperty("bootstrap.servers", "kafka.host"); doesn't
>>> work.
>>>>> In XML the configuration looks like <Property name="bootstrap.servers">
>>>>> kafka.host</Property>.
>>>>>
>>>>> But how do I set this in java?
>>>>>
>>>>> The code looks like the following:
>>>>>
>>>>>   static Configuration createConfiguration(final String name,
>>>>> ConfigurationBuilder<BuiltConfiguration> builder) {
>>>>>
>>>>>       builder.setConfigurationName(name);
>>>>>       builder.setStatusLevel(Level.INFO);
>>>>>
>>>>>       AppenderComponentBuilder kafkaBuilder =
>>> builder.newAppender("KafkaLogger
>>>>> ", "Kafka")
>>>>>               .addAttribute("topic", "testTopic");
>>>>>       kafkaBuilder.add(builder.newLayout("PatternLayout")
>>>>>               .addAttribute("pattern", "%d{HH:mm:ss:SSS} |
>>> %logger{20} |
>>>>> %msg%n%ex{5}"));
>>>>>
>>>>>       builder.add(kafkaBuilder);
>>>>>
>>>>>       builder.add(builder.newRootLogger(Level.INFO).add(
>>>>> builder.newAppenderRef("KafkaLogger")));
>>>>>
>>>>>       return builder.build();
>>>>>   }
>>>>>
>>>>> Hope someone can help me.
>>>>>
>>>>> Thanks and BR,
>>>>> Marvin
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <[hidden email]>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> [hidden email]
>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may not
>> copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> [hidden email]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...