<%@ page contentType="text/html;charset=GBK"%> <%@ page isErrorPage="true" %> <%@page import="com.eprobiti.was.*" %> <%@page import="com.eprobiti.trs.*" %> <%@page import="java.io.*" %> <%@page import="java.util.*" %> <%! public String logLine(HttpServletRequest request, HttpServletResponse response,TRSTagConfig tagConfig,String format,String detail,String channelid,String errorServlet) { //返回格式化完的日志 String log=null; String year,month,day,hour,min,second; StringBuffer logBuffer; GregorianCalendar cal = new GregorianCalendar(); int intTmp; intTmp = cal.get(Calendar.YEAR); year = String.valueOf(intTmp); intTmp = cal.get(Calendar.MONTH); intTmp++; if(intTmp<10) { month = "0" + String.valueOf(intTmp); } else { month = String.valueOf(intTmp); } intTmp = cal.get(Calendar.DAY_OF_MONTH); if(intTmp<10) { day = "0" + String.valueOf(intTmp); } else { day = String.valueOf(intTmp); } intTmp = cal.get(Calendar.HOUR_OF_DAY); if(intTmp<10) { hour = "0" + String.valueOf(intTmp); } else { hour = String.valueOf(intTmp); } intTmp = cal.get(Calendar.MINUTE); if(intTmp<10) { min = "0" + String.valueOf(intTmp); } else { min = String.valueOf(intTmp); } intTmp = cal.get(Calendar.SECOND); if(intTmp<10) { second = "0" + String.valueOf(intTmp); } else { second = String.valueOf(intTmp); } logBuffer = new StringBuffer(format); int begin=0,end=0; begin = format.indexOf("YYYY"); //设置四位 if(begin!=-1) { end = begin+4; } else { begin = format.indexOf("YY"); //设置两位 if(begin!=-1) { end = begin+2; } if(year.length()==4) { year = year.substring(2,4); } } if(begin!=-1) //设置年 { logBuffer.replace(begin,end,year); } format = logBuffer.toString(); begin = format.indexOf("MM"); if(begin!=-1) { end = begin+2; logBuffer = new StringBuffer(format); //设置月 logBuffer.replace(begin,end,month); } format = logBuffer.toString(); begin = format.indexOf("DD"); if(begin!=-1) { end = begin+2; logBuffer = new StringBuffer(format); //设置日 logBuffer.replace(begin,end,day); } format = logBuffer.toString(); begin = format.indexOf("hh"); if(begin!=-1) { end = begin+2; logBuffer = new StringBuffer(format); //设置时 logBuffer.replace(begin,end,hour); } format = logBuffer.toString(); begin = format.indexOf("mm"); if(begin!=-1) { end = begin+2; logBuffer = new StringBuffer(format); //设置分 logBuffer.replace(begin,end,min); } format = logBuffer.toString(); begin = format.indexOf("ss"); if(begin!=-1) { end = begin+2; logBuffer = new StringBuffer(format); //设置秒 logBuffer.replace(begin,end,second); } format = logBuffer.toString(); begin = format.indexOf("%user"); if(begin!=-1) { end = begin+5; logBuffer = new StringBuffer(format); //设置用户名 logBuffer.replace(begin,end,tagConfig.getUserName()); } format = logBuffer.toString(); begin = format.indexOf("%host"); if(begin!=-1) { end = begin+5; logBuffer = new StringBuffer(format); //设置用户host logBuffer.replace(begin,end,request.getRemoteAddr()); } format = logBuffer.toString(); begin = format.indexOf("%command"); if(begin!=-1) { end = begin+8; logBuffer = new StringBuffer(format); //设置用户请求 logBuffer.replace(begin,end,errorServlet); } format = logBuffer.toString(); begin = format.indexOf("%channelid"); if(begin!=-1) { end = begin+10; logBuffer = new StringBuffer(format); //设置当前频道号 logBuffer.replace(begin,end,channelid); } format = logBuffer.toString(); begin = format.indexOf("%detail"); if(begin!=-1) { end = begin+7; logBuffer = new StringBuffer(format); //设置详细信息 logBuffer.replace(begin,end,detail); } log = logBuffer.toString(); return log; } %> <%! public static String getSubItem(String strItem,int Index,String separator) { int pos1,pos2,i; String strSub; pos1=pos2=0; i=1; do { pos2=strItem.indexOf(separator,pos1); if(i==Index) { if(pos2!=-1) strSub=strItem.substring(pos1,pos2); else strSub=strItem.substring(pos1); return strSub; } pos1=pos2+1; i++; }while(pos2!=-1); return ""; } %> Error Page
 

<% 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) { %>





请仔细检查您的检索式:
1.检索表达式符号(“空格”“+”“/””-“)必须用半角!
2.符号不能连写!
3.输入的文字最后不能有空格!
4.如果输入诩中含“()”必须用全角“()”。如可输入“广告(彩色)”
5.如果搜寻包含空格及其它符号在内的关键词,输入时符号须用全角。 如可输入“Hong Kong”。
例如不能填“中国++世界”“中国(双空格)世界”“中国//世界”“中国--世界”。


重试