how to read lines start with string : Err from a text file and mail it to the recipients using JAVA
<ol>
<li><p>I have an <em>error log</em> text file</p></li>
<li><p>Now I would like to read all the lines start with the text <code>Err</code> ,and store it in to a <code>String Array</code> using <code>Java</code></p></li>
<li><p>Mail the content of the <code>String array</code> read</p></li>
</ol>

<p>My piece of JAVA code:</p>

<pre><code>MimeMessage message = new MimeMessage(session); 
String pathLogFile = "D:/logfile.log";
Enumeration enumeration =    
CarParser1.logger.getRootLogger().getAllAppenders();
            while ( enumeration.hasMoreElements() ){
               Appender appender = (Appender) enumeration.nextElement();
               if ( appender instanceof FileAppender ){
                  pathLogFile  = ((FileAppender)appender).getFile();    
//here you get the path
                  break;
               }
            }
            StringBuffer sb = new StringBuffer();
            FileInputStream fstream = new FileInputStream(pathLogFile);
            BufferedReader br = new BufferedReader(new 
InputStreamReader(fstream));

            String singleLine;
            while ((singleLine = br.readLine()) != null) {
              sb.append(singleLine + "&lt;br&gt;");
            }
            br.close();
            String allLines = sb.toString();
     message.setContent(allLines, "text/html; charset=ISO-8859-1");
     Transport.send(message);
    System.out.println("Email Sent successfully....");
</code></pre>

<p>Can anyone help me to achieve this?</p>

<p>Thank you</p>