On Mar 19, 1:18 am, Jorge Godoy <jgo... gmail.com> wrote:
> "northof40" <shearich... gmail.com> writes:
> > Hi - I start my CP app looking like this :
>
> > nohup python cposerver.py > logs/logfilename
>
> > ... so that 'print' statements in the code end up
in logfilename.
>
> > My problem isn't (I think) a CP one. I find that
print statements are
> > delayed in appearing in logfilename - they do
appear eventually but if
> > you're sitting with a user and the screen crashes
you can't rely on
> > doing 'tail logfilename' and see output which is
relevant to what's
> > just happened.
>
> > I presume that unix only writes the piped output
to the file when it's
> > a got a blocks worth ?
>
> > So my question is does anyone know how I can
'flush' print statements
> > to the piped output.
>
> > Would appreciate any ideas.
>
> Not answering your question, but why are you using
print statements when you
> can use the logging module? With logging you can have
different levels --
> debug, info, warning, fatal, ... -- and filter then to
different files, as
> well. Besides, you can have debug logs turned on while
developing and turned
> off while in production...
>
Yes that's a good question. Basically because we'd never
written a CP
app before this one and we were kind of feeling our way for
a long
time - using 'print' was just easy to start with when there
were a
lot of other things which were new to us and then three
months later
you're still doing it. I suspect replacing the prints with
logs is
what we should do now.
regards
Richard.
> --
> Jorge Godoy <jgo... gmail.com>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|