You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Milind Vaidya <ka...@gmail.com> on 2017/03/14 19:46:50 UTC

[users@httpd] logrotate, httpd and piping messages to java program

Hi

I asked following question few days ago:

I am writing messages to error_log file as well as sending to std out.
>
> The setting looks like
>
ErrorLog  "| /usr/bin/tee -a /var/log/httpd/error_log |  java -cp
producer.jar stdin.producer.StdInProducer /CustomProducer/config.json
>> /producer_init.log 2>&1"`
>
>
When httpd is started it spawns 2 processes and adds one every one hour,
keeping all alive

Only other thing happening per hour is rotation of error_log file by
logrotate with copytruncate option (which copies the file data and
truncates original file keeping the file descriptor unchanged )

I also tested it with another program with setting as follows which runs
fine

ErrorLog  "| /usr/bin/tee -a /var/log/httpd/error_log |
/usr/bin/logger -u /tmp/apache_log.socket"

I got answer to that indicating me to terminate the program after
program encounters EOF. I did that and it was running for a while. Now
I see that the java program which is supposed to end and start every
hour when the logrotate - copytruncate command runs, it is not
happening so. It has been running for more than few days now. So I am
wondering is there anything wrong in what I am doing ? There is not
error as such, but the behaviour changed from last time and the
earlier one was desired one. The logrotate is working fine and cutting
the file every hour without any problem. So I was wondering what is
happening here ? Is EOF missing or it is not being treated properly
over piping ? Any pointers ?