Re: Appenders contains an invalid element or attribute "NoSql"

2014-07-21 Thread David KOCH
Hi Matt,

That was it. Works now, thanks.

/David


On Sun, Jul 20, 2014 at 10:45 PM, Matt Sicker  wrote:

> You need to add log4j-nosql to your classpath. It was separated from
> log4j-core due to its, uh, non-core-ness.
>
>
> On 20 July 2014 15:25, David KOCH  wrote:
>
> > Actually, I just checked the source - the nosql.mongodb package is no
> > longer present in 2.0, it was in 2.0-rc1. Is this intended?
> >
> > /David
> >
> >
> > On Sun, Jul 20, 2014 at 8:55 PM, Matt Sicker  wrote:
> >
> > > MongoDb is the name.
> > >
> > >
> > > On 20 July 2014 13:44, David KOCH  wrote:
> > >
> > > > Hello,
> > > >
> > > > I get this message:
> > > >
> > > > "Appenders contains an invalid element or attribute "NoSql"
> > > >
> > > > at start-up since switching from 2.0-rc1 to 2.0 when attempting to
> log
> > to
> > > > Mongo. My configuration has not changed.
> > > >
> > > > What's the new configuration name of the appender?
> > > >
> > > > Thanks,
> > > >
> > > > /David
> > > >
> > >
> > >
> > >
> > > --
> > > Matt Sicker 
> > >
> >
>
>
>
> --
> Matt Sicker 
>


Re: How do I log into a JavaFX text area?

2014-07-21 Thread Maciej Skrzetuski
Thanks Matt. This is working after enabling annotation processing and
adding the log4j2 core jar file to the so called factory path in Eclipse. I
think this should go into the official documentation.

On 20 July 2014 22:45, Matt Sicker  wrote:

> You'll have to enable annotation processing in Eclipse. This looks somewhat
> dated, but it might still be relevant:
>
> http://www.eclipse.org/jdt/apt/introToAPT.php
>
>
> On 20 July 2014 14:08, Maciej Skrzetuski  wrote:
>
> > I am hitting the *play* button (run actually) in Eclipse in my Java
> > project. I am not using Maven or Ant for building the project.
> >
> > On 20 July 2014 20:58, Matt Sicker  wrote:
> >
> > > How are you building this?
> > >
> > >
> > > On 20 July 2014 09:29, Maciej Skrzetuski 
> wrote:
> > >
> > > > Hi Ralph,
> > > >
> > > > yes, this is the 2.0 release version. Not the release *candidate* 2.
> > > >
> > > > Kind regards
> > > > Maciej
> > > >
> > > > On 20 July 2014 16:12, Ralph Goers  wrote:
> > > >
> > > > > This is with version 2.0?
> > > > >
> > > > > Sent from my iPad
> > > > >
> > > > > > On Jul 20, 2014, at 3:45 AM, Maciej Skrzetuski <
> > > m.skrzetu...@gmail.com
> > > > >
> > > > > wrote:
> > > > > >
> > > > > > Hi Matt,
> > > > > >
> > > > > > thanks for replying and your suggestions. I did what you said but
> > the
> > > > > > CLASS_NOT_FOUND error still occurs.
> > > > > > The debug log is at http://pastebin.com/595Q0bXY. The
> > > TextAreaAppender
> > > > > now
> > > > > > looks like this http://pastebin.com/SyzDNhGg and the log4j2.xml
> > like
> > > > > this
> > > > > > http://pastebin.com/zF7jPVrL.
> > > > > >
> > > > > > Kind regards
> > > > > > Maciej
> > > > > >
> > > > > >> On 20 July 2014 00:22, Matt Sicker  wrote:
> > > > > >>
> > > > > >> First of all, you don't need to use the packages attribute in
> > > > > >> Configuration. Secondly, you need to add the following two
> > > parameters
> > > > to
> > > > > >> your factory:
> > > > > >>
> > > > > >> @PluginElement("Layout") Layout layout
> > > > > >> @PluginElement("Filter") final Filter filter
> > > > > >>
> > > > > >> In your example, at the very least, you need to add the Layout
> > one.
> > > > Then
> > > > > >> you want to pass that to your constructor, of course.
> > > > > >>
> > > > > >> Also, set status="DEBUG" for more useful debug information when
> > > > working
> > > > > on
> > > > > >> custom plugins.
> > > > > >>
> > > > > >>
> > > > > >>> On 19 July 2014 17:03, Maciej Skrzetuski <
> m.skrzetu...@gmail.com
> > >
> > > > > wrote:
> > > > > >>>
> > > > > >>> Hello there,
> > > > > >>>
> > > > > >>> I tried to write a custom appender but that does not work at
> all.
> > > The
> > > > > >> class
> > > > > >>> that I implemented can be seen at http://pastebin.com/X2EUsYgP
> .
> > > The
> > > > > >>> configuration file that I am using at
> > http://pastebin.com/TsXJp7eU
> > > .
> > > > > >>>
> > > > > >>> I am getting the following exception.
> > > > > >>>
> > > > > >>> 2014-07-19 23:44:49,494 ERROR Error processing element Q:
> > > > > CLASS_NOT_FOUND
> > > > > >>>
> > > > > >>> 1. What am I doing wrong?
> > > > > >>> 2. Could someone please hand out the code for writing into a
> > JavaFX
> > > > or
> > > > > >>> Swing element (TextArea would be great) from Log4j2?
> > > > > >>>
> > > > > >>> Kind regards
> > > > > >>> Maciej Skrzetuski
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> --
> > > > > >> Matt Sicker 
> > > > > >>
> > > > >
> > > > >
> -
> > > > > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > > > > For additional commands, e-mail:
> log4j-user-h...@logging.apache.org
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Matt Sicker 
> > >
> >
>
>
>
> --
> Matt Sicker 
>


Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Mariano Gonzalez
Hello Remko,

I think I found the difference. AsyncLoggerContextSelector always returns
the same instance of AsyncLoggerContext, which in turns always returns
instances of AsyncLogger, which uses disruptor to handle concurrency.

However, with any other selector, a standard Logger instance is returned
and parallelism is achieved through an AsyncAppender. AsyncAppender use a
standard blocking queue instead of using disruptor which explains the
performance difference (there's also the fact that
AsyncLoggerContextSelector always returns the same context instance and
does not spend cycles in the lookup, but I think that is not a significant
cost once everything was warmed out).

http://logging.apache.org/log4j/2.x/manual/async.html says that when using
mixed type loggers disruptor is needed on the classpath. That seems to be
an error. For what I see disruptor is only used when setting all loggers
asynchronous.

Does this make sense? Anyway around this? Do you have a disruptor appender
somewhere?

Thanks!


On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma  wrote:

> To be honest, I haven't investigated in detail the reason for the
> difference in throughput in the performance test.
>
> Are you measuring the performance of your application container, and can
> you see an improvement when using Async Loggers?
> Do you see a large difference in performance _in your application_ between
> making all loggers Asynchronous and using mixed synchronous and
> Asynchronous loggers?
>
>
> On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> mariano.l.gonza...@gmail.com> wrote:
>
> > Hello Remko,
> >
> > Thanks for the insight. I guess my case falls into the wrong end of the
> > pareto law. My project is a low latency application container, so I need
> to
> > have:
> >
> >
> >- low latency
> >- log separation (I actually had to implement my own context selector
> >because my logic is more complicated than the standard
> >ClassLoaderContextSelector case)
> >- I want async loggers by default, but deployed apps need to be able
> to
> >specify sync loggers
> >
> >
> > Right now I'm kinda meeting those requirements using config file,
> AsyncRoot
> > and my custom selector, but it'd be really great to achieve a performance
> > level like the one that AsyncContextSelector promises.
> >
> > Is there a way of doing that? For what I see on the code, the
> > AsyncLoggerContextSelector's secret sauce is just to always return an
> > AsyncLogger on the newInstance() method. Why is that so much faster than
> > what ClassLoaderLoggerContextSelector does?
> >
> > Thanks!
> >
> >
> > On Fri, Jul 18, 2014 at 1:20 PM, Remko Popma 
> > wrote:
> >
> > > The Async Loggers created with the context selector have a slightly
> > > different mechanism. One of the differences is that LogEvent objects
> are
> > > re-used.
> > >
> > > However, unless your application is in the low-latency space, I would
> not
> > > worry too much about the performance difference. Both flavors of Async
> > > Loggers are much faster than the alternative (Async Appenders).
> > >
> > > Your point is valid though. I've been thinking about an alternative way
> > to
> > > configure Async Loggers than via system properties. The work in
> progress
> > is
> > > tracked in Jira ticket LOG4J2-321
> > > . This is still in
> the
> > > concept phase though. Meanwhile your best option is probably to use
> > > ClassLoaderContextSelector and configure with  and
> > > .
> > >
> > >
> > >
> > > On Fri, Jul 18, 2014 at 10:57 PM, Mariano Gonzalez <
> > > mariano.l.gonza...@gmail.com> wrote:
> > >
> > > > Hello,
> > > >
> > > > According to the performance charts in the documentation, log4j2 has
> a
> > > > significantly higher throughput when using AsyncLoggerContextSelector
> > > than
> > > > when using all async loggers with any different selector.
> > > >
> > > > Why is that? Is it just because the same context is always reused and
> > > > there's no lookup like in the ClassLoaderContextSelector case?
> > > >
> > > > If I need functionality similar to ClassLoaderContextSelector, is
> there
> > > any
> > > > way to get a throughput similar to AsyncLoggerContextSelector?
> > > >
> > > > Thanks!
> > > >
> > >
> >
>


Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Remko Popma
Hi,
No that is incorrect.
If you do not specify AsyncLoggerContextSelector but instead configure with
 and  loggers, you _do_ need the disruptor jar on
the classpath and this does _not_ use AsyncAppender. AsyncAppender is
completely separate from Async Loggers. Async Loggers (mixed or all async)
use the disruptor and both need the disruptor jar.

You keep mentioning a performance difference. I was assuming you were
talking about the performance test results mentioned on the Async Logger
manual page, but perhaps I was wrong? Are you experiencing a performance
difference between the two flavors of Async Loggers in your application?




On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
mariano.l.gonza...@gmail.com> wrote:

> Hello Remko,
>
> I think I found the difference. AsyncLoggerContextSelector always returns
> the same instance of AsyncLoggerContext, which in turns always returns
> instances of AsyncLogger, which uses disruptor to handle concurrency.
>
> However, with any other selector, a standard Logger instance is returned
> and parallelism is achieved through an AsyncAppender. AsyncAppender use a
> standard blocking queue instead of using disruptor which explains the
> performance difference (there's also the fact that
> AsyncLoggerContextSelector always returns the same context instance and
> does not spend cycles in the lookup, but I think that is not a significant
> cost once everything was warmed out).
>
> http://logging.apache.org/log4j/2.x/manual/async.html says that when using
> mixed type loggers disruptor is needed on the classpath. That seems to be
> an error. For what I see disruptor is only used when setting all loggers
> asynchronous.
>
> Does this make sense? Anyway around this? Do you have a disruptor appender
> somewhere?
>
> Thanks!
>
>
> On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma 
> wrote:
>
> > To be honest, I haven't investigated in detail the reason for the
> > difference in throughput in the performance test.
> >
> > Are you measuring the performance of your application container, and can
> > you see an improvement when using Async Loggers?
> > Do you see a large difference in performance _in your application_
> between
> > making all loggers Asynchronous and using mixed synchronous and
> > Asynchronous loggers?
> >
> >
> > On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> > mariano.l.gonza...@gmail.com> wrote:
> >
> > > Hello Remko,
> > >
> > > Thanks for the insight. I guess my case falls into the wrong end of the
> > > pareto law. My project is a low latency application container, so I
> need
> > to
> > > have:
> > >
> > >
> > >- low latency
> > >- log separation (I actually had to implement my own context
> selector
> > >because my logic is more complicated than the standard
> > >ClassLoaderContextSelector case)
> > >- I want async loggers by default, but deployed apps need to be able
> > to
> > >specify sync loggers
> > >
> > >
> > > Right now I'm kinda meeting those requirements using config file,
> > AsyncRoot
> > > and my custom selector, but it'd be really great to achieve a
> performance
> > > level like the one that AsyncContextSelector promises.
> > >
> > > Is there a way of doing that? For what I see on the code, the
> > > AsyncLoggerContextSelector's secret sauce is just to always return an
> > > AsyncLogger on the newInstance() method. Why is that so much faster
> than
> > > what ClassLoaderLoggerContextSelector does?
> > >
> > > Thanks!
> > >
> > >
> > > On Fri, Jul 18, 2014 at 1:20 PM, Remko Popma 
> > > wrote:
> > >
> > > > The Async Loggers created with the context selector have a slightly
> > > > different mechanism. One of the differences is that LogEvent objects
> > are
> > > > re-used.
> > > >
> > > > However, unless your application is in the low-latency space, I would
> > not
> > > > worry too much about the performance difference. Both flavors of
> Async
> > > > Loggers are much faster than the alternative (Async Appenders).
> > > >
> > > > Your point is valid though. I've been thinking about an alternative
> way
> > > to
> > > > configure Async Loggers than via system properties. The work in
> > progress
> > > is
> > > > tracked in Jira ticket LOG4J2-321
> > > > . This is still in
> > the
> > > > concept phase though. Meanwhile your best option is probably to use
> > > > ClassLoaderContextSelector and configure with  and
> > > > .
> > > >
> > > >
> > > >
> > > > On Fri, Jul 18, 2014 at 10:57 PM, Mariano Gonzalez <
> > > > mariano.l.gonza...@gmail.com> wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > According to the performance charts in the documentation, log4j2
> has
> > a
> > > > > significantly higher throughput when using
> AsyncLoggerContextSelector
> > > > than
> > > > > when using all async loggers with any different selector.
> > > > >
> > > > > Why is that? Is it just because the same context is always reused
> and
> > > > > there's no lookup like in the C

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Matt Sicker
I think he's talking about the ClassLoaderContextSelector which attempts to
find the logger context through several different ways. Using the
sun.reflect.Reflection class to get the caller class itself is one of those
techniques which might slow things down a little.

I actually have a change to LogManager that can help speed up LoggerContext
resolution when you create a Logger using a Class instead of a String.
The ClassLoader of that Class should be passed to the LoggerContextFactory
to help speed up resolution of the appropriate LoggerContext.


On 21 July 2014 09:22, Remko Popma  wrote:

> Hi,
> No that is incorrect.
> If you do not specify AsyncLoggerContextSelector but instead configure with
>  and  loggers, you _do_ need the disruptor jar on
> the classpath and this does _not_ use AsyncAppender. AsyncAppender is
> completely separate from Async Loggers. Async Loggers (mixed or all async)
> use the disruptor and both need the disruptor jar.
>
> You keep mentioning a performance difference. I was assuming you were
> talking about the performance test results mentioned on the Async Logger
> manual page, but perhaps I was wrong? Are you experiencing a performance
> difference between the two flavors of Async Loggers in your application?
>
>
>
>
> On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
> mariano.l.gonza...@gmail.com> wrote:
>
> > Hello Remko,
> >
> > I think I found the difference. AsyncLoggerContextSelector always returns
> > the same instance of AsyncLoggerContext, which in turns always returns
> > instances of AsyncLogger, which uses disruptor to handle concurrency.
> >
> > However, with any other selector, a standard Logger instance is returned
> > and parallelism is achieved through an AsyncAppender. AsyncAppender use a
> > standard blocking queue instead of using disruptor which explains the
> > performance difference (there's also the fact that
> > AsyncLoggerContextSelector always returns the same context instance and
> > does not spend cycles in the lookup, but I think that is not a
> significant
> > cost once everything was warmed out).
> >
> > http://logging.apache.org/log4j/2.x/manual/async.html says that when
> using
> > mixed type loggers disruptor is needed on the classpath. That seems to be
> > an error. For what I see disruptor is only used when setting all loggers
> > asynchronous.
> >
> > Does this make sense? Anyway around this? Do you have a disruptor
> appender
> > somewhere?
> >
> > Thanks!
> >
> >
> > On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma 
> > wrote:
> >
> > > To be honest, I haven't investigated in detail the reason for the
> > > difference in throughput in the performance test.
> > >
> > > Are you measuring the performance of your application container, and
> can
> > > you see an improvement when using Async Loggers?
> > > Do you see a large difference in performance _in your application_
> > between
> > > making all loggers Asynchronous and using mixed synchronous and
> > > Asynchronous loggers?
> > >
> > >
> > > On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> > > mariano.l.gonza...@gmail.com> wrote:
> > >
> > > > Hello Remko,
> > > >
> > > > Thanks for the insight. I guess my case falls into the wrong end of
> the
> > > > pareto law. My project is a low latency application container, so I
> > need
> > > to
> > > > have:
> > > >
> > > >
> > > >- low latency
> > > >- log separation (I actually had to implement my own context
> > selector
> > > >because my logic is more complicated than the standard
> > > >ClassLoaderContextSelector case)
> > > >- I want async loggers by default, but deployed apps need to be
> able
> > > to
> > > >specify sync loggers
> > > >
> > > >
> > > > Right now I'm kinda meeting those requirements using config file,
> > > AsyncRoot
> > > > and my custom selector, but it'd be really great to achieve a
> > performance
> > > > level like the one that AsyncContextSelector promises.
> > > >
> > > > Is there a way of doing that? For what I see on the code, the
> > > > AsyncLoggerContextSelector's secret sauce is just to always return an
> > > > AsyncLogger on the newInstance() method. Why is that so much faster
> > than
> > > > what ClassLoaderLoggerContextSelector does?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > On Fri, Jul 18, 2014 at 1:20 PM, Remko Popma 
> > > > wrote:
> > > >
> > > > > The Async Loggers created with the context selector have a slightly
> > > > > different mechanism. One of the differences is that LogEvent
> objects
> > > are
> > > > > re-used.
> > > > >
> > > > > However, unless your application is in the low-latency space, I
> would
> > > not
> > > > > worry too much about the performance difference. Both flavors of
> > Async
> > > > > Loggers are much faster than the alternative (Async Appenders).
> > > > >
> > > > > Your point is valid though. I've been thinking about an alternative
> > way
> > > > to
> > > > > configure Async Loggers than via system properties. The work in
> > > p

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Mariano Gonzalez
Hello Remko,

I'm still a couple of days away from starting my own performance testing.
I'm taking about the difference in the async loggers manual page, more
specifically, the charts that compare sync loggers, to mixed async loggers
against purely async loggers. Since I need to build my own selector, I'm
trying to be clear on how this works internally in order to implement the
less latency possible selector and try to minimize the performance testing
effort.

Thanks for the clarifications!



On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma  wrote:

> Hi,
> No that is incorrect.
> If you do not specify AsyncLoggerContextSelector but instead configure with
>  and  loggers, you _do_ need the disruptor jar on
> the classpath and this does _not_ use AsyncAppender. AsyncAppender is
> completely separate from Async Loggers. Async Loggers (mixed or all async)
> use the disruptor and both need the disruptor jar.
>
> You keep mentioning a performance difference. I was assuming you were
> talking about the performance test results mentioned on the Async Logger
> manual page, but perhaps I was wrong? Are you experiencing a performance
> difference between the two flavors of Async Loggers in your application?
>
>
>
>
> On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
> mariano.l.gonza...@gmail.com> wrote:
>
> > Hello Remko,
> >
> > I think I found the difference. AsyncLoggerContextSelector always returns
> > the same instance of AsyncLoggerContext, which in turns always returns
> > instances of AsyncLogger, which uses disruptor to handle concurrency.
> >
> > However, with any other selector, a standard Logger instance is returned
> > and parallelism is achieved through an AsyncAppender. AsyncAppender use a
> > standard blocking queue instead of using disruptor which explains the
> > performance difference (there's also the fact that
> > AsyncLoggerContextSelector always returns the same context instance and
> > does not spend cycles in the lookup, but I think that is not a
> significant
> > cost once everything was warmed out).
> >
> > http://logging.apache.org/log4j/2.x/manual/async.html says that when
> using
> > mixed type loggers disruptor is needed on the classpath. That seems to be
> > an error. For what I see disruptor is only used when setting all loggers
> > asynchronous.
> >
> > Does this make sense? Anyway around this? Do you have a disruptor
> appender
> > somewhere?
> >
> > Thanks!
> >
> >
> > On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma 
> > wrote:
> >
> > > To be honest, I haven't investigated in detail the reason for the
> > > difference in throughput in the performance test.
> > >
> > > Are you measuring the performance of your application container, and
> can
> > > you see an improvement when using Async Loggers?
> > > Do you see a large difference in performance _in your application_
> > between
> > > making all loggers Asynchronous and using mixed synchronous and
> > > Asynchronous loggers?
> > >
> > >
> > > On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> > > mariano.l.gonza...@gmail.com> wrote:
> > >
> > > > Hello Remko,
> > > >
> > > > Thanks for the insight. I guess my case falls into the wrong end of
> the
> > > > pareto law. My project is a low latency application container, so I
> > need
> > > to
> > > > have:
> > > >
> > > >
> > > >- low latency
> > > >- log separation (I actually had to implement my own context
> > selector
> > > >because my logic is more complicated than the standard
> > > >ClassLoaderContextSelector case)
> > > >- I want async loggers by default, but deployed apps need to be
> able
> > > to
> > > >specify sync loggers
> > > >
> > > >
> > > > Right now I'm kinda meeting those requirements using config file,
> > > AsyncRoot
> > > > and my custom selector, but it'd be really great to achieve a
> > performance
> > > > level like the one that AsyncContextSelector promises.
> > > >
> > > > Is there a way of doing that? For what I see on the code, the
> > > > AsyncLoggerContextSelector's secret sauce is just to always return an
> > > > AsyncLogger on the newInstance() method. Why is that so much faster
> > than
> > > > what ClassLoaderLoggerContextSelector does?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > On Fri, Jul 18, 2014 at 1:20 PM, Remko Popma 
> > > > wrote:
> > > >
> > > > > The Async Loggers created with the context selector have a slightly
> > > > > different mechanism. One of the differences is that LogEvent
> objects
> > > are
> > > > > re-used.
> > > > >
> > > > > However, unless your application is in the low-latency space, I
> would
> > > not
> > > > > worry too much about the performance difference. Both flavors of
> > Async
> > > > > Loggers are much faster than the alternative (Async Appenders).
> > > > >
> > > > > Your point is valid though. I've been thinking about an alternative
> > way
> > > > to
> > > > > configure Async Loggers than via system properties. The work in
> > > progress
> > > > is
> > > > > tracked in Jira 

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Matt Sicker
Well, the way to go that's similar to the async version is to use the
BasicContextSelector which contains a singleton LoggerContext. Otherwise,
you'll have to keep your own registry that can be looked up dynamically
such as through reflection of the caller stack and other fun design
problems. :)


On 21 July 2014 09:35, Mariano Gonzalez 
wrote:

> Hello Remko,
>
> I'm still a couple of days away from starting my own performance testing.
> I'm taking about the difference in the async loggers manual page, more
> specifically, the charts that compare sync loggers, to mixed async loggers
> against purely async loggers. Since I need to build my own selector, I'm
> trying to be clear on how this works internally in order to implement the
> less latency possible selector and try to minimize the performance testing
> effort.
>
> Thanks for the clarifications!
>
>
>
> On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma 
> wrote:
>
> > Hi,
> > No that is incorrect.
> > If you do not specify AsyncLoggerContextSelector but instead configure
> with
> >  and  loggers, you _do_ need the disruptor jar on
> > the classpath and this does _not_ use AsyncAppender. AsyncAppender is
> > completely separate from Async Loggers. Async Loggers (mixed or all
> async)
> > use the disruptor and both need the disruptor jar.
> >
> > You keep mentioning a performance difference. I was assuming you were
> > talking about the performance test results mentioned on the Async Logger
> > manual page, but perhaps I was wrong? Are you experiencing a performance
> > difference between the two flavors of Async Loggers in your application?
> >
> >
> >
> >
> > On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
> > mariano.l.gonza...@gmail.com> wrote:
> >
> > > Hello Remko,
> > >
> > > I think I found the difference. AsyncLoggerContextSelector always
> returns
> > > the same instance of AsyncLoggerContext, which in turns always returns
> > > instances of AsyncLogger, which uses disruptor to handle concurrency.
> > >
> > > However, with any other selector, a standard Logger instance is
> returned
> > > and parallelism is achieved through an AsyncAppender. AsyncAppender
> use a
> > > standard blocking queue instead of using disruptor which explains the
> > > performance difference (there's also the fact that
> > > AsyncLoggerContextSelector always returns the same context instance and
> > > does not spend cycles in the lookup, but I think that is not a
> > significant
> > > cost once everything was warmed out).
> > >
> > > http://logging.apache.org/log4j/2.x/manual/async.html says that when
> > using
> > > mixed type loggers disruptor is needed on the classpath. That seems to
> be
> > > an error. For what I see disruptor is only used when setting all
> loggers
> > > asynchronous.
> > >
> > > Does this make sense? Anyway around this? Do you have a disruptor
> > appender
> > > somewhere?
> > >
> > > Thanks!
> > >
> > >
> > > On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma 
> > > wrote:
> > >
> > > > To be honest, I haven't investigated in detail the reason for the
> > > > difference in throughput in the performance test.
> > > >
> > > > Are you measuring the performance of your application container, and
> > can
> > > > you see an improvement when using Async Loggers?
> > > > Do you see a large difference in performance _in your application_
> > > between
> > > > making all loggers Asynchronous and using mixed synchronous and
> > > > Asynchronous loggers?
> > > >
> > > >
> > > > On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> > > > mariano.l.gonza...@gmail.com> wrote:
> > > >
> > > > > Hello Remko,
> > > > >
> > > > > Thanks for the insight. I guess my case falls into the wrong end of
> > the
> > > > > pareto law. My project is a low latency application container, so I
> > > need
> > > > to
> > > > > have:
> > > > >
> > > > >
> > > > >- low latency
> > > > >- log separation (I actually had to implement my own context
> > > selector
> > > > >because my logic is more complicated than the standard
> > > > >ClassLoaderContextSelector case)
> > > > >- I want async loggers by default, but deployed apps need to be
> > able
> > > > to
> > > > >specify sync loggers
> > > > >
> > > > >
> > > > > Right now I'm kinda meeting those requirements using config file,
> > > > AsyncRoot
> > > > > and my custom selector, but it'd be really great to achieve a
> > > performance
> > > > > level like the one that AsyncContextSelector promises.
> > > > >
> > > > > Is there a way of doing that? For what I see on the code, the
> > > > > AsyncLoggerContextSelector's secret sauce is just to always return
> an
> > > > > AsyncLogger on the newInstance() method. Why is that so much faster
> > > than
> > > > > what ClassLoaderLoggerContextSelector does?
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > > On Fri, Jul 18, 2014 at 1:20 PM, Remko Popma <
> remko.po...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > The Async Loggers created with the context s

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Remko Popma
Matt, not sure what you mean. Mariano needs to develop his own
ContextSelector to achieve log separation.
So he cannot use the AsyncLoggerContextSelector.

Mariano, I would not be overly concerned with the performance results
mentioned on the async logger manual page. Bear in mind that in that
performance test, _all_ that the program does is logging. In the real world
(your application) that will obviously not be true: your application will
do many other things.

Also, mixed async loggers performed much, much better than AsyncAppenders.

So, unless you have actual measurement numbers for _your_ application, not
the theoretical numbers from the async logger manual page, I would keep it
simple at first, just get your custom selector to work well, and then start
measuring performance.

If you are getting strange results, like AsyncAppenders performing better
than AsyncLoggers, then let us know and we'll try to help figure out what
the problem is.



On Mon, Jul 21, 2014 at 11:38 PM, Matt Sicker  wrote:

> Well, the way to go that's similar to the async version is to use the
> BasicContextSelector which contains a singleton LoggerContext. Otherwise,
> you'll have to keep your own registry that can be looked up dynamically
> such as through reflection of the caller stack and other fun design
> problems. :)
>
>
> On 21 July 2014 09:35, Mariano Gonzalez 
> wrote:
>
> > Hello Remko,
> >
> > I'm still a couple of days away from starting my own performance testing.
> > I'm taking about the difference in the async loggers manual page, more
> > specifically, the charts that compare sync loggers, to mixed async
> loggers
> > against purely async loggers. Since I need to build my own selector, I'm
> > trying to be clear on how this works internally in order to implement the
> > less latency possible selector and try to minimize the performance
> testing
> > effort.
> >
> > Thanks for the clarifications!
> >
> >
> >
> > On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma 
> > wrote:
> >
> > > Hi,
> > > No that is incorrect.
> > > If you do not specify AsyncLoggerContextSelector but instead configure
> > with
> > >  and  loggers, you _do_ need the disruptor jar
> on
> > > the classpath and this does _not_ use AsyncAppender. AsyncAppender is
> > > completely separate from Async Loggers. Async Loggers (mixed or all
> > async)
> > > use the disruptor and both need the disruptor jar.
> > >
> > > You keep mentioning a performance difference. I was assuming you were
> > > talking about the performance test results mentioned on the Async
> Logger
> > > manual page, but perhaps I was wrong? Are you experiencing a
> performance
> > > difference between the two flavors of Async Loggers in your
> application?
> > >
> > >
> > >
> > >
> > > On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
> > > mariano.l.gonza...@gmail.com> wrote:
> > >
> > > > Hello Remko,
> > > >
> > > > I think I found the difference. AsyncLoggerContextSelector always
> > returns
> > > > the same instance of AsyncLoggerContext, which in turns always
> returns
> > > > instances of AsyncLogger, which uses disruptor to handle concurrency.
> > > >
> > > > However, with any other selector, a standard Logger instance is
> > returned
> > > > and parallelism is achieved through an AsyncAppender. AsyncAppender
> > use a
> > > > standard blocking queue instead of using disruptor which explains the
> > > > performance difference (there's also the fact that
> > > > AsyncLoggerContextSelector always returns the same context instance
> and
> > > > does not spend cycles in the lookup, but I think that is not a
> > > significant
> > > > cost once everything was warmed out).
> > > >
> > > > http://logging.apache.org/log4j/2.x/manual/async.html says that when
> > > using
> > > > mixed type loggers disruptor is needed on the classpath. That seems
> to
> > be
> > > > an error. For what I see disruptor is only used when setting all
> > loggers
> > > > asynchronous.
> > > >
> > > > Does this make sense? Anyway around this? Do you have a disruptor
> > > appender
> > > > somewhere?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma  >
> > > > wrote:
> > > >
> > > > > To be honest, I haven't investigated in detail the reason for the
> > > > > difference in throughput in the performance test.
> > > > >
> > > > > Are you measuring the performance of your application container,
> and
> > > can
> > > > > you see an improvement when using Async Loggers?
> > > > > Do you see a large difference in performance _in your application_
> > > > between
> > > > > making all loggers Asynchronous and using mixed synchronous and
> > > > > Asynchronous loggers?
> > > > >
> > > > >
> > > > > On Sun, Jul 20, 2014 at 7:45 AM, Mariano Gonzalez <
> > > > > mariano.l.gonza...@gmail.com> wrote:
> > > > >
> > > > > > Hello Remko,
> > > > > >
> > > > > > Thanks for the insight. I guess my case falls into the wrong end
> of
> > > the
> > > > > > pareto law. My project is a low

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Remko Popma
Mariano, to clarify, I would recommend that you keep your custom context
selector simple and only use it for the log separation that you mentioned.
I would not recommend that you also somehow try to merge the functionality
of AsyncLoggerContextSelector in your context selector. From a performance
perspective that should not be necessary. If you use  and
 in your configuration then I doubt that logging will be a
performance bottleneck.


On Mon, Jul 21, 2014 at 11:47 PM, Remko Popma  wrote:

> Matt, not sure what you mean. Mariano needs to develop his own
> ContextSelector to achieve log separation.
> So he cannot use the AsyncLoggerContextSelector.
>
> Mariano, I would not be overly concerned with the performance results
> mentioned on the async logger manual page. Bear in mind that in that
> performance test, _all_ that the program does is logging. In the real world
> (your application) that will obviously not be true: your application will
> do many other things.
>
> Also, mixed async loggers performed much, much better than AsyncAppenders.
>
> So, unless you have actual measurement numbers for _your_ application, not
> the theoretical numbers from the async logger manual page, I would keep it
> simple at first, just get your custom selector to work well, and then start
> measuring performance.
>
> If you are getting strange results, like AsyncAppenders performing better
> than AsyncLoggers, then let us know and we'll try to help figure out what
> the problem is.
>
>
>
> On Mon, Jul 21, 2014 at 11:38 PM, Matt Sicker  wrote:
>
>> Well, the way to go that's similar to the async version is to use the
>> BasicContextSelector which contains a singleton LoggerContext. Otherwise,
>> you'll have to keep your own registry that can be looked up dynamically
>> such as through reflection of the caller stack and other fun design
>> problems. :)
>>
>>
>> On 21 July 2014 09:35, Mariano Gonzalez 
>> wrote:
>>
>> > Hello Remko,
>> >
>> > I'm still a couple of days away from starting my own performance
>> testing.
>> > I'm taking about the difference in the async loggers manual page, more
>> > specifically, the charts that compare sync loggers, to mixed async
>> loggers
>> > against purely async loggers. Since I need to build my own selector, I'm
>> > trying to be clear on how this works internally in order to implement
>> the
>> > less latency possible selector and try to minimize the performance
>> testing
>> > effort.
>> >
>> > Thanks for the clarifications!
>> >
>> >
>> >
>> > On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma 
>> > wrote:
>> >
>> > > Hi,
>> > > No that is incorrect.
>> > > If you do not specify AsyncLoggerContextSelector but instead configure
>> > with
>> > >  and  loggers, you _do_ need the disruptor
>> jar on
>> > > the classpath and this does _not_ use AsyncAppender. AsyncAppender is
>> > > completely separate from Async Loggers. Async Loggers (mixed or all
>> > async)
>> > > use the disruptor and both need the disruptor jar.
>> > >
>> > > You keep mentioning a performance difference. I was assuming you were
>> > > talking about the performance test results mentioned on the Async
>> Logger
>> > > manual page, but perhaps I was wrong? Are you experiencing a
>> performance
>> > > difference between the two flavors of Async Loggers in your
>> application?
>> > >
>> > >
>> > >
>> > >
>> > > On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
>> > > mariano.l.gonza...@gmail.com> wrote:
>> > >
>> > > > Hello Remko,
>> > > >
>> > > > I think I found the difference. AsyncLoggerContextSelector always
>> > returns
>> > > > the same instance of AsyncLoggerContext, which in turns always
>> returns
>> > > > instances of AsyncLogger, which uses disruptor to handle
>> concurrency.
>> > > >
>> > > > However, with any other selector, a standard Logger instance is
>> > returned
>> > > > and parallelism is achieved through an AsyncAppender. AsyncAppender
>> > use a
>> > > > standard blocking queue instead of using disruptor which explains
>> the
>> > > > performance difference (there's also the fact that
>> > > > AsyncLoggerContextSelector always returns the same context instance
>> and
>> > > > does not spend cycles in the lookup, but I think that is not a
>> > > significant
>> > > > cost once everything was warmed out).
>> > > >
>> > > > http://logging.apache.org/log4j/2.x/manual/async.html says that
>> when
>> > > using
>> > > > mixed type loggers disruptor is needed on the classpath. That seems
>> to
>> > be
>> > > > an error. For what I see disruptor is only used when setting all
>> > loggers
>> > > > asynchronous.
>> > > >
>> > > > Does this make sense? Anyway around this? Do you have a disruptor
>> > > appender
>> > > > somewhere?
>> > > >
>> > > > Thanks!
>> > > >
>> > > >
>> > > > On Sat, Jul 19, 2014 at 11:55 PM, Remko Popma <
>> remko.po...@gmail.com>
>> > > > wrote:
>> > > >
>> > > > > To be honest, I haven't investigated in detail the reason for the
>> > > > > difference in throughput in the performance tes

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Mariano Gonzalez
Thanks Remko and Matt for your comments.

I will take your suggestions and let you know how it goes.

Just out of curiosity (I don't like to use libraries blindly and way too
curious), where are the loggers instantiated/configured?? I followed the
code of XmlConfiguration but it seems to only parse configuration items, I
couldn't find where it parses and configures the loggers. I admit I didn't
look that hard, but if you could provide a pointer to better understand how
this all works that'd be great.

Thanks!


On Mon, Jul 21, 2014 at 12:12 PM, Remko Popma  wrote:

> Mariano, to clarify, I would recommend that you keep your custom context
> selector simple and only use it for the log separation that you mentioned.
> I would not recommend that you also somehow try to merge the functionality
> of AsyncLoggerContextSelector in your context selector. From a performance
> perspective that should not be necessary. If you use  and
>  in your configuration then I doubt that logging will be a
> performance bottleneck.
>
>
> On Mon, Jul 21, 2014 at 11:47 PM, Remko Popma 
> wrote:
>
> > Matt, not sure what you mean. Mariano needs to develop his own
> > ContextSelector to achieve log separation.
> > So he cannot use the AsyncLoggerContextSelector.
> >
> > Mariano, I would not be overly concerned with the performance results
> > mentioned on the async logger manual page. Bear in mind that in that
> > performance test, _all_ that the program does is logging. In the real
> world
> > (your application) that will obviously not be true: your application will
> > do many other things.
> >
> > Also, mixed async loggers performed much, much better than
> AsyncAppenders.
> >
> > So, unless you have actual measurement numbers for _your_ application,
> not
> > the theoretical numbers from the async logger manual page, I would keep
> it
> > simple at first, just get your custom selector to work well, and then
> start
> > measuring performance.
> >
> > If you are getting strange results, like AsyncAppenders performing better
> > than AsyncLoggers, then let us know and we'll try to help figure out what
> > the problem is.
> >
> >
> >
> > On Mon, Jul 21, 2014 at 11:38 PM, Matt Sicker  wrote:
> >
> >> Well, the way to go that's similar to the async version is to use the
> >> BasicContextSelector which contains a singleton LoggerContext.
> Otherwise,
> >> you'll have to keep your own registry that can be looked up dynamically
> >> such as through reflection of the caller stack and other fun design
> >> problems. :)
> >>
> >>
> >> On 21 July 2014 09:35, Mariano Gonzalez 
> >> wrote:
> >>
> >> > Hello Remko,
> >> >
> >> > I'm still a couple of days away from starting my own performance
> >> testing.
> >> > I'm taking about the difference in the async loggers manual page, more
> >> > specifically, the charts that compare sync loggers, to mixed async
> >> loggers
> >> > against purely async loggers. Since I need to build my own selector,
> I'm
> >> > trying to be clear on how this works internally in order to implement
> >> the
> >> > less latency possible selector and try to minimize the performance
> >> testing
> >> > effort.
> >> >
> >> > Thanks for the clarifications!
> >> >
> >> >
> >> >
> >> > On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma 
> >> > wrote:
> >> >
> >> > > Hi,
> >> > > No that is incorrect.
> >> > > If you do not specify AsyncLoggerContextSelector but instead
> configure
> >> > with
> >> > >  and  loggers, you _do_ need the disruptor
> >> jar on
> >> > > the classpath and this does _not_ use AsyncAppender. AsyncAppender
> is
> >> > > completely separate from Async Loggers. Async Loggers (mixed or all
> >> > async)
> >> > > use the disruptor and both need the disruptor jar.
> >> > >
> >> > > You keep mentioning a performance difference. I was assuming you
> were
> >> > > talking about the performance test results mentioned on the Async
> >> Logger
> >> > > manual page, but perhaps I was wrong? Are you experiencing a
> >> performance
> >> > > difference between the two flavors of Async Loggers in your
> >> application?
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
> >> > > mariano.l.gonza...@gmail.com> wrote:
> >> > >
> >> > > > Hello Remko,
> >> > > >
> >> > > > I think I found the difference. AsyncLoggerContextSelector always
> >> > returns
> >> > > > the same instance of AsyncLoggerContext, which in turns always
> >> returns
> >> > > > instances of AsyncLogger, which uses disruptor to handle
> >> concurrency.
> >> > > >
> >> > > > However, with any other selector, a standard Logger instance is
> >> > returned
> >> > > > and parallelism is achieved through an AsyncAppender.
> AsyncAppender
> >> > use a
> >> > > > standard blocking queue instead of using disruptor which explains
> >> the
> >> > > > performance difference (there's also the fact that
> >> > > > AsyncLoggerContextSelector always returns the same context
> instance
> >> and
> >> > > > does not spend cycles i

Re: why is AsyncLoggerContextSelector faster?

2014-07-21 Thread Ralph Goers
Take a look at http://logging.apache.org/log4j/2.x/manual/architecture.html.   
The configuration creates the LoggerConfig objects, not the Loggers. Loggers 
are created by applications and associated with LoggerConfigs. 

XMLConfiguration and JSONConfiguration are responsible for parsing their 
respective configuration files and then turning them into a tree of Node 
objects. AbstractConfiguration then converts the tree into the actual objects 
using the Plugin mechanism.

Ralph


On Jul 21, 2014, at 8:41 AM, Mariano Gonzalez  
wrote:

> Thanks Remko and Matt for your comments.
> 
> I will take your suggestions and let you know how it goes.
> 
> Just out of curiosity (I don't like to use libraries blindly and way too
> curious), where are the loggers instantiated/configured?? I followed the
> code of XmlConfiguration but it seems to only parse configuration items, I
> couldn't find where it parses and configures the loggers. I admit I didn't
> look that hard, but if you could provide a pointer to better understand how
> this all works that'd be great.
> 
> Thanks!
> 
> 
> On Mon, Jul 21, 2014 at 12:12 PM, Remko Popma  wrote:
> 
>> Mariano, to clarify, I would recommend that you keep your custom context
>> selector simple and only use it for the log separation that you mentioned.
>> I would not recommend that you also somehow try to merge the functionality
>> of AsyncLoggerContextSelector in your context selector. From a performance
>> perspective that should not be necessary. If you use  and
>>  in your configuration then I doubt that logging will be a
>> performance bottleneck.
>> 
>> 
>> On Mon, Jul 21, 2014 at 11:47 PM, Remko Popma 
>> wrote:
>> 
>>> Matt, not sure what you mean. Mariano needs to develop his own
>>> ContextSelector to achieve log separation.
>>> So he cannot use the AsyncLoggerContextSelector.
>>> 
>>> Mariano, I would not be overly concerned with the performance results
>>> mentioned on the async logger manual page. Bear in mind that in that
>>> performance test, _all_ that the program does is logging. In the real
>> world
>>> (your application) that will obviously not be true: your application will
>>> do many other things.
>>> 
>>> Also, mixed async loggers performed much, much better than
>> AsyncAppenders.
>>> 
>>> So, unless you have actual measurement numbers for _your_ application,
>> not
>>> the theoretical numbers from the async logger manual page, I would keep
>> it
>>> simple at first, just get your custom selector to work well, and then
>> start
>>> measuring performance.
>>> 
>>> If you are getting strange results, like AsyncAppenders performing better
>>> than AsyncLoggers, then let us know and we'll try to help figure out what
>>> the problem is.
>>> 
>>> 
>>> 
>>> On Mon, Jul 21, 2014 at 11:38 PM, Matt Sicker  wrote:
>>> 
 Well, the way to go that's similar to the async version is to use the
 BasicContextSelector which contains a singleton LoggerContext.
>> Otherwise,
 you'll have to keep your own registry that can be looked up dynamically
 such as through reflection of the caller stack and other fun design
 problems. :)
 
 
 On 21 July 2014 09:35, Mariano Gonzalez 
 wrote:
 
> Hello Remko,
> 
> I'm still a couple of days away from starting my own performance
 testing.
> I'm taking about the difference in the async loggers manual page, more
> specifically, the charts that compare sync loggers, to mixed async
 loggers
> against purely async loggers. Since I need to build my own selector,
>> I'm
> trying to be clear on how this works internally in order to implement
 the
> less latency possible selector and try to minimize the performance
 testing
> effort.
> 
> Thanks for the clarifications!
> 
> 
> 
> On Mon, Jul 21, 2014 at 11:22 AM, Remko Popma 
> wrote:
> 
>> Hi,
>> No that is incorrect.
>> If you do not specify AsyncLoggerContextSelector but instead
>> configure
> with
>>  and  loggers, you _do_ need the disruptor
 jar on
>> the classpath and this does _not_ use AsyncAppender. AsyncAppender
>> is
>> completely separate from Async Loggers. Async Loggers (mixed or all
> async)
>> use the disruptor and both need the disruptor jar.
>> 
>> You keep mentioning a performance difference. I was assuming you
>> were
>> talking about the performance test results mentioned on the Async
 Logger
>> manual page, but perhaps I was wrong? Are you experiencing a
 performance
>> difference between the two flavors of Async Loggers in your
 application?
>> 
>> 
>> 
>> 
>> On Mon, Jul 21, 2014 at 11:10 PM, Mariano Gonzalez <
>> mariano.l.gonza...@gmail.com> wrote:
>> 
>>> Hello Remko,
>>> 
>>> I think I found the difference. AsyncLoggerContextSelector always
> returns
>>> the same instance of AsyncLoggerContext, which in turns always
 returns