25

I know based on documentation that

Debugging information is stripped out. Debugging is disabled.

But can we somehow force to print logs, or maybe debug in release mode? "production app" I'm using Android Studio.

For example while developing android app in AS we are able to print logs

android:debuggable="true"
asked Oct 26, 2020 at 12:51

5 Answers 5

19

Plug your phone (if it is the case) on your computer and type on terminal:

$ flutter logs

You should be able to choose the device you want to see logs.

answered Mar 17, 2022 at 19:02
Sign up to request clarification or add additional context in comments.

2 Comments

This does not show anything for me. flutter logs Showing ELE L29 logs:
FWIW, looks like the behavior here is that it tails the logs, so you'd run this command, choose the device you want, then run your app on that device
18

To check all available devices run flutter devices

Then run the below command to run the app in release mode with the logs
flutter run -d [deviceID] --release

answered Sep 7, 2023 at 7:58

1 Comment

even if you run it without -d [deviceID] you will be able to pick from the devices list right after executing flutter run --release
5

To display information that you would like to be visible in release mode ('production code') of your flutter app, simply use print() method. For info you want to hide in console log use debugPrint().

Maybe this part of documentation will help.

answered Mar 6, 2021 at 15:53

1 Comment

using pring or debugprint in release (flutter run --release) on ios does not log anything
3

If you are using logger package, you must add a permissive filter, since the default one only prints on debug:

import 'package:logger/logger.dart';
class PermissiveFilter extends LogFilter {
 @override
 bool shouldLog(LogEvent event) => true;
}
var logger = logger(filter: PermissiveFilter());
Mahesh Jamdade
20.8k11 gold badges132 silver badges150 bronze badges
answered Feb 9, 2024 at 20:26

Comments

0

If you use logger, pass filter parameter.

Logger(
 printer: PrettyPrinter(
 methodCount: 1,
 printEmojis: false,
 colors: false,
 dateTimeFormat: DateTimeFormat.onlyTime,
 noBoxingByDefault: true,
 ),
 output: _output,
 filter: ProductionFilter(), // here!
);
answered Apr 16 at 8:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.