Я читаю файл журнала с помощью BufferedReader , и я хочу извлечь конкретный трассировку стека из файла журнала. However, I cannot read it, the output is empty.
for example I have an exception for the word: client
and the stack trace for it is like:
java.sql.SQLException: Unknown column 'client' in 'field list'
SELECT Query < /p>
at com.mysql.jdbc.mysqlio.checkerrorpate (mysqlio.java:2928) на
com.mysql.jdbc.mysqlio.sendcommand (mysqlio.java:1571) at
at
at
at
at
at
at
at
at
at
com.mysql.jdbc.mysqlio.sqlquerydirect (mysqlio.java:1666) на
com.mysql.jdbc.connection.execsql (connection.java:2994) at
com.mysql.jdbc.preparedStatement.executeInternal (PrediveStatement.java:936)
at
com.mysql.jdbc.preparedstatement.executequery (Presestatement.java:1030)
telemed.admin.dao.admindao.gettelevisitordata (Admindao.java:87) на
telemed.admin.adminservice.getTelevisitors (AdminService.java:31) at
org.apache.jsp.jsp.telemed.telemedresponse_jsp._jspservice (telemedresponse_jsp.java:330)
at org.apache.jasper.runtime.httpjspbase.service (httpjspbas javax.servlet.http.httpservlet.service (httpservlet.java:728) at
org.apache.jasper.servlet.jspservletwrapper.service (jspservletwrapper.java:432)
at
org.apache.jasper.servlet.jspservlet.servicejspfile (jspservlet.java:390)
at org.apache.jasper.servlet.jspservlet.service (jspservlet.java:334)
javax.servlet.http.httpservlet.service (httpservlet.java:728) at
org.apache.catalina.core.applicationFilterChain.InternaldOfilter (ApplicationFilterChain.java:305)
at
org.apache.catalina.core.applicationfilterchain.dofilter (ApplicationFilterChain.java:210)
at
org.apache.tomcat.websocket.server.wsfilter.dofilter (wsfilter.java:51)
at
org.apache.catalina.core.applicationfilterchain.internaldofilter (ApplicationFilterChain.java:243) < /p>
< /blockquote>
Я пытаюсь прочитать трассировку стека, которое имеет конкретное слово, но не в строке исключения. />
BufferedReader br=new BufferedReader(new FileReader("E:/exp.txt"));
String temp;
Pattern expPattern=Pattern.compile("(?s).*Exception:.*client.*[\\n\\r].*");
while((temp=br.readLine())!=null){
//System.out.println("line::::"+temp);
Matcher headlineMatcher=expPattern.matcher(temp);
if(headlineMatcher.find()){
System.out.println("=>"+temp);
temp=null;
}
}
Подробнее здесь: https://stackoverflow.com/questions/349 ... le-in-java