Write Exception Stack to Log : Log « Core Class « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Core Class » Log 
Write Exception Stack to Log
    
//package org.alldroid.forum.utils;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;

import android.util.Log;

public class ExceptionHelper {
  public static void WriteStack String tag, Exception ex ) {
    final Writer result = new StringWriter ();
    final PrintWriter printWriter = new PrintWriter result );
    ex.printStackTrace printWriter );
    String stacktrace = result.toString ();
    printWriter.close ();

    Log.e tag, stacktrace );
  }
}

   
    
    
    
  
Related examples in the same category
1.Use log
2.Log Utility
3.Log events
4.Log your action
5.Write an activity that looks like a pop-up dialog with a custom theme using a different text color.
6.Responsible for delegating calls to the Android logging system.
7.Dynamically defined), space efficient event logging to help instrument code for large scale stability and performance monitoring.
8.Logger and Logger Listener
9.Log Exception trace
10.Log a list of objects
11.Utility log tool
12.Debug Util
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.