-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cloud logging logback appender #2045
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
Cloud logging logback appender #2045
Conversation
|
@meltsufin , @gregw PTAL |
|
Changes Unknown when pulling 46dc384 on jabubake:cloud-logging-logback-adapter into ** on GoogleCloudPlatform:master**. |
|
Changes Unknown when pulling 0184291 on jabubake:cloud-logging-logback-adapter into ** on GoogleCloudPlatform:master**. |
| <appender name="CLOUD" class="com.google.cloud.logging.contrib.LoggingAppender"> | ||
| <level>DEBUG</level> <!-- Optional : default INFO --> | ||
| <log>application.log</log> <!-- Optional : default java.log --> | ||
| <enhancers>com.google.cloud.logging.TestLoggingEnhancer</enhancers> <!-- Optional --> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| Add the appender to your [Logback configuration](https://logback.qos.ch/manual/configuration.html) `logback.xml` | ||
| ```xml | ||
| <configuration> | ||
| <appender name="CLOUD" class="com.google.cloud.logging.contrib.LoggingAppender"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return MonitoredResourceUtil.getResource(projectId, resourceType); | ||
| } | ||
|
|
||
| List<LoggingEnhancer> getEnhancers() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
meltsufin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jisha for putting this together!
| } | ||
|
|
||
| /** | ||
| * Sets the minimum logging level, defaults to INFO |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| List<LoggingEnhancer> enhancers = new ArrayList<>(); | ||
| if (list != null) { | ||
| String[] items = list.split(","); | ||
| for (String e_name : items) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| /** | ||
| * Add extra labels using classes that implement {@link LoggingEnhancer}. | ||
| * | ||
| * @param enhancers list of enhancer classnames |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Changes Unknown when pulling 4348833 on jabubake:cloud-logging-logback-adapter into ** on GoogleCloudPlatform:master**. |
|
Changes Unknown when pulling 8cd6b19 on jabubake:cloud-logging-logback-adapter into ** on GoogleCloudPlatform:master**. |
|
@garrettjonesgoogle PTAL |
| private String enhancers; | ||
|
|
||
| /** | ||
| * Batched logging requests get immediately flushed for logs at or above level. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| /** | ||
| * Sets the log filename, defaults to java.log. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * Sets the name of the monitored resource (Optional). | ||
| * | ||
| * <p>Must be a <a href="https://cloud.google.com/logging/docs/api/v2/resource-list">supported</a> | ||
| * resource type. gae_app, gce_instance and container are auto-detected, defaults to "global" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * <p>Must be a <a href="https://cloud.google.com/logging/docs/api/v2/resource-list">supported</a> | ||
| * resource type. gae_app, gce_instance and container are auto-detected, defaults to "global" | ||
| * | ||
| * @param resourceType name of monitored resource |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * | ||
| * @param enhancers list of enhancer classnames (comma separated) | ||
| */ | ||
| public void setEnhancers(String enhancers) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| <!-- Optional : filter logs at or above a level --> | ||
| <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
| <level>INFO</level> | ||
| </filter> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| ----------- | ||
|
|
||
| This library is usable, but not yet complete. | ||
| * Auto-reload of properties is not fully tested |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| super.stop(); | ||
| } | ||
|
|
||
| protected Logging getLogging() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| super.start(); | ||
| } | ||
|
|
||
| protected String getProjectId() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** Initialze and configure the cloud logging service. */ | ||
| @Override | ||
| public synchronized void start() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
enhancers now individual xml elements code cleanup based on review
|
Changes Unknown when pulling 667a4d0 on jabubake:cloud-logging-logback-adapter into ** on GoogleCloudPlatform:master**. |
|
Everything looks good, except the versions need to be updated again - s/0.17.2/0.18.0/ and s/0.17.3-alpha-SNAPSHOT/0.18.1-alpha/SNAPSHOT/ |
s/0.17.2/0.18.0
|
@garrettjonesgoogle done. |
|
LGTM |
Logback support for google-cloud-logging
Adding logback support (via Slf4j surface) for google-cloud-logging