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

structured logging: add source location discovery #686

Closed
minherz opened this issue Sep 27, 2021 · 3 comments · Fixed by #721
Closed

structured logging: add source location discovery #686

minherz opened this issue Sep 27, 2021 · 3 comments · Fixed by #721
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. lang: java Issues specific to Java. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@minherz
Copy link
Contributor

minherz commented Sep 27, 2021

Is your feature request related to a problem? Please describe.
If not defined, the sourceLocation field in LogEntry should be auto-populated when writing log entries to backend

Describe the solution you'd like
Source location info should be populated implicitly following the format

@minherz minherz added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. lang: java Issues specific to Java. labels Sep 27, 2021
@minherz minherz self-assigned this Sep 27, 2021
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Sep 27, 2021
@minherz
Copy link
Contributor Author

minherz commented Sep 27, 2021

Related issues #685, #686, #687, #688, #689, #690, #691

@minherz
Copy link
Contributor Author

minherz commented Oct 20, 2021

Source location auto-population should discover the source location for the caller of the Logging.write() interface by default.
In a case the caller does not call the interface directly (e.g. when it is happened from the logback appender) there should be an option to discover the caller based on hints such as number of calls along the callstack or an entry point which is expected to be called.

@minherz
Copy link
Contributor Author

minherz commented Oct 21, 2021

The method to get the source location info in Java 8 is to use the stack trace:

StackTraceElement[] stackTrace = (new Exception()).getStackTrace();

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. lang: java Issues specific to Java. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant