Re: runserver stdout and stderr piping problems
Did you ever get around to opening a ticket for this? If so, what is the status? On Friday, January 20, 2012 1:04:29 PM UTC-7, JuhaS wrote: > > I was launching manage.py runserver from another app and trying to > capture the output correctly without luck using pipes. Eventually I > narrowed the problem down to two issues. In my opinion they are bugs > but I thought I'd ask for confirmations here before creating a ticket > and patch. > > Issue 1: The startup message of development server isn't flushed. > > The result is that starting the server from console directly it is > printed correctly during startup, but using pipes the message isn't > flushed until shutdown (Ctrl+C pressed). Since log messages use etderr > (issue 2) they are flushed before the startup message. > > Example: > > $ python manage.py runserver 2>> output 1>> output // redirect stderr > and stdout to file named output > > [send few http requests] > [press Ctrl+C] > > $ cat output > > [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 > [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 > [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 > Validating models... > > 0 errors found > Django version 1.4 alpha 1, using settings 'djangotut.settings' > Development server is running at http://127.0.0.1:8000/ > Quit the server with CONTROL-C. > > Since the actual log messages go to stderr (next issue), the startup > message keeps hanging until shotdown when it's eventually printed to > end of the file. I tried with many commands and all showed the same > issue. > > Is this a clear bug? > > SOLUTION: adding a stdout.flush() to runserver.py fixes this for me. > > > Issue 2: Log entries about http requests go to stderr > > For some reason the log entries go to stderr (for example 'GET // > HTTP...'). Is this a bug, or is there some reason for this? > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/GgVXCHG1e2QJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: runserver stdout and stderr piping problems
Opened a ticket https://code.djangoproject.com/ticket/19593 On Wed, Jan 9, 2013 at 6:50 PM, Russell Keith-Magee wrote: > > I'm not aware of a ticket for this issue, and I couldn't find one from a > quick search, so feel free to open one. The approach described by the OP > seems reasonable, so if you want to provide a patch as well, feel free. > > Yours, > Russ Magee %-) > > > On Wed, Jan 9, 2013 at 11:37 PM, Chris Proto wrote: > >> Did you ever get around to opening a ticket for this? If so, what is the >> status? >> >> >> On Friday, January 20, 2012 1:04:29 PM UTC-7, JuhaS wrote: >>> >>> I was launching manage.py runserver from another app and trying to >>> capture the output correctly without luck using pipes. Eventually I >>> narrowed the problem down to two issues. In my opinion they are bugs >>> but I thought I'd ask for confirmations here before creating a ticket >>> and patch. >>> >>> Issue 1: The startup message of development server isn't flushed. >>> >>> The result is that starting the server from console directly it is >>> printed correctly during startup, but using pipes the message isn't >>> flushed until shutdown (Ctrl+C pressed). Since log messages use etderr >>> (issue 2) they are flushed before the startup message. >>> >>> Example: >>> >>> $ python manage.py runserver 2>> output 1>> output // redirect stderr >>> and stdout to file named output >>> >>> [send few http requests] >>> [press Ctrl+C] >>> >>> $ cat output >>> >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> Validating models... >>> >>> 0 errors found >>> Django version 1.4 alpha 1, using settings 'djangotut.settings' >>> Development server is running at http://127.0.0.1:8000/ >>> Quit the server with CONTROL-C. >>> >>> Since the actual log messages go to stderr (next issue), the startup >>> message keeps hanging until shotdown when it's eventually printed to >>> end of the file. I tried with many commands and all showed the same >>> issue. >>> >>> Is this a clear bug? >>> >>> SOLUTION: adding a stdout.flush() to runserver.py fixes this for me. >>> >>> >>> Issue 2: Log entries about http requests go to stderr >>> >>> For some reason the log entries go to stderr (for example 'GET // >>> HTTP...'). Is this a bug, or is there some reason for this? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-developers/-/GgVXCHG1e2QJ. >> >> To post to this group, send email to django-developers@googlegroups.com. >> To unsubscribe from this group, send email to >> django-developers+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-developers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: runserver stdout and stderr piping problems
It doesn't look like it responded to this topic when I sent a reply with email. Anyway, I opened up a ticket https://code.djangoproject.com/ticket/19593 On Wednesday, January 9, 2013 6:50:45 PM UTC-7, Russell Keith-Magee wrote: > > > I'm not aware of a ticket for this issue, and I couldn't find one from a > quick search, so feel free to open one. The approach described by the OP > seems reasonable, so if you want to provide a patch as well, feel free. > > Yours, > Russ Magee %-) > > On Wed, Jan 9, 2013 at 11:37 PM, Chris Proto > > wrote: > >> Did you ever get around to opening a ticket for this? If so, what is the >> status? >> >> >> On Friday, January 20, 2012 1:04:29 PM UTC-7, JuhaS wrote: >>> >>> I was launching manage.py runserver from another app and trying to >>> capture the output correctly without luck using pipes. Eventually I >>> narrowed the problem down to two issues. In my opinion they are bugs >>> but I thought I'd ask for confirmations here before creating a ticket >>> and patch. >>> >>> Issue 1: The startup message of development server isn't flushed. >>> >>> The result is that starting the server from console directly it is >>> printed correctly during startup, but using pipes the message isn't >>> flushed until shutdown (Ctrl+C pressed). Since log messages use etderr >>> (issue 2) they are flushed before the startup message. >>> >>> Example: >>> >>> $ python manage.py runserver 2>> output 1>> output // redirect stderr >>> and stdout to file named output >>> >>> [send few http requests] >>> [press Ctrl+C] >>> >>> $ cat output >>> >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> [20/Jan/2012 13:54:24] "GET // HTTP/1.1" 200 358 >>> Validating models... >>> >>> 0 errors found >>> Django version 1.4 alpha 1, using settings 'djangotut.settings' >>> Development server is running at http://127.0.0.1:8000/ >>> Quit the server with CONTROL-C. >>> >>> Since the actual log messages go to stderr (next issue), the startup >>> message keeps hanging until shotdown when it's eventually printed to >>> end of the file. I tried with many commands and all showed the same >>> issue. >>> >>> Is this a clear bug? >>> >>> SOLUTION: adding a stdout.flush() to runserver.py fixes this for me. >>> >>> >>> Issue 2: Log entries about http requests go to stderr >>> >>> For some reason the log entries go to stderr (for example 'GET // >>> HTTP...'). Is this a bug, or is there some reason for this? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-developers/-/GgVXCHG1e2QJ. >> >> To post to this group, send email to >> django-d...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> django-develop...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/django-developers?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/qfSy8hG_tAcJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.