on 10-25-2007 10:53 AM
Hi Experts,
I am currently trying to implement Logging in a Stateless EJB.
I have tried the following 2 methods
1. Using log4j.jar
a. Imported log4j.jar as external library
b. Added log4j.properties file in the ejbModule folder
c.Added the following code
private static final long serialVersionUID = 1L;
private static Logger log = Logger.getLogger(EntityFoo.class);
d. Added log.error(), etc. in my code.
e. Created a Web Service on the methods, for testing.
e. Wrapped the EJB project in an Enterprise Application Project and Deployed.
Result:
Logs do not get created, in the location specified in the File attribute of the File appender. Instead i'm getting a message <b>No appenders could be found for logger</b> in the default trace file on the server
2. Using logging.jar available with SAP, i.e the SAP Logging API
a. Imported logging.jar as external library
b.Added the following code
private static Location myLoc = Location.getLocation(EntityFoo.class);
c. Added myLoc.infoT(), etc.
d. In the Enterprise Application Project added the <i>log-configuration.xml</i> file, with suggested parameters.
e. Wrapped the EJB project in that Enterprise Application Project and Deployed.
Result:
Logs do not get created. No Warning or Errors encountered.
In both the cases,
1. Its a Local Projects
2. No compile - time, Run - Time errors
3. Works fine with Java Projects, not with EJBs
Waiting for answers.
Regards,
Alka Panday.
Hi,
I can only speak for the L4j config.
You have a classloading issue with the log4j.properties file.
You have to initialize it somewhere explicit.
I guess, you deploy your project as a .ear file?
Therefore you have to specify the location if the properties file.
Have a detailed look here:
http://logging.apache.org/log4j/1.2/faq.html#3.5
Rgds
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus,
Thanx for replying.
I did find a work around to solve the problem long back.
Actually the problem was with the WAS. As soon as I restart the Server after deployment, Logging works great.
Regards,
Alka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.