|
|||
<% WAS40Config appConfig; WCLData wasConfig; TRSTagConfig tagConfig; WASException wase; String errorLogFile,logPath,logFormat,errorContent,errorServlet; String log; String channelID; //application = getServletContext(); session = request.getSession(true); appConfig=null; errorContent = null; errorServlet = null; try { appConfig = (WAS40Config)application.getAttribute("appconfig"); if(appConfig == null) { appConfig = new WAS40Config(); application.setAttribute("appconfig",appConfig); } String configFileName=appConfig.getWCLDataFilePath(); MonitorThread monitor; monitor=(MonitorThread)application.getAttribute("was4configmonitor"); if(monitor==null) { monitor=new MonitorThread(); monitor.fileName=configFileName; monitor.wasConfigName="wasconfig"; monitor.pp=application; monitor.waitTime=appConfig.getReloadTime(); monitor.start(); application.setAttribute("was4configmonitor",monitor); } else { if(!monitor.isAlive()) { monitor=new MonitorThread(); monitor.fileName=configFileName; monitor.wasConfigName="wasconfig"; monitor.pp=application; monitor.waitTime=appConfig.getReloadTime(); monitor.start(); application.setAttribute("was4configmonitor",monitor); } } wasConfig = (WCLData)application.getAttribute("wasconfig"); if(wasConfig ==null) { PTools configLoader = new PTools(); wasConfig = configLoader.loadCfgFile(configFileName); application.setAttribute("wasconfig",wasConfig); } tagConfig = (TRSTagConfig)session.getAttribute("tagconfig"); if(tagConfig == null) { tagConfig = new TRSTagConfig(); } channelID = (String)session.getAttribute("channelid"); if(channelID == null) { channelID = tagConfig.getCurrentChannel(); if(channelID == null) { channelID=""; } } wase = (WASException)session.getAttribute("was40exception"); if(wase!=null) { errorContent = wase.getMessage(); //错误信息 } else { errorContent = "未获得任何的错误信息"; } errorServlet=(String)session.getAttribute("was40servlet"); if(errorServlet == null) { errorServlet = ""; } if( (wasConfig.getisLog()&0x00000002) != 0 ) { //记录日志操作 logPath = appConfig.getLogFilePath(); String sp = System.getProperty("file.separator"); if(sp == null) { sp = "/"; } errorLogFile = logPath + sp +"error"+ sp +"was40_error_log.txt"; //记录出错日志 logFormat = appConfig.getLogFormat(); log = logLine(request,response,tagConfig,logFormat,errorContent,channelID,errorServlet); //记录日志操作 File file = new File(errorLogFile); if(!file.exists()) { file.createNewFile(); } FileWriter writer = new FileWriter(errorLogFile,true); if(writer != null) { String linesp=System.getProperty("line.separator"); writer.write(log+linesp); writer.close(); } } if(errorContent.indexOf("#")!=-1) { %>
|
|||
|