I'm running JBoss 4.2.3.GA, and have a web app that uses Spring and Log4j. I've set up Spring's Log4jConfigurer, but am having a problem since JBoss's log4j file is not on the classpath. It's at jboss.home/server/defaul/conf/jboss-log4j.xml. So, without hard-coding the path in Log4jConfigurer, how can I get Spring to use JBoss's log4j file?
You don't generally modify JBoss's log4j config via the applications, that's a route to madness. JBoss uses a shared configuration amongst all apps.
You can, however, programmatically alter log4j's runtime configuration, such as adding custom appenders or loggers. This isn't what Spring's Log4jConfigurer is for, however - you use that to configure a standalone log4j config.
Do answer your question: JBoss usually sets additional system properties that point to the server directory and configuration directories. You should be able to access these from your application or let them be resolved from the spring contexts.
In your case, it should be ok to access ${jboss.server.home.dir}/conf/jboss-log4j.xml
As skaffman correctly pointed out in a comment, there is no need to configure Spring to read JBoss' log4j configuration unless you have otherwise adapted something in the packaging. You will only have to take care that no log4j.[properties,xml]
lies somewhere in the root of the classpath or that a component tries to configure Log4J "manually".
Hope this could help,
Kariem