【发布时间】:2015-03-20 05:04:04
【问题描述】:
Spring Boot 正在由 maven 插件 spring-boot:run 启动。当访问 localhost:8080/parse 时,它会显示模糊的错误描述,但我在这里看不到堆栈跟踪,也无法在 IntelliJ 控制台输出中看到它。如何获取错误信息?
控制台输出:
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ event-log-parser ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.1.6.RELEASE:run (default-cli) @ event-log-parser <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.1.6.RELEASE:run (default-cli) @ event-log-parser ---
[INFO] Attaching agents: []
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.6.RELEASE)
网页
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
There was an unexpected error (type=Internal Server Error, status=500).
${message}
更新
【问题讨论】:
-
Apache 容器是否有任何日志发送到
/var/log?您是否配置了日志记录以便获得错误输出? -
我认为 Spring Boot 已经嵌入了 Tomcat 容器。我不知道如何配置日志记录。通常当我在 maven 中触发 run 时,在 intelliJ 中,任何错误最终都会出现在控制台中。
-
如果你用 maven 启动它,那么输出将被发送到 maven 的标准输出。我不明白为什么你会期望它出现在 Intellij 中。如果要调试它,请将调试器附加到远程服务。
-
首先使用 IntelliJ 运行 main 方法。然后您的输出将出现在 IntelliJ 中。如果您没有从中获得任何帮助,那么您应该编写一个异常处理程序服务并将一些 system.outs 放入其中。
-
我通过将运行配置定义为应用程序并设置 main.这种方式效果很好。没有真正的理由尝试使用 maven 插件运行它然后尝试附加。
标签: java spring maven intellij-idea spring-boot