DefaultRolloverStrategy get Filename

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

DefaultRolloverStrategy get Filename

EDMONDO SENA

Good Morning,

Is there a possibility to get the File name appender with DefaultRolloverStrategy (log4j2)?
I have a class that extends DefaultRolloverStrategy and I have seen that only RollingFileAppender has such a possibility.
How can I get the appender file name from file.properties by DefaultRolloverStrategy?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultRolloverStrategy get Filename

Ralph Goers
I am having difficulty understanding what you are asking. I don’t know what you mean by “File name appender”. Log4j 2 has a FileAppender that accepts a filename parameter and a RollingFileAppender that accepts a fileName and filePattern.  Since a FileAppender doesn’t roll a RolloverStrategy doesn’t make sense for it.

Are you simply asking how to get the file name inside a RolloverStrategy? If that is your question the FileManager is passed to the rollover method and the FileManager has methods to retrieve the file name.

Ralph

> On Jun 25, 2020, at 1:40 AM, EDMONDO SENA <[hidden email]> wrote:
>
>
> Good Morning,
>
> Is there a possibility to get the File name appender with DefaultRolloverStrategy (log4j2)?
> I have a class that extends DefaultRolloverStrategy and I have seen that only RollingFileAppender has such a possibility.
> How can I get the appender file name from file.properties by DefaultRolloverStrategy?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultRolloverStrategy get Filename

EDMONDO SENA
Yes I want it, but this information if I right is present in AppenderComponent and I don't know as get it.
Can you explain me which are the methods?



On 2020/06/25 15:20:05, Ralph Goers <[hidden email]> wrote:

> I am having difficulty understanding what you are asking. I don’t know what you mean by “File name appender”. Log4j 2 has a FileAppender that accepts a filename parameter and a RollingFileAppender that accepts a fileName and filePattern.  Since a FileAppender doesn’t roll a RolloverStrategy doesn’t make sense for it.
>
> Are you simply asking how to get the file name inside a RolloverStrategy? If that is your question the FileManager is passed to the rollover method and the FileManager has methods to retrieve the file name.
>
> Ralph
>
> > On Jun 25, 2020, at 1:40 AM, EDMONDO SENA <[hidden email]> wrote:
> >
> >
> > Good Morning,
> >
> > Is there a possibility to get the File name appender with DefaultRolloverStrategy (log4j2)?
> > I have a class that extends DefaultRolloverStrategy and I have seen that only RollingFileAppender has such a possibility.
> > How can I get the appender file name from file.properties by DefaultRolloverStrategy?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultRolloverStrategy get Filename

EDMONDO SENA
In order to explain better, having inserted some variables into the Strategy, is it possible to somehow take those strategy variables through ad hoc log4j2 methods to see if it matches with the related appender filename ?



On 2020/06/25 15:39:59, EDMONDO SENA <[hidden email]> wrote:

> Yes I want it, but this information if I right is present in AppenderComponent and I don't know as get it.
> Can you explain me which are the methods?
>
>
>
> On 2020/06/25 15:20:05, Ralph Goers <[hidden email]> wrote:
> > I am having difficulty understanding what you are asking. I don’t know what you mean by “File name appender”. Log4j 2 has a FileAppender that accepts a filename parameter and a RollingFileAppender that accepts a fileName and filePattern.  Since a FileAppender doesn’t roll a RolloverStrategy doesn’t make sense for it.
> >
> > Are you simply asking how to get the file name inside a RolloverStrategy? If that is your question the FileManager is passed to the rollover method and the FileManager has methods to retrieve the file name.
> >
> > Ralph
> >
> > > On Jun 25, 2020, at 1:40 AM, EDMONDO SENA <[hidden email]> wrote:
> > >
> > >
> > > Good Morning,
> > >
> > > Is there a possibility to get the File name appender with DefaultRolloverStrategy (log4j2)?
> > > I have a class that extends DefaultRolloverStrategy and I have seen that only RollingFileAppender has such a possibility.
> > > How can I get the appender file name from file.properties by DefaultRolloverStrategy?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultRolloverStrategy get Filename

Ralph Goers
I am afraid you are going to have to provide some sort of example. Ad hoc log4j2 methods could mean anything.

Ralph

> On Jun 26, 2020, at 1:03 AM, EDMONDO SENA <[hidden email]> wrote:
>
> In order to explain better, having inserted some variables into the Strategy, is it possible to somehow take those strategy variables through ad hoc log4j2 methods to see if it matches with the related appender filename ?
>
>
>
> On 2020/06/25 15:39:59, EDMONDO SENA <[hidden email]> wrote:
>> Yes I want it, but this information if I right is present in AppenderComponent and I don't know as get it.
>> Can you explain me which are the methods?
>>
>>
>>
>> On 2020/06/25 15:20:05, Ralph Goers <[hidden email]> wrote:
>>> I am having difficulty understanding what you are asking. I don’t know what you mean by “File name appender”. Log4j 2 has a FileAppender that accepts a filename parameter and a RollingFileAppender that accepts a fileName and filePattern.  Since a FileAppender doesn’t roll a RolloverStrategy doesn’t make sense for it.
>>>
>>> Are you simply asking how to get the file name inside a RolloverStrategy? If that is your question the FileManager is passed to the rollover method and the FileManager has methods to retrieve the file name.
>>>
>>> Ralph
>>>
>>>> On Jun 25, 2020, at 1:40 AM, EDMONDO SENA <[hidden email]> wrote:
>>>>
>>>>
>>>> Good Morning,
>>>>
>>>> Is there a possibility to get the File name appender with DefaultRolloverStrategy (log4j2)?
>>>> I have a class that extends DefaultRolloverStrategy and I have seen that only RollingFileAppender has such a possibility.
>>>> How can I get the appender file name from file.properties by DefaultRolloverStrategy?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]