从 ipython 笔记本服务器获取错误消息到浏览器

get error message from ipython notebook server to browser

当我启动笔记本服务器时,后端(执行 ipython 笔记本命令的终端)中显示了一些日志消息。我如何在浏览器中获取错误消息?

例如 在后端:(我使用 python 调用一些 java 方法)

2015-12-09 22:34:33,483 [Thread-2] ERROR SomeErrorMessage - java.io.FileNotFoundException: File does not exist: hdfs://sample/test.txt

但是在浏览器中,它只是默默地失败了,没有显示任何内容和 return 一个 None 值。

我怎样才能在笔记本(在浏览器)中得到上面的消息?

谢谢

我在这个 link:Stdout in IPython notebook vs CLI IPython

这是一个原因:

When you do os.system, it's not capturing stdout/stderr from the new process. In the terminal, this works, because stdout and stderr just go directly to the terminal, without Python ever knowing about them. In the notebook, it doesn't, because the kernel can only forward stdout/stderr that it knows about.

另一个原因是我误解了错误和日志。它必须抛出捕获其他错误然后简单地记录它。