Skip to content

Commit

Permalink
Updated logging/
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtisvg committed Jan 12, 2018
1 parent 22be5ad commit ab5cd45
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 95 deletions.
3 changes: 3 additions & 0 deletions logging/cloud-client/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Getting Started with Stackdriver Logging and the Google Cloud Client libraries

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=logging/cloud-client/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[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.
Expand Down
12 changes: 7 additions & 5 deletions logging/cloud-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
<artifactId>logging-google-cloud-samples-api</artifactId>
<packaging>jar</packaging>

<!-- Parent defines config for testing & linting. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.logging.samples</groupId>
<artifactId>cloud-logging-samples</artifactId>
<version>1.0.0</version>
<relativePath>..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Copyright 2017 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.
*/
* Copyright 2017 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;

Expand Down Expand Up @@ -47,7 +47,7 @@ public static void main(String... args) throws Exception {
System.out.println(logEntry);
}
entries = entries.getNextPage();
} while(entries != null);
} while (entries != null);

}
// [END listlogs]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
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.
*/
* 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;

Expand All @@ -29,7 +29,8 @@
* This sample demonstrates writing logs using the Stackdriver Logging API.
* The library also offers a java.util.logging Handler `com.google.cloud.logging.LoggingHandler`
* Logback integration is also available : https://goo.gl/DNMoRh
* Using the java.util.logging handler / Logback appender should be preferred to using the API directly.
* Using the java.util.logging handler / Logback appender should be preferred to using the API
* directly.
*/
public class QuickstartSample {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Copyright 2017 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.
*/
* Copyright 2017 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;

Expand All @@ -39,7 +39,7 @@
@SuppressWarnings("checkstyle:abbreviationaswordinname")
public class LoggingIT {

private final String QUICKSTART_LOG = "my-log";
private static final String QUICKSTART_LOG = "my-log";
private final String TEST_WRITE_LOG = "test-log";

private ByteArrayOutputStream bout;
Expand Down
3 changes: 3 additions & 0 deletions logging/jul/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Getting Started with Stackdriver Logging using `java.util.logging`

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=logging/jul/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[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.
Expand Down
12 changes: 7 additions & 5 deletions logging/jul/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
<artifactId>logging-google-cloud-samples-jul</artifactId>
<packaging>jar</packaging>

<!-- Parent defines config for testing & linting. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.logging.samples</groupId>
<artifactId>cloud-logging-samples</artifactId>
<version>1.0.0</version>
<relativePath>..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
28 changes: 14 additions & 14 deletions logging/jul/src/main/java/com/example/logging/jul/Quickstart.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Copyright 2017 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.
*/
* Copyright 2017 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.jul;

Expand Down
15 changes: 15 additions & 0 deletions logging/jul/src/main/resources/logging.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright 2015 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.
#

# A default java.util.logging configuration.
#
# [START jul_config]
Expand Down
3 changes: 3 additions & 0 deletions logging/logback/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Getting Started with Stackdriver Logging using Logback

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=logging/logback/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[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.
Expand Down
12 changes: 7 additions & 5 deletions logging/logback/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
<artifactId>logging-google-cloud-samples-logback</artifactId>
<packaging>jar</packaging>

<!-- Parent defines config for testing & linting. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.logging.samples</groupId>
<artifactId>cloud-logging-samples</artifactId>
<version>1.0.0</version>
<relativePath>..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/*
Copyright 2017 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.
*/
* Copyright 2017 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.logback;

// [START logback_quickstart]

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

package com.example.logging.logback.enhancers;

// [START logging_enhancer]

import com.google.cloud.logging.LogEntry;
import com.google.cloud.logging.LoggingEnhancer;

Expand Down
12 changes: 8 additions & 4 deletions logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ limitations under the License.
<artifactId>cloud-logging-samples</artifactId>
<packaging>pom</packaging>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<artifactId>doc-samples</artifactId>
<groupId>com.google.cloud</groupId>
<version>1.0.0</version>
<relativePath>..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand All @@ -42,6 +45,7 @@ limitations under the License.
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>
3 changes: 0 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@
<module>language/analysis</module>
<module>language/cloud-client</module>

<!-- APIary based sample - broken for testing
<module>logging</module>
-->
<module>logging/cloud-client</module>

<module>monitoring/cloud-client</module>

Expand Down

0 comments on commit ab5cd45

Please sign in to comment.