You could provide a patch that either:

- Deletes empty files on Log4j shutdown. Would this be an option or always
happen?
- Creates files on-demand. Would this be an option or always happen?

Gary

On Wed, Sep 16, 2015 at 11:49 PM, Csilla Fabian <csilla.fab...@sde.cz>
wrote:

>
> I have several appenders set up, I'm getting one file for one appender,
> but some appenders might be unused by the system, that's why there are
> empty log files.
> But I think you answered my question, it's not possible to set up the
> appender in the XML config file to create the log file only in case if
> there's something that needs to be written to it.
>
>
> ----- Original Message -----
> From: "Ralph Goers" <ralph.go...@dslextreme.com>
> To: "log4j-user" <log4j-user@logging.apache.org>
> Sent: Wednesday, September 16, 2015 6:01:55 PM
> Subject: Re: Question - RollingFileAppender creates empty files
>
> The files are created as soon as the output stream is opened. This happens
> when the Appender starts.  I’d have to see your configuration to understand
> why you would be getting multiple files though.
>
> Ralph
>
> > On Sep 16, 2015, at 7:23 AM, Csilla Fabian <csilla.fab...@sde.cz> wrote:
> >
> > Hello,
> >
> >  I'm using log4j2 RollingFileAppenders to log events of a complex
> system. My problem is that empty log files are created for every appender
> even if the given subsystem has nothing to write to them. Is there any way
> to restrict the number of files using just the XML configuration file? I
> could find only programmatic solutions.
> > Thank you for the answer.
> >
> > Regards,
> > Csilla Fabian, SDE
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


-- 
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

Reply via email to