dougengqiu8031 2015-05-24 22:20 采纳率: 100%
浏览 59
已采纳

带有Elastic Beanstalk的AWS上的Web应用程序未在日志中显示输出

This is sort of an in-depth question, so I'll try to explain it as best I can.

I've built a small API service in Go that I'm trying to deploy to AWS using the relatively new AWS Elastic Beanstalk Docker support.

Here's what I've done (the code is all open source, so you can follow along if you'd like):

$ git clone https://github.com/rdegges/ipify-api.git
$ cd ipify-api
$ git fetch origin aws:aws
$ git checkout aws
$ eb init
$ eb create
$ eb deploy

This will use elastic beanstalk to create a new app (with docker), and deploy it.

If I then run eb open to open my web app, I'll see my public IP address displayed (this is the correct behavior), so I know that my application is running / functional.

Now, in my source code, I've got several lines of debugging output:

fmt.Println("WOOOOOOOOOOOO")

The above statement just prints "WOO…" to the console. This is run every time a new request is made.

Unfortunately, when I run eb logs to view my instance logs, this debug line never shows up – and I can't figure out why.

I've tried printing to STDERR, printing to STDOUT, etc. – but I'm absolutely unable to get any output.

I've scoured the internet looking for solutions, but have yet to find any.

  • 写回答

2条回答 默认 最新

  • douyingyu5573 2015-05-27 17:23
    关注

    I think import "github.com/rdegges/ipify-api/api" is being built from the copy on Github, not from the local copy. The most recent commit of the api package doesn't have the extraneous fmt statements. Also, the log statement in main.go works fine, as does the fmt.Fprintf already in the api package. Try to verify the api package is getting built from the source you think it is.

    EDIT 6/1/2015:

    All my tests indicate this is a problem stemming from having an internal subpackage, and the remote service having trouble with that. The api package is not getting built from the local copy. fmt.Print works just fine from main.go, and moving GetIP from the api package to the main package lets fmt print just fine to stdout during web requests.

    Basically, all changes made to the local api subpackage are getting ignored.

    The EB logs probably say something about which packages are being downloaded remotely; mine did.

    I'm not a Godep pro, so maybe a Godep pro can elaborate. But FWIW, it seems like it might be related to this issue, tangentially. It might also be a problem with the remote service not building with godep go build, but like I said, I'm not a Godep pro, so I'm unsure.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP