You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Harald Ommang <ha...@delfidata.no> on 2002/03/01 08:02:13 UTC

RE: Use of java.io.File

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: keithnielsen@discoverfinancial.com
[mailto:keithnielsen@discoverfinancial.com]
Sent: 28. februar 2002 20:58
To: log4j-dev@jakarta.apache.org
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
###########################################


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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>