我正在使用heroku-buildpack-elixir将应用程序部署到Heroku。我的应用程序包含一个简单的Plug / Cowboy设置。我注意到,当发生未处理的异常时,会出现一条不错的错误消息,其中显示了堆栈跟踪以及出现错误的代码行。
这对于开发环境是可以的,但是在生产环境中,我不希望我的代码对访问者可见。如何禁用或替代默认行为?
我尝试在Heroku中将2017-07-28 09:39:04.442 Allocation: BUY 7.0 AZN @ 43.665,
2017-07-28 09:39:07.724 Allocation: BUY 400.0 BT.A @ 3.022,
2017-07-28 09:39:08.802 Allocation: BUY 604.0 PFC @ 4.442,
2017-07-28 09:39:03.000 Allocation: SELL 1083 PFC @ 4.4432,
2017-07-28 09:39:03.000 Allocation: SELL 2350 PCT @ 10.3807,
2017-07-28 09:39:06.000 Allocation: SELL 2000 PFC @ 4.4565,
2017-07-28 09:39:07.000 Allocation: BUY 3000 VOD @ 2.21219,
2017-07-28 09:39:08.000 Allocation: SELL 2518 CLLN @ 0.5927,
环境变量设置为# this is to load the text file into content
with open(file) as f:
content = f.readlines()
content = [x.strip() for x in content]
# this is to filter the lines in the data
events = []
for line in content:
#if (line.find('Action') >0 and line.find('BP') > 0) :
if line.find('2017-07-28') > 0:
events.append(line.split(' '))
data = pd.DataFrame(events)
,但没有任何效果。
答案 0 :(得分:0)
将Plug.Debugger语句包装在if子句中。在产品环境中运行不再将错误显示为html页面。 source
if Mix.env == :dev do
use Plug.Debugger, otp_app: :my_app
end