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.

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.0.0

What JVM are you using (java -version)?

1.8

What did you do?

If possible, provide a recipe for reproducing the error. Not sure.

What did you expect to see?

No logs.

What did you see instead.

[id: 0xbf3948c7, L:/127.0.0.1:56373 - R:localhost/127.0.0.1:8080] DATA: streamId=5, padding=0, endStream=false, length=166, bytes=00000000a10a02696412640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

------------------------------------
11:36:20.377 [grpc-default-worker-ELG-2-13] DEBUG io.grpc.netty.NettyClientHandler - 
----------------INBOUND--------------------

[id: 0xbf3948c7, L:/127.0.0.1:56373 - R:localhost/127.0.0.1:8080] DATA: streamId=5, padding=0, endStream=false, length=166, bytes=00000000a10a02696412640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
11:36:20.377 [grpc-default-worker-ELG-2-13] DEBUG io.grpc.netty.NettyClientHandler - 
------------------------------------

I am pretty new to using grpc-java so this might be a very basic issue. When I run my code I receive extensive logging (seen above). So much so that it has crashed my IDE before. I have tried to follow the thread here:

https://github.com/grpc/grpc-java/issues/1577

Logger log = Logger.getlogger(“io.grpc”); log.setLevel(Level.WARNING);

Unfortunately, I have had no success. Has anyone else seen this issue or know of a solution?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
adam-26commented, Jun 19, 2017

This happens because netty uses SLF4J and it will bind to a logging framework if it exists in your class path.

Removing the log output is a 2 step process.

  1. Determine the logging framework SLF4J is bound to
  2. Configure the bound logging framework so that it doesn’t write debug output

An example of doing this can be found on StackOverflow (the code below is copied from the StackOverflow post).

import org.slf4j.impl.StaticLoggerBinder;

// 1. Determine what logging framework SLF4J is bound to:
final StaticLoggerBinder binder = StaticLoggerBinder.getSingleton();

// this will print the name of the logger factory to stdout
System.out.println(binder.getLoggerFactoryClassStr());
0reactions
thomasjungblutcommented, Jun 19, 2017

I worked around it by forcing log4j as the logging backend and setting io.netty to INFO.

static {
        InternalLoggerFactory.setDefaultFactory(Log4JLoggerFactory.INSTANCE);
        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        Configuration config = ctx.getConfiguration();
        LoggerConfig loggerConfig = config.getLoggerConfig("io.netty");
        loggerConfig.setLevel(Level.INFO);
        ctx.updateLoggers();
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to know when there's too much logging messages?
How to know when is too much logging? When you know that the logged information isn't important in the long term, ...
Read more >
There is no such thing as too much logging - or is there? - Reddit
Coming from an SRE, yes, you absolutely can log too much. Been in situations where logging to disk became such an expensive operation...
Read more >
10 Mistakes To Avoid For Effective Logging In Your Service
Audit the disk space used by log files regularly and alarm in case logging causes disk space shortage. Avoid emitting log without any...
Read more >
Logging. How much is too much? - Alex Aitken
This will give you a competitive edge. So, to answer the title question – there is no such thing as too much logging....
Read more >
Can not enable debug logs because there are "too many logs"
Open the Developer Console, switch to the SOQL query and run this query: SELECT Id FROM ApexLog. Select all the rows in this...
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