Here:

package org.apache.log4j;
public class SmartDailyRollingFileAppender extends
org.apache.log4j.DailyRollingFileAppender {

    public void setFile(String value) throws java.io.IOException {
        // create ness. directories
        java.io.File dir = new java.io.File(value);
        dir = dir.getParentFile();
        if (dir != null && !dir.exists()) {
            if (!dir.mkdirs() && !dir.exists()) {
                org.apache.log4j.helpers.LogLog.error("Couldnt make
directory " + dir + " for file set as " + value);
            }
        }
        super.setFile(value);
    }
}

--------------------------------------------------------------
----- Original Message -----
From: "Mike Papper" <[EMAIL PROTECTED]>
To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, June 26, 2001 1:15 AM
Subject: Gripe about DailyRollingFileAppender


> The class is nice but I wish it would create the neccessary directories
for
> the log files on-the-fly instead of spitting out error messages about the
> directories not existing.
>
> As a result I will subclass this object to do just that.
>
> I realize that some people consider it an error if the directory doesnt
> already exist. My thoughts are that if the dir is created by some outside
> process (i.e., an install script) you've just moved the problem (and
> potential for bugs) outside of your java process somewhere else...and
havent
> really helped developing, maintaining and running your servers.
>
> Just my 2 cents worth...
>
> Mike Papper
>
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to