"tee" process being killed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"tee" process being killed

Andrew-7
Hi,

I am running a cherrypy server like this

sudo python -u server.py 2>&1 | tee server_log.dat >& /dev/null &

The logging typically works fine for several hours but then the "tee" process is killed and the logging stops.

From the log file, there is no obvious cause for the "tee" process being killed.

Does anyone have any idea how I can debug this?

Thanks.

Andrew

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "tee" process being killed

Tim Roberts
On Nov 11, 2017, at 5:54 AM, Andrew <[hidden email]> wrote:
>
> I am running a cherrypy server like this
>
> sudo python -u server.py 2>&1 | tee server_log.dat >& /dev/null &

I'm curious to know why you would involve tee, when this equivalent:

    sudo python -u server.py 2>&1 > server_log.dat &

Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "tee" process being killed

Johan Hartzenberg
In reply to this post by Andrew-7
Note that tee runs as the original user.

Don't know why tee gets killed - do you run your cherrypy in auto update mode?

Do look at cherrypy logging...  I don't use print from within cherrypy since when daemonised its output is not always where you think it should be.  In stead of print write a console_print function like this

I use the tag to sometimes just mark which request instance is busy doing the logging.

I use a global debug setting to control outputting extra info.


def console_print(*args, **kwargs):
strings = []
if kwargs.get("tag"):
strings.append(kwargs.get("tag"))
if cherrypy.config.get("debug"):
for s in args:
if isinstance(s, str):
strings.append(s)
else:
strings.append(str(s))

cherrypy.log(' '.join(strings))


The log file is configured using an entry like this in your server config:

log.access_file: "/home/svcuser/logs/service_access.log"
log.error_file: "/home/svcuser/logs/service_error.log"



On Saturday, November 11, 2017 at 3:54:07 PM UTC+2, Andrew wrote:
Hi,

I am running a cherrypy server like this

sudo python -u server.py 2>&1 | tee server_log.dat >& /dev/null &

The logging typically works fine for several hours but then the "tee" process is killed and the logging stops.

From the log file, there is no obvious cause for the "tee" process being killed.

Does anyone have any idea how I can debug this?

Thanks.

Andrew

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "tee" process being killed

Andrew-7
Hi,

When I use

sudo python -u server.py 2>&1 > server_log.dat & 

there is some output that is printed to the terminal not the log file:

[ec2-user@ip-10-0-0-117 server]$ sudo python -u server.py 2>&1 > server_log.dat &
[1] 15218
[ec2-user@ip-10-0-0-117 server]$ [13/Nov/2017:10:21:35] ENGINE Bus STARTING
[13/Nov/2017:10:21:35] ENGINE Started monitor thread '_TimeoutMonitor'.
[13/Nov/2017:10:21:35] ENGINE Started monitor thread 'Autoreloader'.

I am not sure if I run cherrypy in auto update mode. How do I check that?

Andrew

On Sunday, November 12, 2017 at 2:40:32 PM UTC+1, Johan Hartzenberg wrote:
Note that tee runs as the original user.

Don't know why tee gets killed - do you run your cherrypy in auto update mode?

Do look at cherrypy logging...  I don't use print from within cherrypy since when daemonised its output is not always where you think it should be.  In stead of print write a console_print function like this

I use the tag to sometimes just mark which request instance is busy doing the logging.

I use a global debug setting to control outputting extra info.


def console_print(*args, **kwargs):
strings = []
if kwargs.get("tag"):
strings.append(kwargs.get("tag"))
if cherrypy.config.get("debug"):
for s in args:
if isinstance(s, str):
strings.append(s)
else:
strings.append(str(s))

cherrypy.log(' '.join(strings))


The log file is configured using an entry like this in your server config:

log.access_file: "/home/svcuser/logs/service_access.log"
log.error_file: "/home/svcuser/logs/service_error.log"



On Saturday, November 11, 2017 at 3:54:07 PM UTC+2, Andrew wrote:
Hi,

I am running a cherrypy server like this

sudo python -u server.py 2>&1 | tee server_log.dat >& /dev/null &

The logging typically works fine for several hours but then the "tee" process is killed and the logging stops.

From the log file, there is no obvious cause for the "tee" process being killed.

Does anyone have any idea how I can debug this?

Thanks.

Andrew

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "tee" process being killed

Björn Pedersen
Hi,

 [13/Nov/2017:10:21:35] ENGINE Started monitor thread 'Autoreloader'.

as the Autoreloader thread is started, you are in "Auto update mode". The result is, that  on changes in the source code/config files, the old cherrypy process will stop and start a fresh one to get these changes.
This is not compatible with "tee"-ing the output.

See http://docs.cherrypy.org/en/latest/pkg/cherrypy.process.html#module-cherrypy.process.plugins

Björn

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.