ASP 에러내용 로그파일로 남기기
AspError Object 를 검색해보다 아래의 url을 발견
ASP 는 로그파일 남기기가 그지 같았는데
(사실 JAVA가 LOG4J 가 있어 편한건가. ㅋ)
이 포스팅을 보려면 차라리 아래 원본을 보라.!!!!
http://aircook.tistory.com/entry/ASP-500-Error-%EC%B2%98%EB%A6%AC-%ED%8E%98%EC%9D%B4%EC%A7%80
일단 선행되어야 하는건 에러페이지로 IIS에 등록해야함
http://babolsk.tistory.com/1176
따라해보기로 함
<%'@language="VBSCRIPT"%>
<%
dim asp_err_obj
set asp_err_obj = Server.getLastError
%>
<html>
<head>
</head>
<body>
</body>
<h1>에러페이지 접근 객체(Err, AspError Object)-2</h1>
<div>
</div>
<p>
<table border="1">
<caption>AspError Object 설명</caption>
<colgroup>
<col width="200px" />
<col width="800px" />
</colgroup>
<tr>
<td colspan="2">속성</td>
</tr>
<tr>
<td>aspCode</td>
<td>
<ul>
<li><%=asp_err_obj.aspCode%></li>
<li>asp_err_obj.aspCode</li>
<li>IIS에 의한 오류일 경우 발생하는 듯함</li>
</ul>
</td>
</tr>
<tr>
<td>aspDescription</td>
<td>
<ul>
<li><%=asp_err_obj.aspDescription%></li>
<li>asp_err_obj.aspDescription</li>
<li>IIS에 의한 오류일 경우 발생하는 듯 함</li>
</ul>
</td>
</tr>
<tr>
<td>category</td>
<td>
<ul>
<li><%=asp_err_obj.category%></li>
<li>asp_err_obj.category</li>
<li>오류 분류내용</li>
</ul>
</td>
</tr>
<tr>
<td>column</td>
<td>
<ul>
<li><%=asp_err_obj.column%></li>
<li>asp_err_obj.column</li>
</ul>
</td>
</tr>
<tr>
<td>description</td>
<td>
<ul>
<li><%=asp_err_obj.description%></li>
<li>asp_err_obj.description</li>
<li>오류상세내용</li>
</ul>
</td>
</tr>
<tr>
<td>file</td>
<td>
<ul>
<li><%=asp_err_obj.file%></li>
<li>asp_err_obj.file</li>
<li>오류난 파일 위치</li>
</ul>
</td>
</tr>
<tr>
<td>line</td>
<td>
<ul>
<li><%=asp_err_obj.line%></li>
<li>asp_err_obj.line</li>
<li>오류라인</li>
</ul>
</td>
</tr>
<tr>
<td>number</td>
<td>
<ul>
<li><%=asp_err_obj.number%></li>
<li>asp_err_obj.number</li>
</ul>
</td>
</tr>
<tr>
<td>source</td>
<td>
<ul>
<li><%=asp_err_obj.source%></li>
<li>asp_err_obj.source</li>
<li>오류난 소스</li>
</ul>
</td>
</tr>
</table>
</p>
</html>
<%
'파일처리, 별도 메서드로 뺴놓아도 될 것 같음
set fs = Server.createObject("scripting.FileSystemObject")
log_file = Server.mapPath(".") & "\err\" & date & ".log"
'response.write log_file
set log_f = fs.openTextFile(log_file, 8, true)
log_f.writeLine "-------------------------------------------------------------"
log_f.writeLine "Date : " & now()
log_f.writeLine "Domain : " & request.serverVariables("HTTP_HOST")
log_f.writeLine "Browser : " & request.serverVariables("HTTP_USER_AGENT")
log_f.writeLine "aspCode : " & asp_err_obj.aspCode()
log_f.writeLine "aspDescription : " & asp_err_obj.aspDescription()
log_f.writeLine "category : " & asp_err_obj.category()
log_f.writeLine "column : " & asp_err_obj.column
log_f.writeLine "description : " & asp_err_obj.description
log_f.writeLine "file : " & asp_err_obj.file
log_f.writeLine "line : " & asp_err_obj.line
log_f.writeLine "number : " & asp_err_obj.number
log_f.writeLine "source : " & asp_err_obj.source
log_f.writeLine "-------------------------------------------------------------"
set log_f = nothing
set fs = nothing
set asp_err_obj = nothing
%>
참고 URL
http://aircook.tistory.com/entry/ASP-500-Error-%EC%B2%98%EB%A6%AC-%ED%8E%98%EC%9D%B4%EC%A7%80