Hi

I'm trying to apply log4j in a J2EE environment and I'm hitting a wall.

I want to use configureAndWatch feature in my application. However, it seems 
configureAndWatch uses the FileWatchdog class which depends on using a java.io.File  
instance for the configuration file in order to detect changes to the configuration 
file.

EJB containers aren't allowed to read/write files or directories in the file system. 
And if they do, the files you can read/write might not reside where you thought they 
would. anyways, that's my experience with weblogic. I'm really looking for location 
independence.

So my feature request is (if possible), to have a watchdog that uses resources(as in 
getResourceAsStream) instead. The way one can detect for changes is to load a 
Properties instance using the InputStream and do a hashcode check on the Properties. 
If the hashcode given is different from last check, the file has changed and the 
property should be reloaded. 
Yes, this is much more expensive than checking the modification time of a file. But in 
a server environment where uptime is critical and the configuration is only pulled 
let's say every 30 minutes it close to nothing. And it fits in better in the "EJB 
world" (if there is such a thing).

I searched the archives, but didn't see any previous discussion on this.
Is this possbible or are there issues with this approach. One possible issue I though 
of is Properties hashcode implementation might depend on the iteration order of the 
hashtable. If the iteration order is not guaranteed between invocations then you might 
get a different hashcode for every time. I did some simple testing but didn't find any 
evidence of this. Nor have a looked at sun's java source to check for this.

Comments?

sincerely,
Henrik Bentel

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

Reply via email to