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 Taranbir I Singh <ta...@in.ibm.com> on 2005/06/17 09:24:53 UTC
Creating the directory Automatically
HI,
I have defined the log file as "c:\temp\test.log", if the directory
c:\temp is not already existing then its giving me the error... is this
possible to create the directory if it is not there automatically?
Any Solutions?
Re: Creating the directory Automatically
Posted by Curt Arnold <ca...@houston.rr.com>.
If you are only interested in logging to a temporary directory, you
could specify the log file as "${java.io.tmpdir}/test.log" which will
place the log file in the temporary directory (likely /tmp on 'nix
and \Documents and Settings\USERNAME\Temporary Files on Windows).
On Jun 17, 2005, at 2:24 AM, Taranbir I Singh wrote:
> HI,
>
> I have defined the log file as "c:\temp\test.log", if the directory
> c:\temp is not already existing then its giving me the error... is
> this
> possible to create the directory if it is not there automatically?
>
>
> Any Solutions?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Creating the directory Automatically
Posted by Curt Arnold <ca...@apache.org>.
On Jun 17, 2005, at 4:31 PM, Mark Womack wrote:
> I think we should try to create the directory, not even define an
> option.
> If it fails (because it is not allowed), we could catch the
> exception, then
> write out an error message and one is no worse off then if we never
> tried in
> the first place. This just seems basic to me. Jake had to write
> too much
> code in the log4j init servlet code to make sure the directory
> exists before
> initializing a file appender, etc. I'd be willing to fix this as a
> bug in
> 1.2.12.
>
> -Mark
I've reopened the bug and assigned it to Mark. Definitely seems like
something that should be addressed in log4j as either a default or
optional action. It shouldn't be hard to switch it to an optional
action if someone comes up with a good reason why it shouldn't be the
default action.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Creating the directory Automatically
Posted by Mark Womack <wo...@adobe.com>.
I think we should try to create the directory, not even define an option.
If it fails (because it is not allowed), we could catch the exception, then
write out an error message and one is no worse off then if we never tried in
the first place. This just seems basic to me. Jake had to write too much
code in the log4j init servlet code to make sure the directory exists before
initializing a file appender, etc. I'd be willing to fix this as a bug in
1.2.12.
-Mark
> -----Original Message-----
> From: Curt Arnold [mailto:carnold@apache.org]
> Sent: Friday, June 17, 2005 2:23 PM
> To: Log4J Users List
> Subject: Re: Creating the directory Automatically
>
> See http://issues.apache.org/bugzilla/show_bug.cgi?id=9150.
>
> There appear to be valid reasons why could be undesirable for an
> appender to create directories if they are not available. However,
> it may be desirable to provide an option that would allow you to
> specify that you want the appender to try.
>
> On Jun 17, 2005, at 2:24 AM, Taranbir I Singh wrote:
>
> > HI,
> >
> > I have defined the log file as "c:\temp\test.log", if the directory
> > c:\temp is not already existing then its giving me the error... is
> > this
> > possible to create the directory if it is not there automatically?
> >
> >
> > Any Solutions?
> >
>
>
> ---------------------------------------------------------------------
> 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: Creating the directory Automatically
Posted by Curt Arnold <ca...@apache.org>.
See http://issues.apache.org/bugzilla/show_bug.cgi?id=9150.
There appear to be valid reasons why could be undesirable for an
appender to create directories if they are not available. However,
it may be desirable to provide an option that would allow you to
specify that you want the appender to try.
On Jun 17, 2005, at 2:24 AM, Taranbir I Singh wrote:
> HI,
>
> I have defined the log file as "c:\temp\test.log", if the directory
> c:\temp is not already existing then its giving me the error... is
> this
> possible to create the directory if it is not there automatically?
>
>
> Any Solutions?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org