logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harald Ommang <harald.omm...@delfidata.no>
Subject RE: Use of java.io.File
Date Fri, 01 Mar 2002 07:02:13 GMT
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:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@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:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


Mime
View raw message