You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Afkham Azeez <af...@gmail.com> on 2009/01/18 10:11:40 UTC

Re: [Axis2] DeploymentClassLoader

Log4J is configured at the global level. Hence, you cannot have
different log4j configurations for your services. This is true even
for JavaEE applications deployed on application servers. The
configuration of logger etc. of the different applications has to be
carried out at a global level.

HTH
Azeez

On Fri, Jan 16, 2009 at 9:11 PM, Detlef Meier <De...@web.de> wrote:
> Hi,
>
> I tried to implement service based logging, that means:
> Each WebService deployed as an AAR in an Axis2 web application should write its own log files.
>
> I put a log4j.jar to the /lib folder of the AAR and a log4j.xml to the root of the AAR.
> But the lib and the configuration are always loaded from the webapp Axis2,
> i.e. from webapps/axis2/WEB-INF/lib and webapps/axis2/WEB-INF/classes .
>
> I wrote a little test code in the startUp() method of a ServiceLifeCycle implementation:
>
>  public void startUp(ConfigurationContext configCtx, AxisService service) {
>    DeploymentClassLoader cl = (DeploymentClassLoader)service.getClassLoader();
>    try {
>      Class c = cl.loadClass("org.apache.log4j.Logger");
>      System.out.println("Services ClassLoader: " + cl.toString());
>      System.out.println("Loggers ClassLoader: " + c.getClassLoader().toString());
>    }
>    catch(ClassNotFoundException cnfE) {
>    }
>  }
>
> that prints this to tomcat's stdout:
> Services ClassLoader: org.apache.axis2.deployment.DeploymentClassLoader@4d76b4
> Loggers ClassLoader: WebappClassLoader
>  delegate: false
>  repositories:
>    /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@1fddc31
>
> I think, DeploymentClassLoader does not work in child-first manner,
> because it inherits loadClass() from Java's ClassLoader that works parent-first.
>
> Am I right or do I miss something in my test code or in my thoughts?
>
> TIA
> Detlef Meier
>



-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760