mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 18:37:17 +00:00 
			
		
		
		
	Stop logging in exception free way
This commit is contained in:
		
							parent
							
								
									9cbf572510
								
							
						
					
					
						commit
						080b3f56fc
					
				| @ -113,7 +113,8 @@ public class Log_OC { | |||||||
| 
 | 
 | ||||||
|     public static void stopLogging() { |     public static void stopLogging() { | ||||||
|         try { |         try { | ||||||
|             mBuf.close(); | 			if (mBuf != null) | ||||||
|  |                 mBuf.close(); | ||||||
|             isEnabled = false; |             isEnabled = false; | ||||||
| 
 | 
 | ||||||
|             mLogFile = null; |             mLogFile = null; | ||||||
| @ -123,7 +124,13 @@ public class Log_OC { | |||||||
|             isEnabled = false; |             isEnabled = false; | ||||||
| 
 | 
 | ||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
|             e.printStackTrace(); |             // Because we are stopping logging, we only lon to Android console. | ||||||
|  |             Log.e("OC_Log", "Closing log file failed: ", e); | ||||||
|  |         } catch (Exception e) { | ||||||
|  |             // This catch should never fire because we do null check on mBuf. | ||||||
|  |             // But just for the sake of stability let's log this odd situation. | ||||||
|  |             // Because we are stopping logging, we only lon to Android console. | ||||||
|  |             Log.e("OC_Log", "Stopping logging failed: ", e); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user