On Thu, Dec 21, 2017 at 3:45 PM, Remko Popma <remko.po...@gmail.com> wrote:

> I suppose that was done for the streams module, to allow installing Log4j2
> on jdbc drivers.
>

Correct. I wrote a JDBC driver that uses Log4j 2 but this is useful for any
JDBC Driver where you want that driver to log to Log4j instead of a
PrintWriter; which is what JDBC forces you to use.

>From the Javdoc for org.apache.logging.log4j.io.LoggerPrintWriter:

     PrintWriter pw =
IoBuilder.forLogger().setLevel(Level.DEBUG).buildPrintWriter();
     DriverManager.setLogWriter(pw);
     DataSource ds = ...
     ds.setLogWriter(pw);

Gary


> (Shameless plug) Every java main() method deserves http://picocli.info
>
> > On Dec 22, 2017, at 4:55, Ralph Goers <ralph.go...@dslextreme.com>
> wrote:
> >
> > This one has me stumped. I don’t recall when OutputStreamAppender or
> WriterAppender were added or why but they are unlike any other Appenders.
> The documentation on OutputStreamAppender is wrong by the way, It says it
> is used by other Appenders but that isn’t the case. All the other use
> AbstractOutputStreamAppender. I have no idea why OutputStreamAppender or
> WriterAppender exist or how you are supposed to use them.
> >
> > Ralph
> >
> >
> >
> >> On Dec 21, 2017, at 12:02 PM, Jens Schmidt <schm...@iils.de> wrote:
> >>
> >> Hello Ralph,
> >>
> >> thank you for your answer. That worked for the most part!
> >> However using the CompnentBuilder i am not able to create an
> OutputStreamAppender.
> >>
> >> I looked into the Code and the internal Builder Classes of the
> OutputStreamAppender and the WriterAppender are defined differently
> compared to, e.g. the ConsoleAppender. I believe this to be a bug?.
> >>
> >> Cheers Jens
> >>
> >>
> >>
> >>> Am 27.11.2017 um 18:36 schrieb Ralph Goers:
> >>> 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 <schm...@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: schm...@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-unsubscr...@logging.apache.org
> >>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >>>>
> >>>>
> >>
> >> --
> >> Dipl.-Ing. Jens Schmidt
> >> Telefon: 0711/217-24901-2
> >> Email: schm...@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-unsubscr...@logging.apache.org
> >> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to