首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 计算机考试 > 等级考试 > 复习指导 >

log4jperl错误日志提取

2009-02-24 
Java教程

    日志
  #!/bin/perl
  useEncode;
  open(NOTESFILES,$ARGV[0]);
  my%errorMeganotes;
  print ">>>>>>>>>>>>>>",$ARGV[0],"<<<<<<<<<<n";
  while(<NOTESFILES>){
  if($_=~/^(d{4}-d{2}-d{2}sd{2}:d{2}:d{2})s+ERRORs+(.*)s/g){
  if($errorMeganotes{$2}){
  push@{$errorMeganotes{$2}},$1;
  }else{
  $errorMeganotes{$2}=[$1];
  }
  }
  }
  for(keys%errorMeganotes){
  my$tmp_keys=$_;
  my@tmp_array=@{$errorMeganotes{$tmp_keys}};
  print"errornumber:>>",scalar(@tmp_array),"<<n",encode("GBK",decode("UTF-8",$tmp_keys)),"n",join(",t",@tmp_array),"nnn";
  }
  sh
  #!/bin/sh
  nowDate=$(date-d’-1day’+%Y-%m-%d);
  echo$nowDate
  perl/data/apps/shell/meganotesErrorLog.pl/data/apps/meganotes/tomcat/logs/app/app.log.$nowDate> _tmp_$nowDate;
  perl/data/apps/shell/meganotesErrorLog.pl/data/apps/schedule/tomcat/logs/app/app.log.$nowDate >>_tmp_$nowDate;
  mail-s$nowDate-ERROR-log my@mail.com < _tmp_$nowDate;
  rm_tmp_$nowDate;
  结果:
  >>>>>>>/data/apps/meganotes/tomcat/logs/app/app.log.2009-02-18<<<<<<<<<
  error number :>>2<<
  MusicActionOpLogProxy:142 - music.popularTime=[Invalid field value for field "music.popularTime".]

 

3COME考试频道为您精心整理,希望对您有所帮助,更多信息在http://www.reader8.com/exam/

热点排行