ngx_log_init

Breakpoint 1, main (argc=1, argv=0x7fffffffdd08) at src/core/nginx.c:201
201	{
(gdb) c
Continuing.

Breakpoint 7, ngx_log_init (prefix=0x0) at src/core/ngx_log.c:267
267	{
(gdb) u 342
ngx_log_init (prefix=0x45b83f "/usr/local/nginx/") at src/core/ngx_log.c:343
343	    if (p) {
(gdb) p name
$4 = (u_char *) 0x694150 "<span style="color:#ff0000;">/usr/local/nginx/logs/error.log</span>"
(gdb) bt
#0  ngx_log_init (prefix=0x45b83f "/usr/local/nginx/")
    at src/core/ngx_log.c:343
#1  0x00000000004038a6 in main (argc=1, argv=0x7fffffffdd08)
    at src/core/nginx.c:283

由此可见,name就是log文件的路径。 

ngx_log_file.fd = ngx_open_file(name, NGX_FILE_APPEND,

                                    NGX_FILE_CREATE_OR_OPEN,
                                    NGX_FILE_DEFAULT_ACCESS);
就是将log文件打开,文件描述符放到ngx_log_file中去。

static ngx_int_t ngx_http_flv_live_init(ngx_conf_t *cf) { ngx_str_t *value; ngx_array_t a; ngx_http_handler_pt *h; ngx_http_flv_live_fmt_t *fmt; ngx_http_flv_live_main_conf_t *lmcf; ngx_http_core_main_conf_t *cmcf; lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_flv_live_module); if (lmcf->combined_used) { if (ngx_array_init(&a, cf->pool, 1, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } value = ngx_array_push(&a); if (value == NULL) { return NGX_ERROR; } *value = ngx_http_combined_fmt; fmt = lmcf->formats.elts; if (ngx_http_flv_live_compile_format(cf, NULL, fmt->ops, &a, 0) != NGX_CONF_OK) { return NGX_ERROR; } } cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); h = ngx_array_push(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers); if (h == NULL) { return NGX_ERROR; } *h = ngx_http_flv_live_handler; ngx_http_next_body_filter = ngx_http_top_body_filter; ngx_http_top_body_filter = ngx_http_flv_parser_body_filter; return NGX_OK; } static ngx_http_module_t ngx_http_flv_live_module_ctx = { NULL, /* preconfiguration */ ngx_http_flv_live_init, /* postconfiguration */ ngx_http_flv_live_create_main_conf, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ NULL, /* merge server configuration */ ngx_http_flv_live_create_loc_conf, /* create location configuration */ ngx_http_flv_live_merge_loc_conf /* merge location configuration */ }; ngx_module_t ngx_http_flv_live_module = { NGX_MODULE_V1, &ngx_http_flv_live_module_ctx, /* module context */ ngx_http_flv_live_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ NULL, /* exit master */ NGX_MODULE_V1_PADDING };
最新发布
08-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值