Hello!

You can do something like this:

        url = getClass().getClassLoader().getResource( "/log4jconfig.xml" );
        DOMConfigurator.configure( url );

or

        url = getClass().getClassLoader().getResource( "/log4jconfig.conf"
);
        PropertyConfigurator.configure( url );


Harald

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: 28. februar 2002 20:58
To: [EMAIL PROTECTED]
Subject: Use of java.io.File


I am trying to use log4j within my application which among other things
consists of Session Beans.

Reading the EJB spec (1.1) states that

"Most servers do not allow direct interaction between an application
program and a keyboard/display
attached to the server system.
     An enterprise bean must not use the java.io package to attempt to
   access files and directories
     in the file system."

The PropertyWatchDog attempts to open a file to the specified configuration
file with File aFile = new File(configFile);

It seems to me that this is in violation of the spec????

Also it seems that the configFileName must be fully qualified, which is a
hassle when switching platforms. What I would like it to do is to take be
implemented like this:

InputStream istream = getClass().getResourceAsStream("/log4j.conf");

That way the file jsut has to be in the classpath and I don't have to worry
about full paths.

I just joined this list so I apologize if this is a repeat.

Any help is appreciated!

Thanks.

Keith Nielsen




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
###########################################


This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

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

Reply via email to