Support #673

stderr logrotate for xatmi servers

Added by Lauris about 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:04/22/2021
Priority:Normal (Code 4)Due date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

In case if xatmi server is started with -e arg and logger is configured to stderr, then tplog logger is switched to -e file. But issue would be in case of logrotate, as stderr would still point to old FD while the tplog would be switched to new FD. And this might cause that first logrotated file would still persist even invisible, due to fact that stderr/stdout FDs would point to first original file.

The solution here would be to add some marking for tplogconfig(), so that some logger/sink would be marked with attribute that says that at logrotate event, stderr/stdout shall be reopen.

History

#1 Updated by Madars almost 3 years ago

Additional logging issue with tmqueue:

config:

[@debug]
; * - goes for all binaries not listed bellow
*= ndrx=5 ubf=1 tp=5 file=/tmp/common threaded=y
xadmin= ndrx=5 ubf=1 tp=5 file=${NDRX_APPHOME}/log/xadmin.log
ndrxd= ndrx=5 ubf=1 tp=5 file=${NDRX_APPHOME}/log/ndrxd.log
tmqueue= file=/tmp/tmqueue threaded=y

causes tmqueue to log to:

$ cd /tmp

$ grep tmq *
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320168438:parse_server:config.c:1373:Adding: tmqueue SRVID=60 MIN=1 MAX=1 CLOPT="-e ${NDRX_APPHOME}/log/tmqueue-rm1.log -r -- -m SAMPLESPACE -s1 -- " ENV="" START_MAX=10 END_MAX=10 PINGTIME=100 PING_MAX=800 EXPORTSVCS="" START_WAIT=30000 STOP_WAIT=30000 CCTAG="RM1TMQ" RELOADONCHANGE="N"RESPAWN="Y" FULLPATH="" CMDLINE="" RSSMAX=-1 VSZMAX=-1 MINDISPATCHTHREADS=1 MAXDISPATCHTHREADS=1 THREADSTACKSIZE=0
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320169658:rocess_model:pmodel.c:0652:adding tmqueue:60
common.0:n:NDRX:3:d5d3db3a:21557:7fde162e3940:000:20210510:114320452966:tart_process:pmodel.c:0863:*********processing for startup tmqueue/60*********
common.0:n:NDRX:5:d5d3db3a:21611:7fb27880f940:000:20210510:114320477548:tpinit      :i/init.c:1012:Got PROGNAME [tmqueue]
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320491481:wait_and_run:cessor.c:0459:Source: [/test1,srv,reply,tmqueue,60,21611] Command: 4 Executing command: srvinfo
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320491534:cmd_srvinfo :rvinfo.c:0244:Server [tmqueue] advertises: svc: [@TMQ-2-60] func: [TMQUEUE]
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320491564:cmd_srvinfo :rvinfo.c:0244:Server [tmqueue] advertises: svc: [@QSPSAMPLESPACE] func: [TMQUEUE]
common.0:n:NDRX:5:d5d3db3a:21557:7fde162e3940:000:20210510:114320491622:tart_process:pmodel.c:1191:binary tmqueue/tmqueue, srvid 60 started with pid 21611/21611
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320477609:tpinit      :i/init.c:1043:my_id=[srv,tmqueue,60,21611,1,2]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320477630:tpinit      :i/init.c:1053:About to open client queue [/test1,clt,reply,tmqueue,21611,1]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320478896:tpinit      :i/init.c:1064:Client queue [/test1,clt,reply,tmqueue,21611,1] opened mqd_t=44248.
common.1:n:NDRX:4:d5d3db3a:21611:7fb27880f940:001:20210510:114320479211:mq_load_msgs:qspace.c:1701:tmq_load_msgs return 0
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320483566:atmi_library:v/init.c:0447:Server my_id=[srv,tmqueue,60,21611,1,2]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320483756:nternal_init:i/init.c:0829:Unlinking [/test1,clt,reply,tmqueue,21611,1]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320484746:ecific_queue:v/init.c:0272:Advertising: SVC: [] FN: [] ADDR: [(nil)] QUEUE: [/test1,srv,admin,tmqueue,60,21611]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320484770:ecific_queue:v/init.c:0272:Advertising: SVC: [] FN: [] ADDR: [(nil)] QUEUE: [/test1,srv,reply,tmqueue,60,21611]
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320484943:v_open_queue:spatch.c:0125:About to listen on: /test1,srv,admin,tmqueue,60,21611
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320484971:v_open_queue:spatch.c:0167:debug: Failed to unlink [/test1,srv,admin,tmqueue,60,21611]: Success (last error: )
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320487034:v_open_queue:spatch.c:0125:About to listen on: /test1,srv,reply,tmqueue,60,21611
common.1:n:NDRX:5:d5d3db3a:21611:7fb27880f940:001:20210510:114320487054:v_open_queue:spatch.c:0167:debug: Failed to unlink [/test1,srv,reply,tmqueue,60,21611]: Success (last error: )
common.2:n:NDRX:5:d5d3db3a:21611:7fb262608700:002:20210510:114320484490:tpinit      :i/init.c:1043:my_id=[srv,tmqueue,60,21611,2,2]
common.2:n:NDRX:5:d5d3db3a:21611:7fb262608700:002:20210510:114320484521:tpinit      :i/init.c:1053:About to open client queue [/test1,clt,reply,tmqueue,21611,2]
common.2:n:NDRX:5:d5d3db3a:21611:7fb262608700:002:20210510:114320486899:tpinit      :i/init.c:1064:Client queue [/test1,clt,reply,tmqueue,21611,2] opened mqd_t=43480.

The tmqueue.X shall be used instead of common.X for tmqueue.

#2 Updated by Madars almost 3 years ago

Release notes

Logging library has been updated:

- Fixed for threaded=y mode, where default (*) and binary has file name set, the threads uses only default log file name, instead of binary based.
- If XATMI server binary log file is set to stderr and -e flag is set, then logger logs to this file (current logic). When log-rotate is performed, now stderr/stdout for servers is re-open to current NDRX logger output file (either the same file after logrotate, or to different file, if tplogconfig() changes the name)

#3 Updated by Madars almost 3 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#4 Updated by Madars almost 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF