You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by EDMONDO SENA <ed...@gmail.com> on 2020/06/25 08:40:26 UTC

DefaultRolloverStrategy get Filename

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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DefaultRolloverStrategy get Filename

Posted by Ralph Goers <ra...@dslextreme.com>.
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 <ed...@gmail.com> 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 <ed...@gmail.com> 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 <ra...@dslextreme.com> 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 <ed...@gmail.com> 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: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DefaultRolloverStrategy get Filename

Posted by EDMONDO SENA <ed...@gmail.com>.
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 <ed...@gmail.com> 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 <ra...@dslextreme.com> 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 <ed...@gmail.com> 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: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DefaultRolloverStrategy get Filename

Posted by EDMONDO SENA <ed...@gmail.com>.
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 <ra...@dslextreme.com> 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 <ed...@gmail.com> 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: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DefaultRolloverStrategy get Filename

Posted by Ralph Goers <ra...@dslextreme.com>.
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 <ed...@gmail.com> 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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org