Using log4j version 1.1.3, I received an uncaught FileNotFoundException
(runtime), that I could not catch, as it was not reported as being
thrown.  As specified at
http://jakarta.apache.org/log4j/docs/FAQ.html#reliable, details are
forwarded to this list.

        A code snippet that illustrates this is below:

//start file
import java.io.*;
import org.apache.log4j.*;

public class CrashLog4j {

    private static Category cat =
        Category.getInstance("com.mokonet.CrashLog4j");

    /** Creates new CrashLog4j */
    public CrashLog4j() {
    }

    /**
    * @param args the command line arguments
    */
    public static void main (String args[]) {
        try {
            PropertyConfigurator.configure(args[0]);
        } catch (ArrayIndexOutOfBoundsException e){
            BasicConfigurator.configure();
            cat.warn("No log config given - " +
                     "Logging to console only");
        }
    }
}
// end file

        If this is passed a single argument which is a valid filename, but the
file does not exist, the exception will be raised.

        The obvious solution seems to be to add another catch clause to handle
this case, but my compiler (Sun jdk1.3.1 on NT 4.0sp6a) complains that
there is no FileNotFoundException available to be caught.

-- 
Emmet Hikory
MokoNet, Inc.
[EMAIL PROTECTED]
(212) 269-2398

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to