On Tue, Nov 10, 2015 at 6:13 PM, Remko Popma <remko.po...@gmail.com> wrote:

> To check my understanding: the problem is that with bufferedIO=true the
> buffer contains log events that you want to see, but the buffer is only
> flushed to disk when it is full (which is not frequent enough); is that
> correct?
>

Yes that is correct.
Typical scenario is when the server is not in production, so almost no
traffic except for the request manually triggered by the operator, usually
in order to debug something.


> If you use AsyncAppender or Async Loggers, the buffer will be flushed when
> the queue is empty. This results in efficient IO (lumping together IO
> operations where possible), but at the same time your log file always
> reflects the most recent message.
>

So I have a dumb question. What's the difference between bufferedIO and
AsyncAppender?
Isn't bufferedIO a kind of asynchronous treatment of the log messages? I'm
sorry I'm a bit confused.


>
> For synchronous buffered logging, I can see how a smarter flushing
> mechanism would be useful.
>
> Question is, what would trigger the check (whether the buffer needs to be
> flushed)?
>
> Easiest is to check with each log event, but if no new event arrives you
> still end up with a stale buffer. Better than nothing, but not great.
>
> An alternative is to check periodically from a background thread and flush
> if the buffer is non-empty. This probably gives the best results but is
> fairly complex to implement.
>

That was what I had in mind but I don't know the complexity.


>
> I need to think about this a bit more, but for now I would suggest using
> async logging. It may be a good idea to create a Jira ticket for this.
>

OK I will create a Jira for this.


>
> Remko
>
> > On 2015/11/11, at 5:16, Gary Gregory <garydgreg...@gmail.com> wrote:
> >
> > And more generally, can all appenders benefit from such a setting?
> >
> > Gary
> >
> > On Tue, Nov 10, 2015 at 11:04 AM, Benjamin Jaton <
> benjamin.ja...@gmail.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I am wondering if it would make sense to have a maxDelayMillis parameter
> >> for the RollingFileAppender (like FlumeAppender).
> >>
> >> Use case:
> >> You have a web server access log, you produce an HTTP request and
> expect to
> >> see it (and the response) in the access logs right away-ish (or at least
> >> control how much you have to wait).
> >>
> >> Thoughts?
> >> Ben
> >>
> >
> >
> >
> > --
> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> > Java Persistence with Hibernate, Second Edition
> > <http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > Spring Batch in Action <http://www.manning.com/templier/>
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
> ---------------------------------------------------------------------
> 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