Perl module logs located in wrong file

Maxim Dounin mdounin at mdounin.ru
Tue Jan 12 17:22:51 UTC 2021


Hello!

On Tue, Jan 12, 2021 at 08:59:44AM -0500, Flinou wrote:

> Hello !
> 
> Here is the output of nginx -V : 
> 
> 
> nginx version: nginx/1.19.2
> built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
> built with OpenSSL 1.1.1g  21 Apr 2020
> TLS SNI support enabled
> configure arguments: --prefix=/opt/nginx/1.19.2 --with-cc-opt='-I
> /logiciels/openssl/1.1.1/include/ -fstack-protector-strong' --with-cc='gcc
> -L/logiciels/openssl/1.1.1/lib64 -Wl,-rpath,/logiciels/openssl/1.1.1/lib64'
> --with-compat --with-file-aio --with-http_flv_module
> --with-http_stub_status_module --with-stream_realip_module
> --with-stream_ssl_module --with-stream_ssl_preread_module
> --with-http_ssl_module --with-pcre --with-debug --with-http_realip_module
> --with-http_addition_module --with-http_mp4_module --with-http_dav_module
> --with-http_random_index_module --with-http_degradation_module
> --with-http_perl_module
> --with-perl_modules_path=/opt/nginx/1.19.2/modules/perl/ --with-mail
> --with-mail_ssl_module --with-stream_ssl_module
> --with-http_secure_link_module --with-http_sub_module
> --with-http_auth_request_module --with-ipv6 --with-http_v2_module
> --with-stream --with-threads --with-http_gunzip_module
> --with-http_gzip_static_module --with-http_stub_status_module
> --with-http_slice_module --add-dynamic-module=./ngx_devel_kit-0.3.1
> --add-dynamic-module=./lua-nginx-module-0.10.15
> --add-dynamic-module=./headers-more-nginx-module-0.33
> --add-module=./ngx_http_auth_ldap_module
> --with-ld-opt=-Wl,-rpath,/opt/luajit/lib
> 
> Here is my nginx.conf : 
> 
> 
> user w3user webgrp;
> worker_processes  1;
> 
> load_module ./modules/ngx_http_headers_more_filter_module.so;
> error_log   /var/projects/instance/nginx_1.19/logs/error.log debug;
> 
> pid        /var/projects/instance/nginx_1.19/run/nginx.pid;
> 
> 
> events {
>     worker_connections  1024;
> }
> 
> 
> http {
>     include       mime.types;
>     default_type  application/octet-stream;
>     perl_modules /appli/projects/instance/nginx_1.19/conf/perl/modules/;
>     perl_modules ./modules/perl/;
>     perl_require test.pm;
> 
>     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
> '
>     #                  '$status $body_bytes_sent "$http_referer" '
>     #                  '"$http_user_agent" "$http_x_forwarded_for"';
> 
>     access_log  /var/projects/instance/nginx_1.19/logs/access.log;
> 
>     sendfile        on;
>     #tcp_nopush     on;
> 
>     #keepalive_timeout  0;
>     keepalive_timeout  65;
> 
>     #gzip  on;
> proxy_cache_path   //var/projects/instance/nginx_1.19/cache/ levels=1:2
> keys_zone=instance_cache:10m max_size=10g inactive=60m use_temp_path=off;
> include /appli/projects/instance/nginx_1.19/conf//instance.conf;
> 
> }
> 
> 
> I am witnessing a weird behaviour. 
> All logs are well written down in 
> /var/projects/instance/nginx_1.19/logs/error.log (as provided in nginx.conf)
> excepting logs from perl_module which are written in
> /opt/nginx/1.19.2/logs/error.log.
> 
> For example (when nginx failed to locate perl module)
> 
> $ cat /opt/nginx/1.19.2/logs/error.log
> 2021/01/12 10:28:27 [emerg] 48992#48992: require_pv("test.pm") failed:
> "Can't locate test.pm in @INC (@INC contains:
> /appli/projects/instance/nginx_1.19/perl/modules/
> /opt/nginx/1.19.2/./modules/perl/ /usr/local/lib64/perl5
> /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
> /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval
> 1) line 1."
> 
> or when start up went fine :
> 
> $ cat /opt/nginx/1.19.2/logs/error.log
> 2021/01/12 11:40:55 [notice] 53486#53486: signal process started
> 
> In other hand, remaining logs can be found in 
> /var/projects/instance/nginx_1.19/logs/error.log.
> This behaviour does not reproduce when I start nginx without perl module
> directives.
> 
> Any ideas of what is going on here ?

Logs defined in the configuration are used once the configuration 
is parsed/loaded.  Errors which happen during configuration 
parsing/loading, such as the one from the perl module, are written 
to stderr and to the complied-in error log.  In nginx 1.19.5 or 
newer, this compiled-in error log can be redefined using the "-e" 
command line option.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list