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

Logging: Exceptions logged in google-cloud-logging-logback do not show in Error Reporting Console #28

Closed
tpapaj-CKPL opened this issue Dec 4, 2019 · 2 comments
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tpapaj-CKPL
Copy link

I am using Logging and I send logs using google-cloud-logging-logback. I want to use Error Reporting from an application that will run outside of Google Cloud. According to official documentation: https://cloud.google.com/error-reporting/docs/setup/java

Exceptions logged using the Stackdriver Logback Appender or java.util.logging Stackdriver Handler are automatically reported to the Error Reporting console.

However this is not true and exceptions do not show in Error Reporting. They are correctly logged and can be seen in log viewer.

Environment details

  1. OS type and version: Ubuntu 16.04
  2. Java version: Java 8
  3. google-cloud-java version(s): com.google.cloud:google-cloud-logging-logback:0.116.0-alpha

Steps to reproduce

  • Add dependency com.google.cloud:google-cloud-logging-logback:0.116.0-alpha and logback dependencies to Java project
  • Configure logback
  • Get a logger using Slf4j and try to log an exception running code below

Code example

Code examples below send a log to Google Logging and can be seen in viewer but not found in Error Reporting. The documentation does not show how exceptions should be logged so this is what I did:

log.error("Some message ", new RuntimeException("Exception"));
log.error("", new RuntimeException("Exception"));
log.error(Arrays.stream(new RuntimeException("Exception").getStackTrace())
                        .map(StackTraceElement::toString)
                        .collect(Collectors.joining("\n")));

Any additional information below

Using logback version 1.2.3

I think the cause is the fact that according to Error Reporting documentation: https://cloud.google.com/error-reporting/docs/formatting-error-messages a field serviceContext is a required one, there is no way to include it using google-cloud-logging-logback enhancers.

@chingor13 chingor13 transferred this issue from googleapis/google-cloud-java Dec 4, 2019
@chingor13 chingor13 added the type: question Request for information or clarification. Not an issue. label Dec 4, 2019
@google-cloud-label-sync google-cloud-label-sync bot added the api: logging Issues related to the googleapis/java-logging API. label Jan 29, 2020
@athakor athakor self-assigned this Mar 2, 2020
@athakor
Copy link
Contributor

athakor commented Mar 2, 2020

same issue found in googleapis/java-logging-logback#30

@athakor athakor added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed type: question Request for information or clarification. Not an issue. labels Mar 3, 2020
@athakor
Copy link
Contributor

athakor commented Mar 3, 2020

closing this issue as its duplicate.

@athakor athakor closed this as completed Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants