我有一个使用谷歌应用程序引擎.In ubuntu的web应用程序,我使用以下命令启动应用程序引擎
./dev_appserver.py /home/me/dev/mycode
在mycode文件夹中,我有web app.In web应用程序代码的app.yml和python文件,我使用日志记录来写入一些变量的值,例如
import logging
LOG_FILENAME = '/home/me/logs/mylog.txt'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
class Handler(webapp2.RequestHandler):
....
class Welcome(Handler):
def get(self):
if self.user:
logging.debug('rendering welcome page for user')
self.render('welcome.html',username= self.user.name)
else:
logging.debug('redirect to signup')
self.redirect('/signup')
class MainPage(Handler):
def get(self):
self.redirect('/welcome')
app = webapp2.WSGIApplication([('/', MainPage),('/signup', Register),('/welcome', Welcome)], debug=True)
我已经为日志设置了chmod 777
,但没有创建日志。我不知道如何查看任何日志当谷歌应用引擎在linux中时,我没有directory..Still a launcher with gui
..which使查看应用引擎日志变得困难(如果生成了任何日志
如果有人能帮我解决这个问题,那就太好了。
发布于 2012-05-18 09:07:32
你读过这个https://developers.google.com/appengine/articles/logging了吗?因为我知道你不能声明你自己的日志文件
发布于 2012-05-18 11:30:16
我有相同的环境(Ubuntu、python、gae),并且遇到了类似的日志问题。
您不能登录到本地文件,如下所述:https://developers.google.com/appengine/docs/python/overview
“沙箱确保应用程序只能执行不会影响其他应用程序的性能和可伸缩性的操作。例如,应用程序无法将数据写入本地文件系统或进行任意网络连接。”
开发服务器在本地计算机上运行应用程序以测试应用程序。服务器模拟App Engine数据存储、服务和沙箱限制。
我能够让控制台日志工作,如下所示:
import logging
logging.getLogger().setLevel(logging.DEBUG)
https://stackoverflow.com/questions/10649623
复制