[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/axis IdrsHandler.java,1.3,1.4 IdrsProvider.java
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2004-08-30 00:56:27
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/axis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12162/src/net/sourceforge/idrs/axis Modified Files: IdrsHandler.java IdrsProvider.java Log Message: Added log4j support. cleaned up the logs Index: IdrsHandler.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/axis/IdrsHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IdrsHandler.java 29 Aug 2004 05:01:40 -0000 1.3 --- IdrsHandler.java 30 Aug 2004 00:56:10 -0000 1.4 *************** *** 16,19 **** --- 16,20 ---- import java.util.HashMap; import java.util.Iterator; + import java.util.Properties; import net.sourceforge.idrs.core.servlet.ConfigInfo; *************** *** 26,29 **** --- 27,32 ---- import org.apache.axis.MessageContext; import org.apache.axis.handlers.BasicHandler; + import org.apache.log4j.Logger; + import org.apache.log4j.PropertyConfigurator; /** *************** *** 34,38 **** */ public class IdrsHandler extends BasicHandler { ! static final String DEFAULT_DB_POOL = "net.sourceforge.idrs.pool.JDBCPool"; static final String DEFAULT_REPORT_POOL = "net.sourceforge.idrs.pool.IDRSRepPool"; --- 37,41 ---- */ public class IdrsHandler extends BasicHandler { ! static Logger logger = Logger.getLogger(IdrsHandler.class.getName()); static final String DEFAULT_DB_POOL = "net.sourceforge.idrs.pool.JDBCPool"; static final String DEFAULT_REPORT_POOL = "net.sourceforge.idrs.pool.IDRSRepPool"; *************** *** 53,60 **** public void invoke(MessageContext ctx) throws AxisFault { if (! ctx.getPastPivot()) { ! System.out.println("inbound : " + this); ctx.setProperty(IDRS_RESOURCES,this.mgr); } else { ! System.out.println("outbound : " + this); } --- 56,63 ---- public void invoke(MessageContext ctx) throws AxisFault { if (! ctx.getPastPivot()) { ! ctx.setProperty(IDRS_RESOURCES,this.mgr); } else { ! } *************** *** 67,70 **** --- 70,81 ---- public void init() { super.init(); + Properties def = new Properties(); + def.put("log4j.logger.net.sourceforge.idrs","INFO, stdout"); + def.put("log4j.appender.stdout","org.apache.log4j.ConsoleAppender"); + def.put("log4j.appender.stdout.layout","org.apache.log4j.PatternLayout"); + def.put("log4j.appender.stdout.layout.ConversionPattern","[%d] %-5p - %c{1}: %m [%t]%n"); + + PropertyConfigurator.configure(def); + // retrieve the configuration and servlet context String location = (String) this.getOption(CONFIG_LOCATION_OPTION); *************** *** 77,94 **** try { config.loadFromConfigPath(location,parseClass); - System.out.println("Completed config! " + config.getVars()); //create the application object this.mgr.app = new Application(config.getVars()); ! //load database pools retrieveDocDBs(); ! //load script contexts buildScriptContexts(); } catch (Exception e) { ! // TODO Auto-generated catch block ! e.printStackTrace(System.out); } --- 88,118 ---- try { config.loadFromConfigPath(location,parseClass); + def = new Properties(); + def.put("log4j.logger.net.sourceforge.idrs",config.getLogLevel() + ", logfile"); + def.put("log4j.appender.logfile","org.apache.log4j.RollingFileAppender"); + def.put("log4j.appender.logfile.File",config.getErrorLog()); + def.put("log4j.appender.logfile.MaxFileSize","1MB"); + def.put("log4j.appender.logfile.MaxBackupIndex","15"); + + def.put("log4j.appender.logfile.layout","org.apache.log4j.PatternLayout"); + def.put("log4j.appender.logfile.layout.ConversionPattern","[%d] %-5p - %c{1}: %m [%t]%n"); + + PropertyConfigurator.configure(def); + + logger.info("Internet Document And Report Server"); + logger.info("Axis Integration\nCopyright (C) 2002-2004 Marc Boorshtein\nThe contents of this file are subject to the Mozilla Public License Version 1.0 (the License);\nyou may not use this file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.mozilla.org/MPL/\n\nSoftware distributed under the License is distributed on an \"AS IS\" basis,\nWITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific\nlanguage governing rights and limitations under the License."); //create the application object this.mgr.app = new Application(config.getVars()); ! logger.info("Created Application Object"); //load database pools retrieveDocDBs(); ! logger.info("Created Connection Pools"); //load script contexts buildScriptContexts(); + logger.info("Created Script Contexts"); } catch (Exception e) { ! logger.error("Could not initiate handler",e); } *************** *** 181,185 **** //tmpDB.returnConnection(con); } catch (Exception e) { ! e.printStackTrace(System.out); } --- 205,209 ---- //tmpDB.returnConnection(con); } catch (Exception e) { ! logger.error("Could not load databases",e); } Index: IdrsProvider.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/axis/IdrsProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IdrsProvider.java 29 Aug 2004 05:01:40 -0000 1.4 --- IdrsProvider.java 30 Aug 2004 00:56:10 -0000 1.5 *************** *** 50,55 **** --- 50,60 ---- import org.apache.axis.transport.http.AxisServlet; import org.apache.axis.transport.http.HTTPConstants; + import org.apache.log4j.Logger; + import org.apache.log4j.PropertyConfigurator; import org.w3c.dom.Document; import org.w3c.dom.Element; + + + import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; *************** *** 63,67 **** */ public class IdrsProvider extends BasicProvider { ! public static final String CONFIG_IDRS_RML_PATH = "rml"; public static final String CONFIG_IDRS_BASE_PACKAGE = "basePackage"; --- 68,72 ---- */ public class IdrsProvider extends BasicProvider { ! static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(IdrsProvider.class.getName()); public static final String CONFIG_IDRS_RML_PATH = "rml"; public static final String CONFIG_IDRS_BASE_PACKAGE = "basePackage"; *************** *** 123,127 **** bodyDoc = bodypart.getAsDocument(); String ns = bodyDoc.getDocumentElement().getNamespaceURI(); ! System.out.println("namespace : " + ns); String packageName = (String) this.nameSpaces.get(ns); JAXBContext jc = JAXBContext.newInstance(packageName); --- 128,132 ---- bodyDoc = bodypart.getAsDocument(); String ns = bodyDoc.getDocumentElement().getNamespaceURI(); ! String packageName = (String) this.nameSpaces.get(ns); JAXBContext jc = JAXBContext.newInstance(packageName); *************** *** 131,135 **** } catch (Exception e) { ! e.printStackTrace(System.out); throw AxisFault.makeFault(e); } --- 136,140 ---- } catch (Exception e) { ! logger.error("could not create report",e); throw AxisFault.makeFault(e); } *************** *** 139,143 **** ! System.out.println("Base Package : " + basePackage); this.report.getHead().init(dbs, 0, --- 144,148 ---- ! this.report.getHead().init(dbs, 0, *************** *** 161,166 **** } catch (Throwable e1) { ! // TODO Auto-generated catch block ! e1.printStackTrace(System.out); } finally { if (script != null) { --- 166,170 ---- } catch (Throwable e1) { ! logger.error("Could not process report",e1); } finally { if (script != null) { *************** *** 179,184 **** ((DbPool) mgr.dbs.get(name)).returnConnection(con); } catch (Exception e3) { ! // TODO Auto-generated catch block ! e3.printStackTrace(System.out); } } --- 183,187 ---- ((DbPool) mgr.dbs.get(name)).returnConnection(con); } catch (Exception e3) { ! logger.error("Could not return connections",e3); } } *************** *** 235,240 **** public void init() { ! System.out.println("in init"); ! System.out.println(); //get needed info --- 238,242 ---- public void init() { ! logger.info("Initializing provider"); //get needed info *************** *** 246,250 **** String webinf = servlet.getServletContext().getRealPath("WEB-INF"); ! System.out.println("webinf directory : " + webinf); } --- 248,252 ---- String webinf = servlet.getServletContext().getRealPath("WEB-INF"); ! logger.info("Completed initialization"); } *************** *** 259,263 **** String webinf = servlet.getServletContext().getRealPath("WEB-INF"); ! System.out.println("webinf directory" + webinf); String rmlTrans = webinf + "/rmlTrans.xml"; --- 261,265 ---- String webinf = servlet.getServletContext().getRealPath("WEB-INF"); ! String rmlTrans = webinf + "/rmlTrans.xml"; *************** *** 267,271 **** rmlSrcPath = servlet.getServletContext().getRealPath(rmlSrcPath); ! System.out.println("rmlSrcPath : " + rmlSrcPath); this.basePackage = (String) ctx.getService().getOption(IdrsProvider.CONFIG_IDRS_BASE_PACKAGE); --- 269,273 ---- rmlSrcPath = servlet.getServletContext().getRealPath(rmlSrcPath); ! this.basePackage = (String) ctx.getService().getOption(IdrsProvider.CONFIG_IDRS_BASE_PACKAGE); *************** *** 295,302 **** this.compilePage(buf.toString(),new PrintWriter(new OutputStreamWriter(System.out)),parseClass,rmlTrans,true,rmlSchema); } catch (Exception e) { ! // TODO Auto-generated catch block ! e.printStackTrace(System.out); } this.doneinit = true; } --- 297,305 ---- this.compilePage(buf.toString(),new PrintWriter(new OutputStreamWriter(System.out)),parseClass,rmlTrans,true,rmlSchema); } catch (Exception e) { ! logger.error("Could not compile page",e); } + + this.doneinit = true; } *************** *** 316,320 **** compiler = new RmlCompiler( ! logger, src, parseClass, --- 319,323 ---- compiler = new RmlCompiler( ! src, parseClass, |