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 Emmet Hikory <eh...@mokonet.com> on 2001/08/23 00:35:42 UTC

FileNotFound Exception uncaught

	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.
ehikory@mokonet.com
(212) 269-2398

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