question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We used to have some INFO logs, but they were considered spam by some users (#1439), so they were reduced to FINE (#1449). In general, open source libraries don’t log unless something is going wrong, and these log statements didn’t imply something was wrong.

However, in #1538 INFO-level logs were added back (in a different place, but same effective event). These could be a lower level, but it seems difficult for users to enable a higher logging level.

We do know applications can do something like this to squelch what is logged:

// May need to save this reference
Logger log = Logger.getlogger("io.grpc");
log.setLevel(Level.WARNING);

More than one project has been annoyed with the logging-by-default, but the number of Java developers who can handle logging.properties seems limited.

On Android, things are even worse because most phones almost always return false from Log.isLoggable() for lower log levels. Developer phones (like debug builds of Android) will return true, but few develop on such phones. This means that even when you configure java.util.logging to log lower levels, they won’t actually be logged. You can run a command like adb shell setprop log.tag.<MAGICTAG> VERBOSE for each class you want to log, where the MAGICTAG can be found from DalvikLogging.loggerNameToTag(), but this is so painful it isn’t close to practical.

Note that most Android applications don’t notice any problem with Log.isLoggable() because while it may return false, if you call the log anyway (say, via Log.v()) apparently it will be logged.

One developer suggested we use slf4j because it is “java best practices.” I think in some part of the Java world it is, but it is unclear whether grpc exists in that part of the world. The number of developers that can configure java.util.logging, log4j, logback, or slf4j is certainly higher than just java.util.logging, but it will also become harder to direct users in how to enable logging when we need it for a report. It also has the deficiency that “If no binding is found on the class path, then SLF4J will default to a no-operation implementation” which is pretty bad for our WARNING statements.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:6
  • Comments:32 (11 by maintainers)

github_iconTop GitHub Comments

22reactions
dieselpointcommented, Nov 5, 2016

SLF4J gets a BIG THUMBS DOWN!

I can’t disagree more strongly. Slf4j isn’t a logging framework, it’s a facade. It’s just a set of interfaces. The underlying implementation can be anything. JUL doesn’t easily allow other implementations.

GRPC is a library that fits into other apps, and it really should use whatever logging implementation the underlying app uses. The means that GRPC must write to an interface. You can either roll your own interface, or use Slf4j. I think Slf4j is a better choice.

20reactions
craigdaycommented, Nov 5, 2016

SLF4J gets a BIG THUMBS DOWN! from me. GRPC is (wonderful) infrastructure code/functionality. It should stick with JUL. It’s extremely annoying when library vendors choose a logging framework that you then have to cater for. I don’t have to think about JUL. It’s just there and it just works, and I can push it through any logging setup I choose!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Causes, Effects and Solutions To Clearing of Forests
Logging industries cut down trees for furniture, paper, ... The best solution to deforestation is to curb the felling of trees by enforcing...
Read more >
20+ Best Log Management Tools & Monitoring Software [2022]
Read detailed comparisons of various log management software, tools, and systems for logging, monitoring, analysis, visualization & more.
Read more >
Top 4 Logging Problems You Have Probably Faced and how ...
If you are looking for a Log management solution that aggregates, analyzes and uses AI to find and solve data related problems, you've...
Read more >
Solving Your Logging Problems with Logback - Stackify
Java has a number of logging frameworks, but only a handful of great choices. ... Solving Your Logging Problems with Logback.
Read more >
You are doing .NET logging wrong. Let's fix it - YouTube
Check out the Essentials course bundle: https://nickchapsas.com/p/from-zero-to-hero-course-bundleBecome a Patreon and get source code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found