当前位置: 首页 > news >正文

湛江做网站制作网站后台的编辑器不显示

湛江做网站制作,网站后台的编辑器不显示,长春做高端网站公司,小说网站建站程序日志分析 场景 运维嫌弃生产环境打印日志过多#xff0c;而且日志存储需要费用#xff0c;让我们减少打印日志大小#xff0c;所以需要分析日志在哪里打印的过多 解决方案 读取生产日志文件#xff0c;统计分析打印日志的地方#xff0c;最后删除代码中打印日志的地方…日志分析 场景 运维嫌弃生产环境打印日志过多而且日志存储需要费用让我们减少打印日志大小所以需要分析日志在哪里打印的过多 解决方案 读取生产日志文件统计分析打印日志的地方最后删除代码中打印日志的地方 实现-LogParAnalyzer public class LogParAnalyzer {//日志原始文件private File log;private ListPattern list;private ExecutorService executorService;//生成的分割文件private String subPath D:\\split\\;private ListFile files;public LogParAnalyzer(File log, ListString patterns) {this.log log;executorService Executors.newFixedThreadPool(30);list new ArrayList();try {for (String pattern : patterns) {Pattern p Pattern.compile(pattern);list.add(p);}} catch (Exception e) {throw new RuntimeException(e);}}public void analyze() throws Exception {// 使用 try-with-resources 自动关闭 BufferedReaderint chunkSize 100000;try (BufferedReader reader new BufferedReader(new FileReader(log))) {File file new File(subPath);if (!file.exists()) {file.mkdirs();}String line;ListCompletableFuture? task new ArrayList();int cur 0;ListString list new ArrayList();AtomicInteger batch new AtomicInteger(0);while ((line reader.readLine()) ! null) {//sb 会通过Arrays.copy复制字节数组内存频繁复制list.add(line);cur;if ((cur % chunkSize) 0) {//深拷贝ListString tt list.stream().map(String::new).collect(Collectors.toList());list.clear();CompletableFuture f CompletableFuture.runAsync(() - processChunk(tt, batch.get()), executorService);task.add(f);batch.incrementAndGet();}}if (list.size()0) {CompletableFuture f CompletableFuture.runAsync(() - processChunk(list, batch.get()), executorService);task.add(f);}//等待所有任务结束CompletableFuture.allOf(task.toArray(new CompletableFuture[0])).get();System.out.println(task execute finished);}}private void processChunk(ListString lines, int batch) {try {System.out.println(Thread.currentThread().getName() execute batch.txt start);MapString, AtomicInteger map new HashMap();try (BufferedWriter writer Files.newBufferedWriter(Paths.get(subPath batch .txt))) {lines.forEach(line - {for (Pattern pattern : list) {Matcher matcher pattern.matcher(line);if (matcher.find()) {String group matcher.group(0);map.computeIfAbsent(group, k - new AtomicInteger(1)).incrementAndGet();}}if (map.size() 0) {//每个文件只保存100前100条writeBatchToFile(writer, map);}});}System.out.println(Thread.currentThread().getName() execute batch.txt end);} catch (Exception e) {e.printStackTrace();}}private void writeBatchToFile(BufferedWriter writer, MapString, AtomicInteger map) {MapString, AtomicInteger limit limit(map, 100);try {for (Map.EntryString, AtomicInteger entry : limit.entrySet()) {writer.write(entry.getKey() entry.getValue().get());writer.newLine();}} catch (IOException e) {e.printStackTrace();}//清除缓存map.clear();limit.clear();}public void mergeAndSort() throws Exception {files Files.list(Paths.get(subPath)).map(Path::toFile).filter(f - f.length() 0).collect(Collectors.toList());// 创建 ForkJoinPoolForkJoinPool forkJoinPool new ForkJoinPool();MergeFileTask mergeFileTask new MergeFileTask(files.toArray(new File[0]), forkJoinPool);Path finalPath mergeFileTask.invoke();System.out.println(final path: finalPath.toAbsolutePath());try (BufferedReader reader Files.newBufferedReader(finalPath)) {String line;while ((line reader.readLine()) ! null) {System.out.println(line);}}mergeFileTask.finished();}public void finished() throws IOException {if (!CollectionUtils.isEmpty(files)){files.stream().parallel().forEach(File::delete);}Files.deleteIfExists(Paths.get(subPath));}public MapString, AtomicInteger limit(MapString, AtomicInteger map, int limit) {// 排序并过滤结果return map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.comparing(AtomicInteger::get).reversed())).limit(limit).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue,(oldValue, newValue) - oldValue, // 解决键冲突LinkedHashMap::new));}}测试 Test public void bb() throws Exception {StopWatch stopWatch new StopWatch();stopWatch.start();File log new File(E:\\log_total.log\\log_total.log);//2023-09-26 11:10:00.123 INFO - none --- [main] com.example.service.UserService.create:42 - User service started successfully.//匹配出 com.example.service.UserService.create:42//c.y.c.w..*指文件名太长缩写ListString list Arrays.asList((com\\.xx\\.[\\w\\.\\*]*:\\d*), (c\\.y\\.c\\.[\\w\\.\\*]*:\\d*));LogParAnalyzer logAnalyzer new LogParAnalyzer(log, list);logAnalyzer.analyze();logAnalyzer.mergeAndSort();logAnalyzer.finished();stopWatch.stop();System.out.println(stopWatch.prettyPrint());//最后统计格式//c.y.c.s.service.impl.Service.complete:98 count: 6 }good luck!
http://www.dnsts.com.cn/news/244123.html

相关文章:

  • 河北省建设执业资格注册管理中心网站做网站的皮包公司
  • 网站开发平台介绍网站设计照着做 算侵权吗
  • 网站建设作业素材网站顶部展出的大幅广告
  • 做网站样本电销好做吗wordpress仿内涵段子
  • 如何把自己做的网站放到内网正能量erp软件下载网站
  • crm系统哪种品牌的好网站seo专员
  • 公司网站建设调研问卷地方旅游网站建设必要性
  • 浑南区建设局网站线上设计师招聘
  • 淘宝客网站建设多少钱电子信息工程系部网站建设方案
  • 国外建站系统网上注册公司系统
  • 网站页面下沉的特效代码wordpress portfolio插件
  • 顺天亿建设网站新沂网络营销是什么
  • 阜南做网站网页设计教程孟宪宁课后题答案
  • 网站开发各个文件用h5做的网站
  • 下载网站备案的核验单办公空间设计装修
  • 数据网站建设成本网络营销的分类
  • 锦州网站建设新闻单页设计多少钱
  • 海外访问国内网站 dns营销推广公司
  • 织梦安装网站后图片苏州seo培训多少钱
  • 营销网站建设yyeygtytty婚介做网站的好处
  • 怎样看网站有没有做301网站建设方法冫金手指排名26
  • 制作俄语网站推广自己的网站
  • 网站空间续费合同vs可以做网站吗
  • 网站建设 中企动力嘉兴0573国外用什么做网站
  • 简单的美食网站模板免费下载做网站的数据库的设计
  • 网站排名优化各公司的顺风顺水的公司名字
  • 企业网站新模式中文域名注册收费标准
  • 网站建设方案可以乱写吗舆情分析
  • 江西那家做网站公司好都匀住房和城乡建设局网站
  • wordpress 去除category网站优化宝