예제 #1
0
        public void UncaughtException(Thread thread, Throwable ex)
        {
            //1.��ȡӦ�ó���汾��Ϣ
            string version = string.Empty;
            PackageManager pm = context.PackageManager;
            try
            {
                PackageInfo info = pm.GetPackageInfo(context.PackageName, 0);
                string versionName = info.VersionName;
                version += ("����汾��Ϊ:" + versionName);

                string time = DateTime.Now.ToString("yyyyMMdd");
                string fileName = "crash-" + time + "-" + DateTime.Now.ToString("fff") + ".log";
                if (Android.OS.Environment.ExternalStorageState.Equals(Android.OS.Environment.MediaMounted))
                {
                    var path = "/sdcard/crash/";

                    using (StreamWriter streamWriter = System.IO.File.AppendText(path + fileName))
                    {
                        streamWriter.WriteLine("{0:yyyy-MM-dd HH:mm:ss} {1}", DateTime.Now, version);
                    }
                }
            }
            catch (System.Exception e)
            {
            }
            Toast.MakeText(context, "�ܱ�Ǹ,��������쳣,�����˳�.", ToastLength.Long).Show();
            //�����Ӧ�ó�����ɱ
            Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
        }
예제 #2
0
 public static void LogVerbose(String tag, String message, Throwable cause)
 {
     //noinspection PointlessBooleanExpression,ConstantConditions
     if ( Config.Debug && Log.IsLoggable(tag, LogPriority.Verbose)) {
     if (cause != null) Log.Verbose(tag, message, cause);
     }
 }
			public void UncaughtException (Java.Lang.Thread thread, Throwable ex)
			{
				Mint.XamarinException (ex.ToJavaException (), false, null);
				LastBreath ();
				UncaughtExceptionHandled (null, ex);
			}
예제 #4
0
		/**
     	* Prints a message at DEBUG priority.
     	*/
		public static void Debug (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Debug, tag, msg, tr);
		}
예제 #5
0
		/**
    	* Instructs the LogNode to print the log data provided. Other LogNodes can
     	* be chained to the end of the LogNode as desired.
     	*/
		public static void WriteLine (LogPriority priority, string tag, string msg, Throwable tr)
		{
			if (mLogNode != null)
				mLogNode.WriteLine (priority, tag, msg, tr);
		}
예제 #6
0
		/**
     	* Prints a message at ASSERT priority.
     	*/
		public static void Wtf (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Assert, tag, msg, tr);
		}
예제 #7
0
		/**
     	* Prints a message at WARN priority.
     	*/
		public static void Warn (string tag, Throwable tr)
		{
			Warn (tag, null, tr);
		}
예제 #8
0
		/**
     	* Prints a message at INFO priority.
     	*/
		public static void Info (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Info, tag, msg, tr);
		}
		public static void e(string tag, string str, Throwable t)
		{
			if (EnableLog) Log.Error(tag, t, str);
		}
예제 #10
0
        public void UncaughtException(Thread thread, Throwable ex)
        {
            Toast.MakeText(mContext, "�ܱ�Ǹ,��������쳣,�����˳�.", ToastLength.Long).Show();

            if (!handleException(ex) && mDefaultHandler != null)
            {
                //����û�û�д�������ϵͳĬ�ϵ��쳣������������
                mDefaultHandler.UncaughtException(thread, ex);
            }
            else
            {
                try
                {
                    Thread.Sleep(3000);
                }
                catch (InterruptedException e)
                {
                    Log.Error(TAG, "error : ", e);
                    //�˳�����
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                    //System.exit(1);
                }
            }
        }
예제 #11
0
 public void UncaughtException(Java.Lang.Thread t, Java.Lang.Throwable e)
 {
     @interface?.UncaughtException(t, e);
     action(t, e);
 }
예제 #12
0
 public /* override */ virtual void OnTextureSourceLoadExeption(Texture pTexture, ITextureSource pTextureSource, Throwable pThrowable)
 {
     Debug.E("Exception loading TextureSource. Texture: " + pTexture.ToString() + " TextureSource: " + pTextureSource, pThrowable);
 }
예제 #13
0
 public /* override */ virtual void OnTextureSourceLoadExeption(Texture pTexture, ITextureSource pTextureSource, Throwable pThrowable) { }
예제 #14
0
 public void UncaughtException(Java.Lang.Thread unusedThread, Java.Lang.Throwable e)
 {
     this.e = e;
     activity.RunOnUiThread(Run);
 }
예제 #15
0
파일: TLog.cs 프로젝트: decriptor/tomdroid
 public static void w(string tag, Throwable t, string msg, params object[] args)
 {
     Log.Warn(tag, string.Format(msg, args));
 }
예제 #16
0
		public static System.Exception ToException (Throwable e)
		{
			if (e == null)
				throw new ArgumentNullException ("e");

			return e;
		}
예제 #17
0
        //void Thread.IUncaughtExceptionHandler.UncaughtException(Thread thread, Throwable ex)
        //{
        //    Toast.MakeText(mContext, "�ܱ�Ǹ,��������쳣,�����˳�.", ToastLength.Long).Show();
        //    if (!handleException(ex) && mDefaultHandler != null)
        //    {
        //        //����û�û�д�������ϵͳĬ�ϵ��쳣������������
        //        mDefaultHandler.UncaughtException(thread, ex);
        //    }
        //    else
        //    {
        //        try
        //        {
        //            Thread.Sleep(3000);
        //        }
        //        catch (InterruptedException e)
        //        {
        //            Log.Error(TAG, "error : ", e);
        //        //�˳�����
        //        Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
        //        //System.exit(1);
        //    }
        //}
        /**
         * �Զ��������,�ռ�������Ϣ ���ʹ��󱨸�Ȳ������ڴ����.
         *
         * @param ex
         * @return true:��������˸��쳣��Ϣ;���򷵻�false.
         */
        private bool handleException(Throwable ex)
        {
            if (ex == null)
            {
                return false;
            }

            new Thread(() =>
            {
                Looper.Prepare();
                Toast.MakeText(mContext, "�ܱ�Ǹ,��������쳣,�����˳�.", ToastLength.Long).Show();
                Looper.Loop();
            }).Start();

            //ʹ��Toast����ʾ�쳣��Ϣ
            //new Thread() {
            //    @Override
            //    public void run() {
            //        Looper.prepare();
            //        Toast.makeText(mContext, "�ܱ�Ǹ,��������쳣,�����˳�.", Toast.LENGTH_LONG).show();
            //        Looper.loop();
            //    }
            //}.start();
            //�ռ��豸������Ϣ
            collectDeviceInfo(mContext);
            ////������־�ļ�
            //saveCrashInfo2File(ex);
            return true;
        }
 public void UncaughtException(Thread thread, Throwable ex)
 {
     Insights.Report(ex);
 }
예제 #19
0
 ///** 
 // * ���������Ϣ���ļ���
 // *
 // * @param ex
 // * @return  �����ļ�����,���ڽ��ļ����͵�������
 // */
 private string saveCrashInfo2File(Throwable ex)
 {
     StringBuffer sb = new StringBuffer();
     foreach (var info in infos)
     {
         string key = info.Key;
         string value = info.Value;
         sb.Append(key + "=" + value + "\n");
     }
     //for (Map.Entry<String, String> entry : infos.entrySet()) {
     //    String key = entry.getKey();
     //    String value = entry.getValue();
     //    sb.append(key + "=" + value + "\n");
     //}
     //Writer writer = new StringWriter();
     //PrintWriter printWriter = new PrintWriter(writer);
     //ex.printStackTrace(printWriter);
     //Throwable cause = ex.getCause();
     //while (cause != null) {
     //    cause.printStackTrace(printWriter);
     //    cause = cause.getCause();
     //}
     //printWriter.close();
     //String result = writer.toString();
     //sb.append(result);
     //try {
     //    long timestamp = System.currentTimeMillis();
     //    String time = formatter.format(new Date());
     //    String fileName = "crash-" + time + "-" + timestamp + ".log";
     //    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
     //        String path = "/sdcard/crash/";
     //        File dir = new File(path);
     //        if (!dir.exists()) {
     //            dir.mkdirs();
     //        }
     //        FileOutputStream fos = new FileOutputStream(path + fileName);
     //        fos.write(sb.toString().getBytes());
     //        fos.close();
     //    }
     //    return fileName;
     //} catch (Exception e) {
     //    Log.e(TAG, "an error occured while writing file...", e);
     //}
     return null;
 }
예제 #20
0
		/**
     	* Prints a message at WARN priority.
     	*/
		public static void Warn (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Warn, tag, msg, tr);
		}
예제 #21
0
 public static void LogDebug( String tag, String message, Throwable cause)
 {
     if (Log.IsLoggable(tag, LogPriority.Debug)) {
     if (cause != null) Log.Debug(tag, message, cause);
     }
 }
예제 #22
0
		/**
     	* Prints a message at ERROR priority.
     	*/
		public static void Error (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Error, tag, msg, tr);
		}
예제 #23
0
 public static void LogError( String tag, String message, Throwable cause)
 {
     Log.Error(tag, message, cause);
 }
예제 #24
0
		/**
     	* Prints a message at ASSERT priority.
     	*/
		public static void Wtf (string tag, Throwable tr)
		{
			Wtf (tag, null, tr);
		}
예제 #25
0
 public static void LogInfo( String tag, String message, Throwable cause)
 {
     Log.Info(tag, message, cause);
 }
예제 #26
0
		/**
     	* Prints a message at VERBOSE priority.
     	*/
		public static void Verbose (string tag, string msg, Throwable tr)
		{
			WriteLine (LogPriority.Verbose, tag, msg, tr);
		}
예제 #27
0
 public static void LogWarn( String tag, String message, Throwable cause)
 {
     Log.Warn(tag, message, cause);
 }
			static void OnUncaughtExceptionHandled(object sender, Throwable ex)
			{
				OnUnhandledExceptionHandled(ex, "Throwable");
			}
예제 #29
0
 protected Exception(string p0, Throwable p1, bool p2, bool p3)
 {
     throw new NotSupportedException("The Java.Lang.Exception(string, Throwable, bool, bool) constructor was erroneously bound. It does not exist.");
 }
예제 #30
0
 protected RuntimeException(string p0, Throwable p1, bool p2, bool p3)
 {
     throw new NotSupportedException ("The Java.Lang.RuntimeException(string, Throwable, bool, bool) constructor was erroneously bound. It does not exist.");
 }
예제 #31
0
파일: TLog.cs 프로젝트: decriptor/tomdroid
 public static void v(string tag, Throwable t, string msg, params object[] args)
 {
     if (LOGGING_ENABLED) Log.Verbose(tag, string.Format(msg, args));
 }