Notice
Recent Posts
Recent Comments
반응형
오늘도 공부
jsp에서 톰켓로그 보여주기(실시간 아님) 본문
반응형
<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 |
