log4j2 support kafka

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

log4j2 support kafka

Mario Copperfield
Hi, all
I notice  that the logs produced by log4j2 can be written into Kafka.
I want to know if the log4j2 configuration file written in .properties?
If it can, how do i name the ‘properties’ in .xml as flowing:
<Kafka name="kafka" topic=“xxx">
        <PatternLayout pattern="%message"/>
        <Property name="bootstrap.servers”><ip>:9092</Property>
      </Kafka>

Thanks!

--
Best regards,
Amuro Copperfield
Reply | Threaded
Open this post in threaded view
|

Re: log4j2 support kafka

Matt Sicker
appender.k.type = Kafka
appender.k.name = kafka
appender.k.topic = xxx
appender.k.layout.type = PatternLayout
appender.k.layout.pattern = %message
appender.k.property.bootstrap.servers = <ip>:9092

At least that looks like it should work. Rename "k" to whatever you want as
it's mostly a way to keep a flat map going for hierarchical config.

On 11 April 2017 at 03:38, Mario Copperfield <[hidden email]> wrote:

> Hi, all
> I notice  that the logs produced by log4j2 can be written into Kafka.
> I want to know if the log4j2 configuration file written in .properties?
> If it can, how do i name the ‘properties’ in .xml as flowing:
> <Kafka name="kafka" topic=“xxx">
>         <PatternLayout pattern="%message"/>
>         <Property name="bootstrap.servers”><ip>:9092</Property>
>       </Kafka>
>
> Thanks!
>
> --
> Best regards,
> Amuro Copperfield
>



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

Re: log4j2 support kafka

Mario Copperfield
I’m sorry but it seems can not work.

On 11 Apr 2017, 23:08 +0800, Matt Sicker <[hidden email]>, wrote:
appender.k.type = Kafka
appender.k.name = kafka
appender.k.topic = xxx
appender.k.layout.type = PatternLayout
appender.k.layout.pattern = %message
appender.k.property.bootstrap.servers = <ip>:9092

At least that looks like it should work. Rename "k" to whatever you want as
it's mostly a way to keep a flat map going for hierarchical config.

On 11 April 2017 at 03:38, Mario Copperfield <[hidden email]> wrote:

Hi, all
I notice that the logs produced by log4j2 can be written into Kafka.
I want to know if the log4j2 configuration file written in .properties?
If it can, how do i name the ‘properties’ in .xml as flowing:
<Kafka name="kafka" topic=“xxx"
<PatternLayout pattern="%message"/
<Property name="bootstrap.servers”><ip>:9092</Property
</Kafka

Thanks!

--
Best regards,
Amuro Copperfield




--
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
|

Re: log4j2 support kafka

Mario Copperfield
In reply to this post by Matt Sicker

I’m sorry but it seems can not work.


On Tue, Apr 11, 2017 at 11:08 PM, Matt Sicker <[hidden email]> wrote:
appender.k.type = Kafka
appender.k.name = kafka
appender.k.topic = xxx
appender.k.layout.type = PatternLayout
appender.k.layout.pattern = %message
appender.k.property.bootstrap.servers = <ip>:9092

At least that looks like it should work. Rename "k" to whatever you want as
it's mostly a way to keep a flat map going for hierarchical config.

On 11 April 2017 at 03:38, Mario Copperfield <[hidden email]> wrote:

> Hi, all
> I notice  that the logs produced by log4j2 can be written into Kafka.
> I want to know if the log4j2 configuration file written in .properties?
> If it can, how do i name the ‘properties’ in .xml as flowing:
> <Kafka name="kafka" topic=“xxx">
>         <PatternLayout pattern="%message"/>
>         <Property name="bootstrap.servers”><ip>:9092</Property>
>       </Kafka>
>
> Thanks!
>
> --
> Best regards,
> Amuro Copperfield
>



--
Matt Sicker <[hidden email]>



--
Best regards,
Amuro Copperfield