You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jens Schmidt <sc...@iils.de> on 2017/11/27 16:29:26 UTC

How to build the Routing Appender with the ConfigurationBuilder

Hello there,

getting accustomed with log4j 2. It is awesome so far. However, i can't 
figure out how to create a routing logger with the ConfigurationBuilder 
API. I came this far:
AppenderComponentBuilder routingAppender = 
builder.newAppender("Routing", "Routing");

And then what, how do you configure the <Routes> and each <Route>?
Some input would be greatly appreciated!

Also, the OutputStreamAppender's Builder seems to be missing a few 
annotations (@PluginBuilderAttribute & @Required), compared to the one 
in ConsoleAppender.

Best regards
Jens Schmidt

-- 
Dipl.-Ing. Jens Schmidt
Telefon: 0711/217-24901-2
Email: schmidt@iils.de

IILS Ingenieurgesellschaft für Intelligente Lösungen und Systeme mbH
Albstrasse 6, D-72818 Trochtelfingen-Steinhilben
Geschäftsführer Dipl.-Ing. Peter Arnold und Dipl.-Ing. Roland Weil
USt-IDNr.: DE 203557532
Registergericht: Amtsgericht Stuttgart
Handelsregister: Ingenieurkammer Baden-Württemberg HRB 20422

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: How to build the Routing Appender with the ConfigurationBuilder

Posted by Ralph Goers <ra...@dslextreme.com>.
What you need to know is that with the ConfigurationBuilder everything is really a Component. Since Layouts, Appenders, Filters and Loggers are so common we have built specialized ComponentBuilders for them, but they could also be constructed with a generic ComponentBuilder. https://logging.apache.org/log4j/2.x/manual/customconfig.html <https://logging.apache.org/log4j/2.x/manual/customconfig.html> provides some examples that show creating triggering policies using the generic ComponentBuilder. You can use that as a guide to help you figure out how to construct your routes.

Ralph

> On Nov 27, 2017, at 9:29 AM, Jens Schmidt <sc...@iils.de> wrote:
> 
> 
> Hello there,
> 
> getting accustomed with log4j 2. It is awesome so far. However, i can't figure out how to create a routing logger with the ConfigurationBuilder API. I came this far:
> AppenderComponentBuilder routingAppender = builder.newAppender("Routing", "Routing");
> 
> And then what, how do you configure the <Routes> and each <Route>?
> Some input would be greatly appreciated!
> 
> Also, the OutputStreamAppender's Builder seems to be missing a few annotations (@PluginBuilderAttribute & @Required), compared to the one in ConsoleAppender.
> 
> Best regards
> Jens Schmidt
> 
> -- 
> Dipl.-Ing. Jens Schmidt
> Telefon: 0711/217-24901-2
> Email: schmidt@iils.de
> 
> IILS Ingenieurgesellschaft für Intelligente Lösungen und Systeme mbH
> Albstrasse 6, D-72818 Trochtelfingen-Steinhilben
> Geschäftsführer Dipl.-Ing. Peter Arnold und Dipl.-Ing. Roland Weil
> USt-IDNr.: DE 203557532
> Registergericht: Amtsgericht Stuttgart
> Handelsregister: Ingenieurkammer Baden-Württemberg HRB 20422
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
>