2016-04-07 11 views
5

Perché Logcat non stampa un log quando il tag inizia con "IMS"?Perché Logcat non stampa un log quando il tag inizia con "IMS"?

@Override 
public void onClick(View v) { 
    switch (v.getId()) { 
     case R.id.btnOne: 
      System.out.println("Button One log by sout"); 
      Log.e("IMSfsadfasdfasdf", "log by Log.e()"); 
      break; 
     case R.id.btnTwo: 
      System.out.println("Button Two log by sout"); 
      Log.e("MService", "log by Log.e()"); 
      break; 
    } 
} 

Log:

04-07 15:05:48.838 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout 
04-07 15:05:49.916 4363-4363/com.licheedev.myapplication I/System.out: Button Two log by sout 
04-07 15:05:49.916 4363-4363/com.licheedev.myapplication E/MService: log by Log.e() 
04-07 15:05:54.109 4363-4363/com.licheedev.myapplication I/System.out: Button Two log by sout 
04-07 15:05:54.109 4363-4363/com.licheedev.myapplication E/MService: log by Log.e() 
04-07 15:05:54.822 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout 
04-07 15:05:55.638 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout 

Screenshot:

+2

Questo è strano. Ho provato anche nella mia app. Non ha stampato! – camelCaseCoder

+0

controlla il tuo log: nome tag ......... Dovrebbe essere lo stesso nome di cui hai parlato nella foto – sushildlh

+0

Sì, è strano. Ora è visibile anche nella mia app. –

risposta

10

io non sono esattamente sicuro, ma penso che questo ha a che fare con questa riga di codice nel meccanismo di registro di Android . Questo è in funzione __android_log_write(prio, tag, buf);

/* XXX: This needs to go! */ 
if (!strcmp(tag, "HTC_RIL") || 
    !strncmp(tag, "RIL", 3) || /* Any log tag with "RIL" as the prefix */ 
    !strncmp(tag, "IMS", 3) || /* Any log tag with "IMS" as the prefix */ 
    !strcmp(tag, "AT") || 
    !strcmp(tag, "GSM") || 
    !strcmp(tag, "STK") || 
    !strcmp(tag, "CDMA") || 
    !strcmp(tag, "PHONE") || 
    !strcmp(tag, "SMS")) { 
     log_id = LOG_ID_RADIO; 
     // Inform third party apps/ril/radio.. to use Rlog or RLOG 
     snprintf(tmp_tag, sizeof(tmp_tag), "use-Rlog/RLOG-%s", tag); 
     tag = tmp_tag; 
} 

Leggi this blog postale per informazioni dettagliate.

+0

Informazioni molto utili. Ho provato e nessuno dei tag è mostrato in Log che sono elencati nella risposta. +1 per la tua risposta. –

+0

Sì hai ragione, ho provato con ** RIL ** e ** AT **. Non stampa. +1! – camelCaseCoder

+0

Bella risposta! :) – thmspl