Michael Gradek
Michael Gradek

Reputation: 2738

App Engine - Remove file change detection from dev_appserver log

In a recent SDK update, it seems that Google has added a INFO level log into the dev_appserver that prints out each and every time a file change is detected.

This, in my opinion, just clutters up the log with information I already know thus I don't want it to be printed out on my console.

INFO     2014-11-27 09:52:43,876 module.py:391] [default] Detected file changes:
  /Users/michael/app/templates/home
  /Users/michael/app/templates/home/index.html

Is there any way to remove these lines from the log? Since this is a INFO level log, I can't really remove the INFO from the log_level as other INFO logs come in handy many times...

Any suggestions?

Upvotes: 5

Views: 900

Answers (3)

Sasxa
Sasxa

Reputation: 41264

This issue started to bug me also, so here's my quick-fix until devs find more permanent solution:

in path-to-SDK\google\appengine\tools\devappserver2\module.py comment out lines 424-426.

424 # logging.info(
425 #     '[%s] Detected file changes:\n  %s', self.name,
426 #     '\n  '.join(sorted(file_changes)))

Just have to remember to do it again when the build changes, if they don't fix it. (I'm working with 1.9.20 atm) (:

Upvotes: 2

Patrice
Patrice

Reputation: 4692

As Derek Perkins pointed out, this was sent to the App Engine Issue tracker. Since I had the same problem I starred the issue. I was happily surprised to see it was actually sent up to engineering and they updated the tracker today with a workaround. I rewrote parts of it and added a bit of formatting :)

Root cause of the problem

The main reason behind why every file in a project's folder is tracked is because the reload logic is naïve and has no way of knowing which files are actually being in use.

In the event that some data file contents are changed, but only loaded at module import time (for instance templates in some frameworks), it's difficult for the devserver to accurately detect such changes.

Workaround for Git and Mercurial

If you put your project folder anywhere but the root of your git repo, it will make all the .git files appear outside of your project's dir, so the changes to the files should not be seen and therefore shouldn't trigger a webserver reload. For instance build your project's structure this way :

myproject/ 
myproject/.git/ 
myproject/.gitignore 
myproject/myapp/ 
myproject/myapp/app.yaml 
myproject/README 

Then run the devserver inside of myproject/myapp instead of "myproject".

There is also a mention that this has been tested on Git and Mercurial, but it won't work on CVS or SVN.

Upvotes: 0

Derek Perkins
Derek Perkins

Reputation: 657

It's now an issue on the App Engine issue tracker. Vote it up for quicker resolution.

https://code.google.com/p/googleappengine/issues/detail?id=11662

Upvotes: 4

Related Questions