2013-12-17 2 views
0

이것은 Visual Studio 2008로 작성된 코드입니다. 코드가 컴파일되고 성공적으로 실행됩니다. 코드를 디버깅하여 검사했습니다. 실수로 수행 한 경우 오류 메시지 로그 파일에 로그 메시지가 표시되지 않습니다.APACHE 모듈의 error.log 파일에 로그 메시지를 가져올 수 없습니까?

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include "apr_optional.h" 
#include <httpd.h> 
#include <http_protocol.h> 
#include <http_config.h> 
#include <http_log.h> 
#include "apr_general.h" 
#include "apr_getopt.h" 
#include "apr_xml.h" 
#include "apr_file_io.h" 
static int hello_handler(request_rec *r) 
{ 



    ap_log_error(APLOG_MARK,APLOG_INFO,0,NULL,"Entered Function = hello_handler, time = %d",r->finfo.mtime); 



     /* We set the content type before doing anything else */ 
//  ap_set_content_type(r, "text/html"); 

     /* If the request is for a header only, and not a request for 
     * the whole content, then return OK now. We don't have to do 
     * anything else. */ 
     if (r->header_only) 
     { 
       return OK; 
     } 

    ap_log_error(APLOG_MARK,APLOG_INFO,0,NULL, "Exit Function = hello_handler,time = %d",r->finfo.mtime); 
} 


static void InitLog_Hooks(apr_pool_t *pool) 
{ 
    ap_hook_handler(hello_handler, NULL, NULL, APR_HOOK_LAST); 
} 

module AP_MODULE_DECLARE_DATA SampleLog_modules = { 
    STANDARD20_MODULE_STUFF, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    InitLog_Hooks 
} ; 
+0

"httpd.conf"구성 파일에서 loglevel을 정보로 변경하려고 시도했지만 도움이되지 않습니다. –

답변

0

이 매우 easy..just 에 네 번째 매개 변수를 변경했다 R-> 서버 당신이 또한 우리는 사용하여 우리 자신의 파일에 로그 메시지를 리디렉션 할 수 있습니다 ..하는 error.log 파일에 메시지를은 GetError합니다 api

ap_replace_stderr_log (pool,"Filepath"); 

건배 !!