Must be a supported - * resource type. gae_app, gce_instance and container are auto-detected. + *
Must be a supported resource type. + * gae_app, gce_instance and container are auto-detected. * *
Defaults to "global" * @@ -144,6 +151,15 @@ public void setCredentialsFile(String credentialsFile) { this.credentialsFile = credentialsFile; } + /** + * Define synchronization mode for writing log entries. + * + * @param flag to set {@code Synchronicity} value. + */ + public void setWriteSynchronicity(Synchronicity flag) { + this.writeSyncFlag = flag; + } + /** Add extra labels using classes that implement {@link LoggingEnhancer}. */ public void addEnhancer(String enhancerClassName) { this.enhancerClassNames.add(enhancerClassName); @@ -161,6 +177,10 @@ String getLogName() { return (log != null) ? log : "java.log"; } + public Synchronicity getWriteSynchronicity() { + return (this.writeSyncFlag != null) ? this.writeSyncFlag : Synchronicity.ASYNC; + } + MonitoredResource getMonitoredResource(String projectId) { return MonitoredResourceUtil.getResource(projectId, resourceType); } @@ -253,6 +273,7 @@ Logging getLogging() { synchronized (this) { if (logging == null) { logging = getLoggingOptions().getService(); + logging.setWriteSynchronicity(writeSyncFlag); } } }