diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java
index 1864a1e8f10..f163222afaf 100644
--- a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java
+++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java
@@ -26,7 +26,7 @@
public class QuickstartSample {
public static void main(String... args) throws Exception {
// Instantiates a client
- Datastore datastore = DatastoreOptions.defaultInstance().service();
+ Datastore datastore = DatastoreOptions.getDefaultInstance().getService();
// The kind for the new entity
String kind = "Task";
diff --git a/logging/cloud-client/README.md b/logging/cloud-client/README.md
new file mode 100644
index 00000000000..f98475a9aff
--- /dev/null
+++ b/logging/cloud-client/README.md
@@ -0,0 +1,29 @@
+# Getting Started with Stackdriver Logging and the Google Cloud Client libraries
+
+[Stackdriver Logging][logging] allows you to store, search, analyze, monitor,
+and alert on log data and events from Google Cloud Platform and Amazon Web
+Services.
+These sample Java applications demonstrate how to access the Cloud Storage API using
+the [Google Cloud Client Library for Java][google-cloud-java].
+
+[logging]: https://cloud.google.com/logging/
+[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
+
+## Quickstart
+
+Install [Maven](http://maven.apache.org/).
+
+Build your project with:
+
+ mvn clean package -DskipTests
+
+You can then run a given `ClassName` via:
+
+ mvn exec:java -Dexec.mainClass=com.example.logging.ClassName \
+ -DpropertyName=propertyValue \
+ -Dexec.args="any arguments to the app"
+
+### Writing a log entry (using the quickstart sample)
+
+ mvn exec:java -Dexec.mainClass=com.example.logging.QuickstartSample \
+ -Dexec.args="my-log"
diff --git a/logging/cloud-client/pom.xml b/logging/cloud-client/pom.xml
new file mode 100644
index 00000000000..2c38613ed7b
--- /dev/null
+++ b/logging/cloud-client/pom.xml
@@ -0,0 +1,57 @@
+
+
+ 4.0.0
+ come.example.logging
+ logging-google-cloud-samples
+ jar
+
+
+
+ doc-samples
+ com.google.cloud
+ 1.0.0
+ ../..
+
+
+
+ 1.8
+ 1.8
+ UTF-8
+
+
+
+
+ com.google.cloud
+ google-cloud-logging
+ 0.6.0
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ com.google.truth
+ truth
+ 0.30
+ test
+
+
+
diff --git a/logging/cloud-client/src/main/java/com/example/logging/QuickstartSample.java b/logging/cloud-client/src/main/java/com/example/logging/QuickstartSample.java
new file mode 100644
index 00000000000..58d5e92a97b
--- /dev/null
+++ b/logging/cloud-client/src/main/java/com/example/logging/QuickstartSample.java
@@ -0,0 +1,53 @@
+/*
+ Copyright 2016, Google, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package com.example.logging;
+
+// [START logging_quickstart]
+// Imports the Google Cloud client library
+
+import com.google.cloud.MonitoredResource;
+import com.google.cloud.logging.LogEntry;
+import com.google.cloud.logging.Logging;
+import com.google.cloud.logging.LoggingOptions;
+import com.google.cloud.logging.Payload.StringPayload;
+
+import java.util.Collections;
+
+public class QuickstartSample {
+
+ public static void main(String... args) throws Exception {
+ // Instantiates a client
+ Logging logging = LoggingOptions.getDefaultInstance().getService();
+
+ // The name of the log to write to
+ String logName = args[0]; // "my-log";
+
+ // The data to write to the log
+ String text = "Hello, world!";
+
+ LogEntry entry = LogEntry.newBuilder(StringPayload.of(text))
+ .setLogName(logName)
+ .setResource(MonitoredResource.newBuilder("global").build())
+ .build();
+
+ // Writes the log entry
+ logging.write(Collections.singleton(entry));
+
+ System.out.printf("Logged: %s%n", text);
+ }
+}
+// [END logging_quickstart]
diff --git a/logging/cloud-client/src/test/java/com/example/logging/QuickstartSampleIT.java b/logging/cloud-client/src/test/java/com/example/logging/QuickstartSampleIT.java
new file mode 100644
index 00000000000..66aa5685a65
--- /dev/null
+++ b/logging/cloud-client/src/test/java/com/example/logging/QuickstartSampleIT.java
@@ -0,0 +1,69 @@
+/*
+ Copyright 2016, Google, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package com.example.logging;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.cloud.logging.Logging;
+import com.google.cloud.logging.LoggingOptions;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+/**
+ * Tests for quickstart sample.
+ */
+@RunWith(JUnit4.class)
+@SuppressWarnings("checkstyle:abbreviationaswordinname")
+public class QuickstartSampleIT {
+
+ private ByteArrayOutputStream bout;
+ private PrintStream out;
+
+ private static final void deleteMyLog() {
+ Logging logging = LoggingOptions.getDefaultInstance().getService();
+
+ logging.deleteLog("my-log");
+ }
+
+ @Before
+ public void setUp() {
+ deleteMyLog();
+
+ bout = new ByteArrayOutputStream();
+ out = new PrintStream(bout);
+ System.setOut(out);
+ }
+
+ @After
+ public void tearDown() {
+ System.setOut(null);
+ deleteMyLog();
+ }
+
+ @Test
+ public void testQuickstart() throws Exception {
+ QuickstartSample.main("my-log");
+ String got = bout.toString();
+ assertThat(got).contains("Logged: Hello, world!");
+ }
+}
diff --git a/pom.xml b/pom.xml
index 84dddde24e2..b4e41bc1511 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,6 +105,7 @@
flexible/twilio
language/analysis
logging
+ logging/cloud-client
monitoring/v2
monitoring/v3
pubsub/cloud-client