Java android get logs in file -
this how logs application :
try { simpledateformat sdf = new simpledateformat( "yyyy-mm-dd", locale.us); string currentdateandtime = sdf.format(new date()); final file path = new file(environment.getexternalstoragedirectory(), "smok_komunal"); if (!path.exists()) { path.mkdir(); } log.e("path ", path.getabsolutepath()); runtime.getruntime().exec("logcat -f " + path + file.separator + "dbo_logcat_" + currentdateandtime + ".txt"); } catch (ioexception e) { e.printstacktrace(); }
but in logs don't have a date , time in lines how can add date , time ?
for getting date , time print log this:
log.e("path ", path.getabsolutepath()+ " , "+currentdateandtime );
it give both file path , date , time
Comments
Post a Comment