How to write only application logs to an external file in android
<p>I am trying to write the logs of my application to an external file. My logs are like Log.e("Offset",""+mOffset); I am using the following code :</p>

<pre><code>public String writeLogToFile()
{
    try 
        {
            Process process = Runtime.getRuntime().exec("logcat -d");
            BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream()));
            StringBuilder log=new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) 
                {
                    log.append(line);
                }
            bufferedReader.close();
            return log.toString();
        } 
    catch (IOException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
}
</code></pre>

<p>It prints all the logs with system level also. Yes I am putting -d so it is printing but if i put -e or -i it does not write the the file. I just want to write the Log.e("Offset",""+mOffset). Where am i doing wrong. Thanx in advance.</p>
