![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java
Cky079
主流
展开
-
try catch 循环问题的真相
try catch在编码过程中经常使用,为了捕获可预见的异常,保证程序继续运行。 如果遇到循环处理逻辑,try catch应该放在循环内、还是循环外呢? 我这里记录一下: 通常的一种说法: try catch放在循环内,异常自己捕获处理。其他循环可以继续执行。 放在循环外,循环体就视为一个整体,一旦发生异常,就不执行。 // 放在外部 try { for(int i=1;i&...原创 2018-10-25 10:48:18 · 5499 阅读 · 3 评论 -
log4j2 + slf4j 项目实践
End of Life On August 5, 2015 the Logging Services Project Management Committee announced that Log4j 1.x had reached end of life. For complete text of the announcement please see the Apache Blog. Us...原创 2018-12-05 11:41:59 · 537 阅读 · 0 评论 -
log4j2 异常信息日志记录问题
通常检查性的日志,都是在try catch 中获取记录的。 了解了一番,记录主要是两种:getMessage 与 详细的堆栈信息 printStackTrace() 错误日志嘛,当然是越详细越好, 生产环境,一定要避免直接控制台打印详细错误日志,记录在error log里面是最好的选择。既方便看,也节省资源。 那么如何将 printStackTrace() 记录在error 的log文...原创 2019-01-03 15:02:06 · 3433 阅读 · 0 评论 -
Java 日期工具类
一些公共的方法,可能会使用到,记录下: /** * 获得时间范围的天数差 * @author wjc * @param startDateStr 开始日期字符串yyyy-MM-dd * @param endDateStr 结束日期字符串yyyy-MM-dd * @return 天数差 0:当天 1:连续日期 */ pu...原创 2019-01-24 15:25:40 · 234 阅读 · 0 评论 -
读取properties文件的工具类
package com.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * @Auther: wjc * @Date: 201...原创 2019-01-24 15:28:59 · 286 阅读 · 0 评论