I have my application (myapp.ear) installed on JBoss.It contains a war file (axiscustom.war) inside it, which in turn contains myservices.aar.
This aar file contains a class com.example.MyClass. Now I want to implement logging inside this class using Log4j.For that I need to place log4j.properties somewhere.
I have already tried but failed so far.Every time I got this message - Configuration file log4j.properties no found.Please help.
myapp.ear
.+-------------a.war
.+-------------b.war
.+-------------axiscustom.war
...................+----------------META-INF
...................+----------------WEB-INF
.........................................+-------------<some xml files>
.........................................+-------------modules
.........................................+-------------lib
.........................................+-------------conf
.........................................+-------------classes
.........................................+-------------services
...........................................................+----------------x.aar
...........................................................+----------------y.aar
...........................................................+----------------myservice.aar
.................................................................................+---------------META-INF
.................................................................................+---------------services.list
.................................................................................+---------------com
......................................................................................................+-------------example
.........................................................................................................................+-----------MyClass.class//here i want to implement Logging
The *.aar (whatever that packaging is) would still have access to that .war/WEB-INF/classes since it's part of the same .war and they share the same classloader. Unless the .aar has some different classloader (I don't think it has). What exact problem are you running into?
When I tried to use log.debug("abc..."); statement inside MyClass.java ,it is not printing anything in logs and that too only with JBoss, with WAS those same logging statements were working fine.
Which version of JBoss AS? On some versions the log4j.properties file in your app is ignored; instead you need to configure the jboss-log4j.xml file to log your apps messages.
That file is ignore in 5.0.1. Jaikiran wrote up a method to use separate app logging, let me see if I can find that. Here they are. Looks like the first one is for 4.2.2, that might work for 5.0.1.
Thanks Peter , I have gone through the link you proposed but I m bit confused about the placement of the log4j.properties and jboss-app.xml, since in my scenario there are three war files in a ear, so the placement of log4j.properties on the root of ear will affect the logging in rest of the .war files.Can you please explain it in reference to my scenario.
myapp.ear
.+-------------a.war
.+-------------b.war
.+-------------axiscustom.war
...................+----------------META-INF
...................+----------------WEB-INF
.........................................+-------------<some xml files>
.........................................+-------------modules
.........................................+-------------lib
.........................................+-------------conf
.........................................+-------------classes
.........................................+-------------services
...........................................................+----------------x.aar
...........................................................+----------------y.aar
...........................................................+----------------myservice.aar
.................................................................................+---------------META-INF
.................................................................................+---------------services.list
.................................................................................+---------------com
......................................................................................................+-------------example
.........................................................................................................................+-----------MyClass.class//here i want to implement Logging