Since the app server first configures logging and at a later point of time does the jndi bindings, i don't think you will be able to lookup the object from JNDI when the log4j is being initialized.
I guess, you could try packaging your own log4j.xml inside you application and then use your custom class in that xml file. This way, by the time your log4j.xml is loaded (when you application is deployed and accessed) the JNDI bindings will be done. You might want to see this post to understand how you can package the log4j.xml in your app http://www.jboss.com/index.html?module=bb&op=viewtopic&t=128979#4125416
Actually my problem is i have to filter the logs into different log files according
to the different JNDI names(databases).Means different log message of different database(JNDI) logs to different files .Can i do it without making any log4j.xml file ,by making any change to binding.
Please help me it is urgent.
I m a learner here. In my application there is four main files.
Propcoejb.jar, Propcoejbha.jar, client.jar and propco.sar. Here how can i configure my own log4j.xml so that JBoss sever configure that after all the
JNDI binding is done. Please help me.
There is not any ear file in my application so how can i configure my custom log4j.xml into my application.There is only jar and sar files.
Here i have some changes to Jboss-service.xml.
<!-- ==================================================================== --> <!-- Log4j Initialization --> <!-- ==================================================================== --> <mbean code="org.jboss.logging.Log4jService" name="jboss.system:type=Log4jService,service=Logging" xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml"> <attribute name="ConfigurationURL">resource:d1jboss-log4j.xml</attribute> <!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8 this needs to be set to avoid a possible deadlock on exception at the appender level. See bug#696819. --> <attribute name="Log4jQuietMode">true</attribute> <!-- How frequently in seconds the ConfigurationURL is checked for changes --> <attribute name="RefreshPeriod">60</attribute> <depends>jboss:service=DataSourceBinding</depends> </mbean>
And on the console error is DataSourceBinding Serveice is
while this service is going already.
Where i m lacking