<table id="logTable" width="100%" cellspacing=0 cellpadding=2 border="1" style='table-layout:fixed' >
 <%
 InputStream is = null;
 InputStreamReader isr = null;
 BufferedReader ibr = null;
 try {
       
	   String logFile = "/app/apache-tomcat/logs/catalina.out";   

       String tailCommand = "tail -f  " + logFile;
	   Runtime runtime = Runtime.getRuntime();
       Process process = runtime.exec(tailCommand);
       
       is = process.getInputStream();
       isr = new InputStreamReader(is);
       ibr = new BufferedReader(isr, 8192*2); 
	   
       String rLine="";
       int lineNum = 0  ;
       while ((rLine = ibr.readLine()) != null) {           
%>          
<tr>
<td width="50" valign=top ><%=(++lineNum)%></td> 
<td ><%=rLine%></td> 
</tr>
<%         
       }
 }catch(Exception e ){
   e.printStackTrace();
 } finally { 
    if(  ibr != null )  ibr.close();
    if(  isr != null )  isr.close();
    if(  is != null )  is.close();      
 } 
 %>
 </table>


'jsp' 카테고리의 다른 글

페이징 처리기법  (0) 2012.11.25
web.xml에서 taglib error날때  (0) 2010.12.22
jstl설치하기  (0) 2010.12.22

+ Recent posts