I'm trying to create a different log file for my aplication named Tools.war
well first let me explain what i did till now...
first i created log4j.properties in my project Tools's WEB-INF folder
log4j.properties File
code:
--------------------------------------------------------------------------------
#debug log4jlog4j.debug=truelog4j.rootLogger=debug, ROOT #Log things to a File, keep the files size to 500KB#and keep 2 backup fileslog4j.appender.ROOT=org.apache.log4j.RollingFileAppenderlog4j.appender.ROOT.File=d://temp//tools.loglog4j.appender.ROOT.MaxBackupIndex=2log4j.appender.ROOT.MaxFileSize=500KBlog4j.appender.ROOT.layout=org.apache.log4j.PatternLayoutlog4j.appender.ROOT.layout.ConversionPattern=%p %d %c %x- %m%nlog4j.appender.ROOT.threshold=DEBUGlog4j.appender.ROOT.Append=falselog4j.appender.ROOT.ImmediateFlush=true
--------------------------------------------------------------------------------
coppied log4j.jar file into the WEB-INF/lib directory and imported log4j.jar into my project Tools.
than i configured log4j.properties in packaging so that it will fall into the WEB-INF/classes directory when i deploy it where my other classes will also fall.
well other classes will fall in the appropriate packages like my
servlet connect.class will fall in
WEB-INF/classes/com/tg/feedback/connect.class
where as log4j.properties will fall in the
WEB-INF/classes/log4j.properties
allright...
than this code is in my servlet Connect.java
code:
--------------------------------------------------------------------------------
public class Connect extends HttpServlet { private static final Logger l = Logger.getLogger("ROOT");
--------------------------------------------------------------------------------
and this is in my doPost method of Connect.java servlet
code:
--------------------------------------------------------------------------------
l.info("Hello World"); try{f.store_data_post(o);m.parse_xml(req.getParameter("dept_name").toLowerCase());m.send_mail(o.getMail(),"Feedback - " + o.getTopic(),o.getComment());}catch(Exception e){l.debug("JIGAR NAIK");e.printStackTrace();f.errFlagPost = true;}
--------------------------------------------------------------------------------
but my tools.log is not getting created... Error is also occuring in send_mail method and store_data method...