log4j中对于文件大小的限制
2013-07-11 17:00
211 查看
public static long toFileSize(String value, long dEfault) { if(value == null) return dEfault; String s = value.trim().toUpperCase(); long multiplier = 1; int index; if((index = s.indexOf("KB")) != -1) { multiplier = 1024; s = s.substring(0, index); } else if((index = s.indexOf("MB")) != -1) { multiplier = 1024*1024; s = s.substring(0, index); } else if((index = s.indexOf("GB")) != -1) { multiplier = 1024*1024*1024; s = s.substring(0, index); } if(s != null) { try { return Long.valueOf(s).longValue() * multiplier; } catch (NumberFormatException e) { LogLog.error("[" + s + "] is not in proper int form."); LogLog.error("[" + value + "] not in expected format.", e); } } return dEfault; }
这一段时对于log4j中每一个备份文件的大小的计算,从代码上可以看书最后返回的是一个long类型的长整形。依据不同的单位,可设置的值也不同。
log4j中备份文件的最大数不能操作int的最大长度。
相关文章推荐
- oracle及操作系统对于文件大小的限制
- logback、log4j未按天生成日志或者超过文件大小限制未生成新的日志解决方法
- oracle及操作系统对于文件大小的限制
- oracle及操作系统对于文件大小的限制
- windows2003中IIS对于上传文件大小限制的解决办法
- 解决在Windows2003Server和IIS 6.0中对于上传下载文件大小限制的问题
- oracle及操作系统对于文件大小的限制
- windows2003中IIS对于上传文件大小限制的解决办法
- zt对于C#中的FileUpload解决文件上传大小限制的问题设置
- 对于C#中的FileUpload解决文件上传大小限制的问题设置
- 解决在Windows2003Server和IIS 6.0中对于上传下载文件大小限制的问题
- php.ini修改php上传文件大小限制的方法详解
- javaweb项目将文件上传至数据库中的大小限制
- 解决asp无组件文件上传及下载大小限制
- 修改PHP上传文件大小限制的方法
- nodeJs修改上传文件的大小限制
- linux下各种文件大小限制
- 修改PHP上传文件的大小限制
- 修改PHP上传文件大小限制的方法
- 修改PHP+Apache上传文件大小限制