This is an automated email from the ASF dual-hosted git repository. ningjiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git
commit c0eaa464dd4456637cdf74741a75d849b8b03aae Author: Willem Jiang <jiangni...@huawei.com> AuthorDate: Thu May 24 14:06:56 2018 +0800 Clean up the demo code of healthcheck --- _users/cn/healthcheck.md | 6 +++--- _users/healthcheck.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_users/cn/healthcheck.md b/_users/cn/healthcheck.md index 6eab081..1ad322f 100644 --- a/_users/cn/healthcheck.md +++ b/_users/cn/healthcheck.md @@ -44,14 +44,14 @@ public class MySqlHealthChecker implements HealthChecker { connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_db?useSSL=false", "root", "pwd"); return new HealthCheckResult(true, "local mysql health check", ""); } catch (SQLException e) { - e.printStackTrace(); + LOG.error("Cannot connect the localhost mysql. ", e); return new HealthCheckResult(false, "local mysql health check", e.toString()); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { - e.printStackTrace(); + LOG.error("Close connect the localhost mysql error. ", e); } } } @@ -81,4 +81,4 @@ servicecomb: >2. >/health为所有HealthCheck的最终结果,true或false,只要有任何一个HealthCheck的healthy结果为false,那么就会是false。 ## 参考示例 -我们已经提供了一个例子作为参考,代码在samples/metrics-extend-healthcheck中。 \ No newline at end of file +我们已经提供了一个例子作为参考,代码在samples/metrics-extend-healthcheck中。 diff --git a/_users/healthcheck.md b/_users/healthcheck.md index ae25499..54f8548 100644 --- a/_users/healthcheck.md +++ b/_users/healthcheck.md @@ -44,14 +44,14 @@ public class MySqlHealthChecker implements HealthChecker { connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_db?useSSL=false", "root", "pwd"); return new HealthCheckResult(true, "local mysql health check", ""); } catch (SQLException e) { - e.printStackTrace(); + LOG.error("Cannot connect the localhost mysql. ", e); return new HealthCheckResult(false, "local mysql health check", e.toString()); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { - e.printStackTrace(); + LOG.error("Close connect the localhost mysql error. ", e); } } } @@ -80,5 +80,5 @@ We can get HealthCheck final result by accress http://localhost:8080/health , al >1. The implementation of Rest publish is in metrics-core, so need import this >dependency; >2. The result of /health is the final result of all HealthCheckers, true or >false, if healthy result of any HealthChecker return false, then this value >will false. -## Other Reference -We had provided a sample at samples/metrics-extend-healthcheck. \ No newline at end of file +## Other Reference +We had provided a sample at samples/metrics-extend-healthcheck. -- To stop receiving notification emails like this one, please contact ningji...@apache.org.