At 09:54 PM 6/15/2004 +0100, you wrote:
Hi,
Reading the manual I found the example Initialization servlet. I've tried
to get this working in our app but I'm experiencing problems because
getServletContext().getRealPath("/") returns null (Having spent a while
googling, I think this is because I'm packaging everything in an ear file).
Is there a recommended way of getting round this?
Never use getRealPath(). Use getResource() or getResourceAsStream()
instead. This will work to load your config file whether your app is
packed in an archive or exists on the file system.
Jake
(background):
We want to use JMS for logging under log4j (so that we can use Chainsaw -
with SocketHubAppender we can lock the entire weblogic node if a chainsaw
gui locks up). This was ok until we tried to integrate an external
authentication library with the app, which apparently also uses log4j. The
problem is, this lib gets initialised as a service in weblogic, *before*
the JMS service has started up, causing big problems. I've tried putting
log4j.properties inside the ear file on the manifest class-path but it
doesn't seem to be found. I've also tried using a config.jar containing a
single log4j.properties file and referencing this jar on the manifest
class-path, with no success. Now planning to use a default
log4j.properties in the domain root, defining just a fileAppender and then
adding the JMSAppender using the initialization servlet.
Any help gratefully received!
Cheers,
Stephen