gRPC logging in ASP.NET Core












1















I have an ASP.NET Core application that is using gRPC to connect to some Google services. I seem to get occassional gRPC errors for some reason, without changing any code. So my preliminary question is:



Is gRPC susceptible to interference by any specific operation in ASP.NET Core?



I know that is a terribly vague question, but in all my logs, I have no indication of what is actually causing anomalies in my gRPC calls. So the real question is:



How can I implement gRPC specific logging? I get error messages fine, but it doesn't seem like I get any debug information output in my log files.



Also, how do I handle gRPC errors?



UPDATE



I my program class (entry point), I have added:



TextWriter tw = new StreamWriter(Path + @"grpclog.txt");
GrpcEnvironment.SetLogger(new TextWriterLogger(tw));
GrpcEnvironment.Logger.Info("grpc logger test");


However, no logs are generated. Is this an issue with my implementation of the logger?










share|improve this question

























  • Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

    – Panagiotis Kanavos
    Jan 2 at 12:15











  • In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

    – Panagiotis Kanavos
    Jan 2 at 12:20













  • I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

    – Harry Stuart
    Jan 2 at 12:27











  • You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

    – Panagiotis Kanavos
    Jan 2 at 12:35








  • 1





    1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

    – Jan Tattermusch
    Jan 10 at 14:08


















1















I have an ASP.NET Core application that is using gRPC to connect to some Google services. I seem to get occassional gRPC errors for some reason, without changing any code. So my preliminary question is:



Is gRPC susceptible to interference by any specific operation in ASP.NET Core?



I know that is a terribly vague question, but in all my logs, I have no indication of what is actually causing anomalies in my gRPC calls. So the real question is:



How can I implement gRPC specific logging? I get error messages fine, but it doesn't seem like I get any debug information output in my log files.



Also, how do I handle gRPC errors?



UPDATE



I my program class (entry point), I have added:



TextWriter tw = new StreamWriter(Path + @"grpclog.txt");
GrpcEnvironment.SetLogger(new TextWriterLogger(tw));
GrpcEnvironment.Logger.Info("grpc logger test");


However, no logs are generated. Is this an issue with my implementation of the logger?










share|improve this question

























  • Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

    – Panagiotis Kanavos
    Jan 2 at 12:15











  • In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

    – Panagiotis Kanavos
    Jan 2 at 12:20













  • I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

    – Harry Stuart
    Jan 2 at 12:27











  • You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

    – Panagiotis Kanavos
    Jan 2 at 12:35








  • 1





    1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

    – Jan Tattermusch
    Jan 10 at 14:08
















1












1








1








I have an ASP.NET Core application that is using gRPC to connect to some Google services. I seem to get occassional gRPC errors for some reason, without changing any code. So my preliminary question is:



Is gRPC susceptible to interference by any specific operation in ASP.NET Core?



I know that is a terribly vague question, but in all my logs, I have no indication of what is actually causing anomalies in my gRPC calls. So the real question is:



How can I implement gRPC specific logging? I get error messages fine, but it doesn't seem like I get any debug information output in my log files.



Also, how do I handle gRPC errors?



UPDATE



I my program class (entry point), I have added:



TextWriter tw = new StreamWriter(Path + @"grpclog.txt");
GrpcEnvironment.SetLogger(new TextWriterLogger(tw));
GrpcEnvironment.Logger.Info("grpc logger test");


However, no logs are generated. Is this an issue with my implementation of the logger?










share|improve this question
















I have an ASP.NET Core application that is using gRPC to connect to some Google services. I seem to get occassional gRPC errors for some reason, without changing any code. So my preliminary question is:



Is gRPC susceptible to interference by any specific operation in ASP.NET Core?



I know that is a terribly vague question, but in all my logs, I have no indication of what is actually causing anomalies in my gRPC calls. So the real question is:



How can I implement gRPC specific logging? I get error messages fine, but it doesn't seem like I get any debug information output in my log files.



Also, how do I handle gRPC errors?



UPDATE



I my program class (entry point), I have added:



TextWriter tw = new StreamWriter(Path + @"grpclog.txt");
GrpcEnvironment.SetLogger(new TextWriterLogger(tw));
GrpcEnvironment.Logger.Info("grpc logger test");


However, no logs are generated. Is this an issue with my implementation of the logger?







asp.net-core grpc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 14:25







Harry Stuart

















asked Jan 2 at 12:05









Harry StuartHarry Stuart

380313




380313













  • Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

    – Panagiotis Kanavos
    Jan 2 at 12:15











  • In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

    – Panagiotis Kanavos
    Jan 2 at 12:20













  • I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

    – Harry Stuart
    Jan 2 at 12:27











  • You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

    – Panagiotis Kanavos
    Jan 2 at 12:35








  • 1





    1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

    – Jan Tattermusch
    Jan 10 at 14:08





















  • Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

    – Panagiotis Kanavos
    Jan 2 at 12:15











  • In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

    – Panagiotis Kanavos
    Jan 2 at 12:20













  • I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

    – Harry Stuart
    Jan 2 at 12:27











  • You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

    – Panagiotis Kanavos
    Jan 2 at 12:35








  • 1





    1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

    – Jan Tattermusch
    Jan 10 at 14:08



















Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

– Panagiotis Kanavos
Jan 2 at 12:15





Is gRPC susceptible to interference no. gRPC is just an HTTP call with a specific payload. If your client code has issues you'll get errors. If the server has issues, you'll get errors. Add proper exception handling and logging to your application. Post those errors in the question itself. Post the code you use to make those HTTP calls.

– Panagiotis Kanavos
Jan 2 at 12:15













In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

– Panagiotis Kanavos
Jan 2 at 12:20







In any case calling a remote service can always fail. You may be hitting a rate limit, or encounter a connectivity error, or the service (which one?) may return a specific error eg due to concurrency issues. Your code may be blocking, resulting in a client timeout. Or perhaps your code just ignores error results, or the logging code itself may be throwing. It's impossible to answer such a vague question

– Panagiotis Kanavos
Jan 2 at 12:20















I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

– Harry Stuart
Jan 2 at 12:27





I know it’s vague and I’ve tried with basic logging. The issue I am facing is I just get an incomplete result and no information as to why. I am using Dialogflow. The thing with exception handling, is the issue I just described does not throw an exception in my code. I merely don’t get a full response. I need actual gRPC debug and info level output, not only error level output. I am just not sure how to do so.

– Harry Stuart
Jan 2 at 12:27













You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

– Panagiotis Kanavos
Jan 2 at 12:35







You don't need gRPC debugging because gRPC is just a payload protocol on top of HTTP. Whether you use HttpWebRequest or HttpClient, it's still an HTTP call. You can log the request and response the same way you'd log any other HTTP call. What does your code do? Do you check the response status code? Do you use another client library perhaps that hides status codes? Or perhaps you're calling a service that returns paged results?

– Panagiotis Kanavos
Jan 2 at 12:35






1




1





1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

– Jan Tattermusch
Jan 10 at 14:08







1. To get extra logs about what's going on with the gRPC stack, see github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. It also gives hint how to set gRPC verbosity level (to see more than just errors). 2. In general, ASP.NET core should have no influence on the gRPC stack is completely separate so these two should work completely independently. 3. Some above comments seem to indicate that gRPC C# uses .NET HttpWebRequest or HttpClient, which is incorrect. gRPC C# implementation is based on gRPC C core library that has its own http/2 client implementation.

– Jan Tattermusch
Jan 10 at 14:08














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54006056%2fgrpc-logging-in-asp-net-core%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54006056%2fgrpc-logging-in-asp-net-core%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith