GoogleAppEngineLauncher can display the local log file my application while it is running on my Mac during development. However, I can not change the font size there so that I would like to use the tail
command to view the log file.
It's a shame but I do not know the log files they have / var / log /
, ~ / library / logs
or / library / Logs are not under
. Do you know where they are?
(There is probably no physical file, only Python is a standout of the development environment and therefore logs are only available in the Launcher application.)
If you guess, and can confirm this by studying the source file / usr / local / google_appengine / google / appengine / tools / dev_appserver.py
, is not being written on the log disk (a cStringIO.StringIO
for example to keep them in memory, code c It is used as the rest of the writing them) oriented "for a file-like object".
What I would recommend is to script their own application server, which imports dev_appserver
is writing subclasses dev_appserver
dev_appserver class google.appengine.tools MyHandler (dev_appserver.ApplicationLoggingHandler) Import: .ApplicationLoggingHandler
, and override only one method def __init __ (self, * a, ** k): dev_appserver .Applic ationLoggingHandler .__ init __ (self, * a, ** k) self.thefile = open ( '/ tmp / mylog.txt', 'w') def thrown (self-recorded): dev_appserver.ApplicationLoggingHandler (self, Record) Self. Thefile.write (str (record) + '\ n') self.thefile.flush ()
You also need to ensure that the class is used instead of standard, E.g. By sub-classing the dispatcher or making sure you use your dependency-injection capability. ( dev_appserver_main.py
you get this better control, I think that facilitates).
I think this optimization approach should be much more cumbersome than that (it requires logs written that is completely normal to file, after all - either display them separately to, as you wish, or do the process with some helpful scripts), and so I recommend requesting a feature Tracker app Engine: dev_appserver.py the
Accept another flag Ahia, which write has been specified, the path to log on. And, honestly, if I need this feature, then I do this dirty way: To add that flag and its use, edit the code that is . Py
file (and its related _main.py
). It should have a dozen lines in all, as easy as the "canonical" method, the easier it is. Of course, this is is dirty because every time there is a new SDK, you have to implement the patch again, and again, and then ... this is the reason why anyone also Patch proposal on GAE tracker, I have suggested that as part of the convenience request, hopefully it will be accepted soon! -)
Comments
Post a Comment