Skip to content

Commit 3a848fd

Browse files
authored
Changes for release v0_7. (#51)
1 parent 3199063 commit 3a848fd

1,350 files changed

Lines changed: 154984 additions & 24627 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
0.7.0 - 2019-02-01
2+
------------------
3+
Added support and examples for Google Ads API v0_7.
4+
5+
- Added support for request level logging.
6+
- Added GetHotelAdsPerformance example.
7+
- Updated GetKeywordStats example with segments prefix.
8+
19
0.6.0 - 2018-12-03
210
------------------
311
Added support and examples for Google Ads API v0_6.

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,87 @@ try (CampaignServiceClient reportingServiceClient = googleAdsClient.getCampaignS
260260
}
261261
```
262262

263+
### Request/Response Logging
264+
265+
Logging is configured with SLF4J a generic logging library for Java, which allows logs to be
266+
directed to many different logging implementations. We provide configuration files for log4j 1.2/2.0
267+
and Java Util Logging (JUL).
268+
269+
#### Logging layout and functionality
270+
271+
Requests are logged with a one line summary and the full request/response body and
272+
headers.
273+
274+
| Log type | Log name | Success level | Failure level |
275+
| -------- | -------------------------------------------- | ------------- | ------------- |
276+
| SUMMARY | com.google.ads.googleads.lib.request.summary | INFO | WARN |
277+
| DETAIL | com.google.ads.googleads.lib.request.detail | DEBUG | INFO |
278+
279+
#### Detail Log Truncation
280+
281+
The detailed logs are truncated by default to avoid creating large logs. To change the length at
282+
which logs are truncated, set `-Dapi.googleads.maxLogMessageLength=<number>`. Setting -1 disables
283+
log truncation.
284+
285+
#### Log4j 2.0
286+
287+
1. Add a dependency on the `log4j-slf4j-impl` library.
288+
289+
```
290+
<dependency>
291+
<groupId>org.apache.logging.log4j</groupId>
292+
<artifactId>log4j-slf4j-impl</artifactId>
293+
<version>2.11.1</version>
294+
</dependency>
295+
```
296+
297+
2. (Optional) Create a configuration file in your resources directory, e.g. in Maven
298+
`src/main/resources`. Log4j 2.0 loads its configuration file from the classpath, not the working
299+
directory, so ensure you create in a resources directory.
300+
301+
3. Run your application, specifying `-Dlog4j.configurationFile=<CONFIG_FILE_PATH>`. You can specify
302+
`CONFIG_FILE_PATH=googleads-logging/log4j2.xml` to use the default configuration file included
303+
with the client libraries.
304+
305+
#### Log4j 1.2 (legacy)
306+
307+
1. Add a dependency on the `slf4j-log4j12` library.
308+
309+
```
310+
<dependency>
311+
<groupId>org.slf4j</groupId>
312+
<artifactId>slf4j-log4j12</artifactId>
313+
<version>1.7.25</version>
314+
</dependency>
315+
```
316+
317+
2. (Optional) Create a configuration file in your projects resources directory, e.g. in Maven
318+
path is `src/main/resources`. Log4j 1.2 loads its configuration file from the classpath, not the
319+
working directory, so ensure you copy to a resources directory.
320+
321+
3. Run your application, specifying `-Dlog4j.configuration=<CONFIG_FILE_PATH>`. You can specify
322+
`CONFIG_FILE_PATH=googleads-logging/log4j.properties` to use the default configuration file included
323+
with the client libraries.
324+
325+
#### Java Util Logging
326+
327+
1. Add a dependency on the `slf4j-jdk14` library.
328+
329+
```
330+
<dependency>
331+
<groupId>org.slf4j</groupId>
332+
<artifactId>slf4j-jdk14</artifactId>
333+
<version>1.7.25</version>
334+
</dependency>
335+
```
336+
337+
2. Create a JUL configuration file on the file system in a path readable from your application. For
338+
instance `./jdk-logger.properties`. A template is provided at
339+
`google-ads/src/main/resources/googleads-logging/jdk-logger.properties`. JUL reads from the
340+
filesystem only, so do not copy to the resources directory.
341+
342+
3. Run your application specifying `-Djava.util.logging.config.file=./jdk-logger.properties`.
343+
263344
## Miscellaneous
264345

265346
### Wiki

google-ads-examples/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
-->
19-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
19+
<project xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2122

2223
<parent>
2324
<groupId>com.google.api-ads</groupId>
@@ -67,6 +68,11 @@
6768
<artifactId>joda-time</artifactId>
6869
<version>2.8.2</version>
6970
</dependency>
71+
<dependency>
72+
<groupId>org.apache.logging.log4j</groupId>
73+
<artifactId>log4j-slf4j-impl</artifactId>
74+
<version>2.11.1</version>
75+
</dependency>
7076
<!-- Test dependencies -->
7177
<dependency>
7278
<groupId>junit</groupId>

google-ads-examples/src/main/java/com/google/ads/googleads/examples/campaignmanagement/AddCampaignGroup.java

Lines changed: 0 additions & 180 deletions
This file was deleted.

google-ads-examples/src/main/java/com/google/ads/googleads/examples/recommendations/ApplyRecommendation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void runExample(
123123
googleAdsClient.getRecommendationServiceClient()) {
124124
ApplyRecommendationResponse response =
125125
recommendationServiceClient.applyRecommendation(
126-
Long.toString(customerId), false, operations);
126+
Long.toString(customerId), operations);
127127
System.out.printf("Applied %d recommendation:%n", response.getResultsCount());
128128
for (ApplyRecommendationResult result : response.getResultsList()) {
129129
System.out.println(result.getResourceName());

0 commit comments

Comments
 (0)