You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2018/07/14 00:22:19 UTC

[Log4j2] RollingFileAppender ignores immediateFlush

Hi All:

Looks like a bug and not by design in:

org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
String, String, OutputStream, boolean, boolean, long, long,
TriggeringPolicy, RolloverStrategy, String, Layout<? extends Serializable>,
String, String, String, boolean, ByteBuffer)

Note the hard coded false.

Which I will fix unless someone can convince me otherwise.

Gary

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Gary Gregory <ga...@gmail.com>.
It does not seem hard to turn and create a similar test as
FileAppenderTest. Am I missing something?
I am only talking about locking during writing events like for
FileAppender, not during rollover, which would need more locking.

Gary

On Sat, Jul 14, 2018, 13:44 Ralph Goers <ra...@dslextreme.com> wrote:

> Right, we don’t support file locking on the RollingFileManager.
>
> Ralph
>
> > On Jul 14, 2018, at 9:40 AM, Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > On Sat, Jul 14, 2018 at 9:13 AM Gary Gregory <ga...@gmail.com>
> wrote:
> >
> >>
> >>
> >> On Fri, Jul 13, 2018 at 7:53 PM Remko Popma <re...@gmail.com>
> wrote:
> >>
> >>>
> >>>> On Jul 14, 2018, at 10:49, Remko Popma <re...@gmail.com> wrote:
> >>>>
> >>>> Be careful in this area. I remember this was quite tricky!
> >>>>
> >>>> Please step through the code in a debugger to make sure it does what
> >>> you think it does before making changes.
> >>>
> >>> Also maybe start with a failing test case.
> >>> Is there an actual problem or did you just notice that the code looks
> >>> like it won’t work?
> >>>
> >>
> >> Hm, the RollingRandomAccessFileManager is probably correct as is but
> the RollingFileManager
> >> needs careful inspection which I will do.
> >>
> >> I had a  RollingFileAppender that was not behaving as I expected and
> >> that's when I debugged the code and noticed that immeditateFlush was not
> >> passed along.
> >>
> >
> > Never mind, it's the locking attribute that is not passed along to the
> > RollingFileManager and instead is hard-coded to false.
> >
> > Gary
> >
> >>
> >> Gary
> >>
> >>>
> >>>>
> >>>> Remko
> >>>>
> >>>>>> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com>
> >>> wrote:
> >>>>>>
> >>>>>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <
> garydgregory@gmail.com>
> >>> wrote:
> >>>>>>
> >>>>>> Hi All:
> >>>>>>
> >>>>>> Looks like a bug and not by design in:
> >>>>>>
> >>>>>>
> >>>
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
> >>>>>> String, String, OutputStream, boolean, boolean, long, long,
> >>>>>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends
> >>> Serializable>,
> >>>>>> String, String, String, boolean, ByteBuffer)
> >>>>>>
> >>>>>> Note the hard coded false.
> >>>>>>
> >>>>>> Which I will fix unless someone can convince me otherwise.
> >>>>>>
> >>>>>
> >>>>> Same for RollingRandomAccessFileManager.
> >>>>>
> >>>>> Gary
> >>>>>
> >>>>>
> >>>>>>
> >>>>>> Gary
> >>>>>>
> >>>
> >>
>
>
>

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Ralph Goers <ra...@dslextreme.com>.
Right, we don’t support file locking on the RollingFileManager.

Ralph

> On Jul 14, 2018, at 9:40 AM, Gary Gregory <ga...@gmail.com> wrote:
> 
> On Sat, Jul 14, 2018 at 9:13 AM Gary Gregory <ga...@gmail.com> wrote:
> 
>> 
>> 
>> On Fri, Jul 13, 2018 at 7:53 PM Remko Popma <re...@gmail.com> wrote:
>> 
>>> 
>>>> On Jul 14, 2018, at 10:49, Remko Popma <re...@gmail.com> wrote:
>>>> 
>>>> Be careful in this area. I remember this was quite tricky!
>>>> 
>>>> Please step through the code in a debugger to make sure it does what
>>> you think it does before making changes.
>>> 
>>> Also maybe start with a failing test case.
>>> Is there an actual problem or did you just notice that the code looks
>>> like it won’t work?
>>> 
>> 
>> Hm, the RollingRandomAccessFileManager is probably correct as is but the RollingFileManager
>> needs careful inspection which I will do.
>> 
>> I had a  RollingFileAppender that was not behaving as I expected and
>> that's when I debugged the code and noticed that immeditateFlush was not
>> passed along.
>> 
> 
> Never mind, it's the locking attribute that is not passed along to the
> RollingFileManager and instead is hard-coded to false.
> 
> Gary
> 
>> 
>> Gary
>> 
>>> 
>>>> 
>>>> Remko
>>>> 
>>>>>> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>>>> 
>>>>>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>>>> 
>>>>>> Hi All:
>>>>>> 
>>>>>> Looks like a bug and not by design in:
>>>>>> 
>>>>>> 
>>> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
>>>>>> String, String, OutputStream, boolean, boolean, long, long,
>>>>>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends
>>> Serializable>,
>>>>>> String, String, String, boolean, ByteBuffer)
>>>>>> 
>>>>>> Note the hard coded false.
>>>>>> 
>>>>>> Which I will fix unless someone can convince me otherwise.
>>>>>> 
>>>>> 
>>>>> Same for RollingRandomAccessFileManager.
>>>>> 
>>>>> Gary
>>>>> 
>>>>> 
>>>>>> 
>>>>>> Gary
>>>>>> 
>>> 
>> 



Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Gary Gregory <ga...@gmail.com>.
On Sat, Jul 14, 2018 at 9:13 AM Gary Gregory <ga...@gmail.com> wrote:

>
>
> On Fri, Jul 13, 2018 at 7:53 PM Remko Popma <re...@gmail.com> wrote:
>
>>
>> > On Jul 14, 2018, at 10:49, Remko Popma <re...@gmail.com> wrote:
>> >
>> > Be careful in this area. I remember this was quite tricky!
>> >
>> > Please step through the code in a debugger to make sure it does what
>> you think it does before making changes.
>>
>> Also maybe start with a failing test case.
>> Is there an actual problem or did you just notice that the code looks
>> like it won’t work?
>>
>
> Hm, the RollingRandomAccessFileManager is probably correct as is but the RollingFileManager
> needs careful inspection which I will do.
>
> I had a  RollingFileAppender that was not behaving as I expected and
> that's when I debugged the code and noticed that immeditateFlush was not
> passed along.
>

Never mind, it's the locking attribute that is not passed along to the
RollingFileManager and instead is hard-coded to false.

Gary

>
> Gary
>
>>
>> >
>> > Remko
>> >
>> >>> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com>
>> wrote:
>> >>>
>> >>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com>
>> wrote:
>> >>>
>> >>> Hi All:
>> >>>
>> >>> Looks like a bug and not by design in:
>> >>>
>> >>>
>> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
>> >>> String, String, OutputStream, boolean, boolean, long, long,
>> >>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends
>> Serializable>,
>> >>> String, String, String, boolean, ByteBuffer)
>> >>>
>> >>> Note the hard coded false.
>> >>>
>> >>> Which I will fix unless someone can convince me otherwise.
>> >>>
>> >>
>> >> Same for RollingRandomAccessFileManager.
>> >>
>> >> Gary
>> >>
>> >>
>> >>>
>> >>> Gary
>> >>>
>>
>

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Jul 13, 2018 at 7:53 PM Remko Popma <re...@gmail.com> wrote:

>
> > On Jul 14, 2018, at 10:49, Remko Popma <re...@gmail.com> wrote:
> >
> > Be careful in this area. I remember this was quite tricky!
> >
> > Please step through the code in a debugger to make sure it does what you
> think it does before making changes.
>
> Also maybe start with a failing test case.
> Is there an actual problem or did you just notice that the code looks like
> it won’t work?
>

Hm, the RollingRandomAccessFileManager is probably correct as is but
the RollingFileManager
needs careful inspection which I will do.

I had a  RollingFileAppender that was not behaving as I expected and that's
when I debugged the code and noticed that immeditateFlush was not passed
along.

Gary

>
> >
> > Remko
> >
> >>> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com>
> wrote:
> >>>
> >>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com>
> wrote:
> >>>
> >>> Hi All:
> >>>
> >>> Looks like a bug and not by design in:
> >>>
> >>>
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
> >>> String, String, OutputStream, boolean, boolean, long, long,
> >>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends
> Serializable>,
> >>> String, String, String, boolean, ByteBuffer)
> >>>
> >>> Note the hard coded false.
> >>>
> >>> Which I will fix unless someone can convince me otherwise.
> >>>
> >>
> >> Same for RollingRandomAccessFileManager.
> >>
> >> Gary
> >>
> >>
> >>>
> >>> Gary
> >>>
>

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Remko Popma <re...@gmail.com>.
> On Jul 14, 2018, at 10:49, Remko Popma <re...@gmail.com> wrote:
> 
> Be careful in this area. I remember this was quite tricky!
> 
> Please step through the code in a debugger to make sure it does what you think it does before making changes. 

Also maybe start with a failing test case. 
Is there an actual problem or did you just notice that the code looks like it won’t work?

> 
> Remko 
> 
>>> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com> wrote:
>>> 
>>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com> wrote:
>>> 
>>> Hi All:
>>> 
>>> Looks like a bug and not by design in:
>>> 
>>> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
>>> String, String, OutputStream, boolean, boolean, long, long,
>>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends Serializable>,
>>> String, String, String, boolean, ByteBuffer)
>>> 
>>> Note the hard coded false.
>>> 
>>> Which I will fix unless someone can convince me otherwise.
>>> 
>> 
>> Same for RollingRandomAccessFileManager.
>> 
>> Gary
>> 
>> 
>>> 
>>> Gary
>>> 

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Remko Popma <re...@gmail.com>.
Be careful in this area. I remember this was quite tricky!

Please step through the code in a debugger to make sure it does what you think it does before making changes. 

Remko 

> On Jul 14, 2018, at 9:  27, Gary Gregory <ga...@gmail.com> wrote:
> 
>> On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com> wrote:
>> 
>> Hi All:
>> 
>> Looks like a bug and not by design in:
>> 
>> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
>> String, String, OutputStream, boolean, boolean, long, long,
>> TriggeringPolicy, RolloverStrategy, String, Layout<? extends Serializable>,
>> String, String, String, boolean, ByteBuffer)
>> 
>> Note the hard coded false.
>> 
>> Which I will fix unless someone can convince me otherwise.
>> 
> 
> Same for RollingRandomAccessFileManager.
> 
> Gary
> 
> 
>> 
>> Gary
>> 

Re: [Log4j2] RollingFileAppender ignores immediateFlush

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Jul 13, 2018 at 6:22 PM Gary Gregory <ga...@gmail.com> wrote:

> Hi All:
>
> Looks like a bug and not by design in:
>
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManager(LoggerContext,
> String, String, OutputStream, boolean, boolean, long, long,
> TriggeringPolicy, RolloverStrategy, String, Layout<? extends Serializable>,
> String, String, String, boolean, ByteBuffer)
>
> Note the hard coded false.
>
> Which I will fix unless someone can convince me otherwise.
>

Same for RollingRandomAccessFileManager.

Gary


>
> Gary
>