0

I'm in a strange issue. I started working on an already developed app. During normal development I added some logs as I normally would, but I can't see them in logcat

code is nothing special:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_homepage);

        Log.v("MYDEV", "oncreate");
        presenter.start();
    }

So I can see all other logs from the app but the one from my line. Debugger stops on the line, so it is executed. It happens in various places, not just this one. I tried restarting both Android Studio, logcat and phone, uninstalling the app etc... nothing works.

Any idea?

EDIT: tried System.out.println() and it's working. Will use this for now, but it's not the same thing EDIT2: as discovered later and suggest by the answers, my Huawey P10 does not enable debug and verbose logs level by default, logs works from info level and above. verbose logs can be enabled from developer options, but there's no option for debug level

jack_the_beast
  • 1,838
  • 4
  • 34
  • 67
  • this might sounds stupid but it happened to me once, check your logcat lvl since you are choosing log.v (verbose) you might have selected a different level to show – Yamen Nassif May 22 '18 at 09:06
  • Can you try to debug it and add a stop point on the exact line ? see what the debugger will say at that point ? – Yamen Nassif May 22 '18 at 10:06
  • also found couple of answers over here check them out; https://stackoverflow.com/q/28434901/2724879 – Yamen Nassif May 22 '18 at 10:08
  • I tried to print the other level and it looks like I can only get info, error and warning logs. Looks like Huawei phones have debug and verbose level disable by default but I can't find a way to activate them for my P10.... – jack_the_beast May 22 '18 at 10:41

1 Answers1

1

After searching for a bit found out that Huawei disabled debug and verbose log levels, in order to enable it you can try this:

dial *#*#2846579#*#* choose Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).

if this didnt work you will find more options over here Huawei, logcat not showing the log for my app? depending on your version/mobile

Since this is not working on some devices as well, another question on SO Can't enable DEBUG & VERBOSE for Huawei Android Logcat suggested changing Android logging framework to Timber library and provided in the comments a blog post on how to do so.

and still one more way possible which is to use System.out.println(); as suggested by @jack_the_beast the question owner in the comments;

Yamen Nassif
  • 2,416
  • 2
  • 24
  • 48
  • already find out that, but unfortunately on my P10, log settings only opens a dialog with the following chechboxes: AP Log, Charge Log, Sleep Log. none seems to enable verbose and error – jack_the_beast May 24 '18 at 14:26
  • It's really a chinese company lol, anyway found another blog about this you probably saw before, but just in case you didn't and/or for other people: http://ashraffouad.blogspot.de/2017/04/enable-debug-verbose-for-huawei-android.html – Yamen Nassif May 24 '18 at 14:30
  • 1
    I just realized I didn't look in the developer options... verbose logs can be enabled from there, but there's no option for debug level – jack_the_beast May 24 '18 at 14:41