Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Output #48

Closed
caelinsutch opened this issue May 21, 2020 · 4 comments
Closed

No Output #48

caelinsutch opened this issue May 21, 2020 · 4 comments

Comments

@caelinsutch
Copy link

I'm getting no log output.

pubspec.yaml

environment:
  sdk: ">=2.1.0 <3.0.0"
...
dependencies
  logger: 0.9.1

main.dart

main() {
  var logger = Logger();

  logger.e("Logger is working!");
  print("logger");
}

"Logger is working" doesn't print, but "logger" does.

@caelinsutch
Copy link
Author

Note, running with dart --enable-asserts example/main.dart works. Is this required? If so, it should be noted in the documentation.

@haarts
Copy link
Collaborator

haarts commented May 27, 2020

The default logger as you are using it uses the DevelopmentFilter (see https://pub.dev/documentation/logger/latest/logger/Logger/Logger.html). That filter doesn't log anything in "production" mode, this is defined as not using asserts. Running a program with the dart interpreter w/o arguments does not use asserts/run the program in production mode. The README explains this too: https://github.com/leisim/logger#logfilter

I hope this helps.

@haarts haarts closed this as completed May 27, 2020
@rubenvereecken
Copy link

rubenvereecken commented Apr 5, 2021

This was far, far too hidden, and we spent far, far too much time finding it. Thanks, will give this a try.

It's a strange construction though, do I really need to use a different filter depending on whether the app is in dev/prod? The default is DevelopmentFilter. Since we use a FileOutput, we very much want to log in production, so we can generate a log file for reporting in release.

Edit: Suppose we'll just stick to ProductionFilter for everything.

@CBeening
Copy link

CBeening commented Oct 7, 2024

This indeed was too hidden and unexpected behaviour.
The main reason for using such a logger would probably be to get logs during production.

If I only want them while developing I might aswell use print everywhere.

Using ProductionFilter for everything now aswell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants