how to use ngx_log_debug during configuration of a core module

Manlio Perillo manlio.perillo at gmail.com
Wed Mar 24 19:46:36 MSK 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Maxim Dounin ha scritto:
> [...]
>> I have logged the log name and fd of cycle->log, and I have:
>> log->name: (null), log->fd: 3
>>
>> The cycle->new_log, instead, have:
>> log->name: /usr/local/nginx/logs/error.log, log->fd: -1
>>
>>
>> It seems that the log object is not fully configured, when module init
>> callbacks are called.
> 
> I've just tested and looked through code - module init callbacks 
> (init_module member of ngx_module_t structure) are called after 
> full configuration has been initialized (including logs) and even 
> debug works perfectly using cycle->log (once you have error_log 
> ... debug; configured at top level).
> 
>>From data you provide it looks like you in fact use create_conf 
> or init_conf callbacks of ngx_core_module_t structure.
> 

Yes.

> You still should be able to use ngx_log_error(cycle->log), though 
> level is initialized to NGX_LOG_NOTICE by default (so it's minimum 
> level which will be logged unless you are reconfiguring already 
> running nginx).
> 

Ah, my bad.
I was using NGX_LOG_INFO, instead of NGX_LOG_NOTICE!

Now notices are logged.


Module is now complete:
http://hg.mperillo.ath.cx/nginx/ngx_python_module/

It is a core Nginx module that embeds the CPython interpreter.
The future version of ngx_http_wsgi_module will require this module.


Thanks   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuqQewACgkQscQJ24LbaUSGmwCdFwTOW8ovwkQFT6kIoXl6O6w1
Zx8An1jN4IBVrIwxnG0yjvYcejI5v9Ip
=R0ob
-----END PGP SIGNATURE-----



More information about the nginx-devel mailing list