logger icon indicating copy to clipboard operation
logger copied to clipboard

print twice

Open YuPf1989 opened this issue 6 years ago • 4 comments

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

  • Android studio version:3.1.3

  • Android gradle plugin version:4.4

  • Logger version:2.2.0

  • Emulator/phone information:

  • If possible, please add how did you initialize Logger? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initData(); // log初始化 // CsvFormatStrategy strategy = CsvFormatStrategy.newBuilder() // .tag("custom") // .build(); Logger.addLogAdapter(new AndroidLogAdapter());

      // 将对象以类似json格式输出
      Logger.d(data);
    
      // 将json字符串输出
      JSONArray jsonArray = new JSONArray(data);
      Logger.json(jsonArray.toString());
    
      Log.e(TAG, "onCreate: ");
    

    }

  • Is it flaky or does it happen all the time? if I just finish the mainActivity,when I start the activity,will print twice.Unless I kill the app,clean the background,then it prints normal.But the Android's API log alway normal.

YuPf1989 avatar Jun 22 '18 07:06 YuPf1989

Only I initialize Logger in Application,it's OK.I'm confused, if it initializes in Activity's onCreat(),it seems addLogAdapter execute twice.

YuPf1989 avatar Jun 22 '18 07:06 YuPf1989

I'm also facing same issue How to resolve it It's log twice

bctpl avatar Oct 01 '19 06:10 bctpl

Same issue. I solved the problem adding Logger.addLogAdapter(AndroidLogAdapter()) in my child activity MainActivity and not in the abstract BaseActivity

vinzaceto avatar Oct 22 '19 20:10 vinzaceto

I have the same question .now ,I kown that what is the reason ,beycause i call Logger.addLogAdapter(AndroidLogAdapter()) twice in deferent place , So I delete one of them

beyondbycyx avatar Oct 26 '20 01:10 beyondbycyx