RE: debugging in struts Solved
Hi, To share with you At last done. I had removed the commons-logging.jar which was wrong. Now I am getting the logs in my file from struts api. Thanks. /Ashwani "Hariharan" <[EMAIL PROTECTED]To: <[EMAIL PROTECTED]> msoft.com> cc: Subject: RE: debugging in struts 06/12/2003 06:26 PM Please respond to hariharan Ok I guess some tomcat expert needs to Ans. this one. Iam using Oracle 9iAS -Hari -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 3:26 PM To: [EMAIL PROTECTED] Subject: RE: debugging in struts hi, Thanks for this. I am doing the same way with slight difference. First is that I am using xml file log4j_config.xml instead of properties file. Second is that I am not initializing it in my servlet. I am doing this by setting the property -Dlog4.configuration=<>. in Tomcat Things are working fine when I give my own debugging statements , but the log from the struts api is going(what ever is coming ) is going to tomcat log instead of file specified by me in log4j_config.xml . I think Tomcat logging is clashing with mine. I just check at the list if somebody is doing on tomcat. Which server you are using ? "Hariharan" <[EMAIL PROTECTED]To: <[EMAIL PROTECTED]> msoft.com> cc: Subject: RE: debugging in struts 06/12/2003 12:30 PM Please respond to hariharan Sure , apart from the basic log4j setup i have done following things.. you need three things to do . make following entries in your web.xml file STEP-1 -- log4j-init com.medicom.common.Log4jInit log4j.properties WEB-INF/classes/log4j.properties 1 STEP-2 - I have com.medicom.common.Log4jInit servlet you can change the package name if u want. here is the content of thse init servlet /* * Created on Jun 7, 2003 * * prototype for DMC using struts * dmc_prototype * $Id:$ */ package com.medicom.common; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.PropertyConfigurator; /** * @author Administrator * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class Log4jInit extends HttpServlet { public void init(){ String prefix = getServletContext().getRealPath("/"); String file = getInitParameter("log4j.properties"); if (file != null){ System.err.println("using log file" + prefix + file); PropertyConfigurator.configure(prefix + file); } } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { } public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { } } STEP-3 -- Here is the content of my log4j.properties file that I have saved under WEB-INF/classes directory of my orion server # Start of log4j.properties file # This defines the logging level for the rootLogger. It is not required # if you are going to keep the level at debug as the rootLogger by default #
RE: debugging in struts
Hi ashwin , Even I was looking for somethign like this, I wanted to check internal working of struts I have configured log4j with a configuration file and init servlet and I shoould tell you outcome was very good,, I get to see every thing srtuts does in my server console. download log4j and configure with struts -hari hi, I am not talking of any debugging tools but is there any way in which struts api is more verbose. Like some configuration param For eg I was usingit was not printing any errors, even though validation framework was returning the errors. I found that the the value of msg attribute for validator tag was wrong. But it was not giving me any errors. How to detect such errors ? TIA Ashwani - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: debugging in struts
U can specify debug attribute in your web.xml as a init param to the ActionServlet. but i don;t how far it will work out.. if u could give the correct context then i can suggest some thing. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 12:18 PM To: Struts Users Mailing List Subject: debugging in struts hi, I am not talking of any debugging tools but is there any way in which struts api is more verbose. Like some configuration param For eg I was usingit was not printing any errors, even though validation framework was returning the errors. I found that the the value of msg attribute for validator tag was wrong. But it was not giving me any errors. How to detect such errors ? TIA Ashwani This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: debugging in struts
hi, u have two init params(debug & detail) defined in the web.xml which defines the debug and detail level of logging. these logs the file using log4j configuration i am not sure , if ur kind of detailed errors come here, try out by giving a high "detail" level action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml debug 2 detail 1 2 ---Original Message--- From: Struts Users Mailing List Date: Tuesday, June 10, 2003 12:30:22 PM To: Struts Users Mailing List Subject: debugging in struts hi,I am not talking of any debugging tools but is there any way in whichstruts api is more verbose. Like some configuration paramFor eg I was using it was not printing any errors, eventhough validation framework was returning the errors. I found that thethe value of msg attribute for validator tag was wrong. But it was notgiving me any errors.How to detect such errors ?TIAAshwani IncrediMail - Email has finally evolved - Click Here