That's great! Thank you for your help Ralph!

On Thu, Feb 4, 2016 at 11:57 PM, Gary Gregory <[email protected]>
wrote:

> On Thu, Feb 4, 2016 at 10:37 AM, Ralph Goers <[email protected]>
> wrote:
>
> > Added to what? The Configuration? I don’t think that is appropriate.
> >
>
> That's fine, I was just curious.
>
> Gary
>
>
> >
> > Ralph
> >
> > > On Feb 4, 2016, at 11:29 AM, Gary Gregory <[email protected]>
> > wrote:
> > >
> > > Would a getManager() shortcut API be helpful?
> > >
> > > Gary
> > >
> > > On Thu, Feb 4, 2016 at 9:16 AM, Ralph Goers <
> [email protected]>
> > > wrote:
> > >
> > >> Once the Configuration is created your can call
> > getAppender(appenderName)
> > >> to get the RollingFileAppender. Once you have that just call the
> > >> getManager() method.
> > >>
> > >> Ralph
> > >>
> > >>
> > >>> On Feb 4, 2016, at 10:03 AM, Apostolis Giannakidis <
> > >> [email protected]> wrote:
> > >>>
> > >>> Hello Ralph,
> > >>>
> > >>> I like the idea of using the RollingFileManager to directly force a
> > >>> Rollover.
> > >>>
> > >>> I am creating my logger and the RollingFileAppender according to your
> > >>> instructions as shown here:
> > >>>
> > >>
> >
> http://stackoverflow.com/questions/34904304/how-to-properly-create-a-rollingfileappender-with-appendercomponentbuilder-in-lo
> > >>>
> > >>> It is not clear to me how I can get access to the RollingFileManager
> > from
> > >>> that setup. Is there a method call that returns the
> RollingFileManager?
> > >>>
> > >>> Apos
> > >>>
> > >>>
> > >>> On Thu, Feb 4, 2016 at 4:28 PM, Ralph Goers <
> > [email protected]>
> > >>> wrote:
> > >>>
> > >>>> If you are using 2.5 you can use the CronTriggeringPolicy or you can
> > >> call
> > >>>> the RollingFileManager directly to force a Rollover. See LOG4J2-89.
> > >>>>
> > >>>> Ralph
> > >>>>
> > >>>>> On Feb 4, 2016, at 8:14 AM, Apostolis Giannakidis <
> > >>>> [email protected]> wrote:
> > >>>>>
> > >>>>> On a second thought, another possible way would be to extend
> > >>>>> TimeBasedTriggeringPolicy and create my own
> TimeBasedTriggeringPolicy
> > >>>>> pluging for the testing. Does this sound reasonable to you?
> > >>>>>
> > >>>>> On Thu, Feb 4, 2016 at 3:07 PM, Apostolis Giannakidis <
> > >>>>> [email protected]> wrote:
> > >>>>>
> > >>>>>> Hello all,
> > >>>>>>
> > >>>>>> My Logger uses a RollingFileAppender with a
> > TimeBasedTriggeringPolicy.
> > >>>>>>
> > >>>>>> The file pattern is set to:
> > >>>>>> logfile.log.%d{yyyy-MM-dd}
> > >>>>>>
> > >>>>>> I would like to write automated functional tests that use the
> logger
> > >> and
> > >>>>>> verify that the rolling of the file is performed according to the
> > >>>> expected
> > >>>>>> behavior of the TimeBasedTriggeringPolicy.
> > >>>>>>
> > >>>>>> In other words, I'd like to write a system test that does
> something
> > >> like
> > >>>>>> the following:
> > >>>>>> 1) start the system (assuming that the current date is 2016-02-4)
> > >>>>>> 2) log a message. This message will be written to logfile.log.
> > >>>>>> 3) Verify that the message was logged to logfile.log.
> > >>>>>> 4) Force the log file to rotate.
> > >>>>>> 5) Verify that the file logfile.log.2016-02-05 was created with
> the
> > >>>>>> correct contents.
> > >>>>>> 6) log a message. This message will be written to logfile.log.
> > >>>>>> 7) Verify that the message was logged to logfile.log.
> > >>>>>>
> > >>>>>> Is there any way that I could perform step #4?
> > >>>>>>
> > >>>>>> One way that I was thinking of is if I could use my own
> > implementation
> > >>>> of
> > >>>>>> the LogEvent that would return a fake event time for each event.
> > >>>>>>
> > >>>>>> What are your thoughts?
> > >>>>>>
> > >>>>>> Thank you very much.
> > >>>>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: [email protected]
> > >>>> For additional commands, e-mail: [email protected]
> > >>>>
> > >>>>
> > >>
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [email protected]
> > >> For additional commands, e-mail: [email protected]
> > >>
> > >>
> > >
> > >
> > > --
> > > E-Mail: [email protected] | [email protected]
> > > 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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> E-Mail: [email protected] | [email protected]
> 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
>

Reply via email to