logger icon indicating copy to clipboard operation
logger copied to clipboard

how can i make the log file name as i want?

Open jerryzhj opened this issue 6 years ago • 4 comments

Please try to fill all questions below before submitting an issue.

  • Android studio version:
  • Android gradle plugin version:
  • Logger version:
  • Emulator/phone information:
  • If possible, please add how did you initialize Logger?
  • Is it flaky or does it happen all the time?

jerryzhj avatar Dec 05 '18 09:12 jerryzhj

I need to make file name different. but I do not know how to change it.

jerryzhj avatar Dec 05 '18 09:12 jerryzhj

@jerryzhj Take a look at com.orhanobut.logger.DiskLogStrategy.java, the line: 52 said that you can't change the file name if you're using DiskLogStrategy.java:

File logFile = getLogFile(folder, "logs");

If you want to change the file name your logs saved into, you can make a copy of DiskLogStrategy.java , use the name you want and set this as your log strategy.

lby1992 avatar Dec 30 '18 05:12 lby1992

I have same question, so I copy CsvFormatStrategy and DiskLogStrategy, custom them.

gist here

aotian16 avatar Dec 27 '19 02:12 aotian16

thx for all. I copy the DiskLogStrategy.java and addAdapter with it , then i custom it successfully. ` String diskPath = Environment.getExternalStorageDirectory().getAbsolutePath(); String folder = diskPath + File.separatorChar + "loggerR";

    HandlerThread ht = new HandlerThread("AndroidFileLogger." + folder);`

SunnyBoy-WYH avatar Oct 27 '20 12:10 SunnyBoy-WYH