Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As you surmise, and can confirm by studying the source file <code>/usr/local/google_appengine/google/appengine/tools/dev_appserver.py</code>, the logs are not being written to disk (a <code>cStringIO.StringIO</code> instance is used to keep them in memory, as the rest of the code <em>is</em> oriented to writing them "to a file-like object").</p> <p>What I would recommend is writing your own app server script, which imports <code>dev_appserver</code>, subclasses <code>dev_appserver.ApplicationLoggingHandler</code>, and overrides just <em>one</em> method:</p> <pre><code>from google.appengine.tools import dev_appserver class MyHandler(dev_appserver.ApplicationLoggingHandler): def __init__(self, *a, **k): dev_appserver.ApplicationLoggingHandler.__init__(self, *a, **k) self.thefile = open('/tmp/mylog.txt', 'w') def emit(self, record): dev_appserver.ApplicationLoggingHandler(self, record) self.thefile.write(str(record) + '\n') self.thefile.flush() </code></pre> <p>You also need to ensure this class is used instead of the standard one, e.g. by subclassing the dispatcher or ensuring you use its dependency-injection capability. (<code>dev_appserver_main.py</code> lets you control this better, I think).</p> <p>I think this customization approach is far more cumbersome than it should be (it's perfectly normal to want the logs written to file, after all -- either to display them differently, as you desire, or to process them later with some auxiliary script), and so I'd also recommend putting a feature request on app engine's tracker: <code>dev_appserver.py</code> should accept one more flag, which, if specified, gives the path on which to write logs to disk.</p> <p>And, to be honest, if I needed this feature right now, myself, I'd do it the dirty way: editing that <code>.py</code> file (and its related <code>_main.py</code>) to add said flag and its use. That should be a dozen lines in all, much easier than the "canonical" way I just outlined. Of course, it <em>is</em> dirty because every time there's a new SDK you'll have to apply the patch again, and again, and again... which is why one should <em>also</em> propose the patch on GAE's tracker, as part of the feature request I suggested, hoping it gets accepted soon!-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload