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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -