Skip to content

Commit

Permalink
Bump version to 2.0.11
Browse files Browse the repository at this point in the history
Includes the pull request from torax242.

Makes random sleep in PickGreeting configurable.
altenhof committed Mar 14, 2017
1 parent c31d1f0 commit abe194a
Showing 11 changed files with 27 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -26,11 +26,11 @@ All in all, you should do the following:
* pick your favorite logging implementation, and
* adjust your logging configuration accordingly.

Say, you want to make use of the *servlet filter* feature, then you need to add the following dependency to your POM with property `cf-logging-version` referring to the latest version (currently `2.0.10`):
Say, you want to make use of the *servlet filter* feature, then you need to add the following dependency to your POM with property `cf-logging-version` referring to the latest version (currently `2.0.11`):

```xml
<properties>
<cf-logging-version>2.0.10</cf-logging-version>
<cf-logging-version>2.0.11</cf-logging-version>
</properties>
```

2 changes: 1 addition & 1 deletion cf-java-logging-support-core/pom.xml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
<parent>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
<relativePath>../pom.xml</relativePath>
</parent>
<profiles>
2 changes: 1 addition & 1 deletion cf-java-logging-support-jersey/pom.xml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
</parent>

<name>cf-java-logging-support-jersey</name>
2 changes: 1 addition & 1 deletion cf-java-logging-support-log4j2/pom.xml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
</parent>

<properties>
2 changes: 1 addition & 1 deletion cf-java-logging-support-logback/pom.xml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
</parent>

<properties>
2 changes: 1 addition & 1 deletion cf-java-logging-support-servlet/pom.xml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<parent>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
<relativePath>../pom.xml</relativePath>
</parent>

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
<packaging>pom</packaging>

<name>Cloud Foundry Java logging support components</name>
2 changes: 2 additions & 0 deletions sample/README.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ A simple CF sample application that we cloned from [cloudfoundry-sticky-session]

Currently configured to use `log4j2` as the logging implementation.

It uses a environment variable `RANDOM_SLEEP` which, when set to `true` will introduce a artificial delay (up to 1 sec).

## Running it locally

You can use the following Maven target to run the application locally
4 changes: 3 additions & 1 deletion sample/manifest.yml
Original file line number Diff line number Diff line change
@@ -7,4 +7,6 @@ applications:
host: logging-sample-app
instances: 1
memory: 256M
path: target/logging-sample-app-2.0.10.war
path: target/logging-sample-app-2.0.11.war
env:
RANDOM_SLEEP: true
4 changes: 2 additions & 2 deletions sample/pom.xml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
<parent>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-parent</artifactId>
<version>2.0.10</version>
<version>2.0.11</version>
<relativePath>../pom.xml</relativePath>
</parent>

@@ -18,7 +18,7 @@
<slf4j.version>1.7.12</slf4j.version>
<jersey.version>2.22.2</jersey.version>
<javax.ws.version>2.0.1</javax.ws.version>
<cf-logging.version>2.0.10</cf-logging.version>
<cf-logging.version>2.0.11</cf-logging.version>
</properties>
<dependencies>
<dependency>
22 changes: 12 additions & 10 deletions sample/src/main/java/com/sap/hcp/cf/sample/PickGreeting.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.sap.hcp.cf.sample;
package com.sap.hcp.cf.sample;

import java.util.Random;
import java.util.Random;

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

public class PickGreeting {
private static Random random = new Random();

private static boolean DO_SLEEP = Boolean.getBoolean("RANDOM_SLEEP");

private static final String[] GREETINGS = new String[] {
"Hello Stranger",
"Bonjour!",
@@ -16,15 +17,16 @@ public class PickGreeting {
"What a beautiful day!",
"\u0c90 \u0ca0"
};

private static final Logger LOGGER = LoggerFactory.getLogger(PickGreeting.class);

public static String pick() {
try {
Thread.sleep(random.nextInt(1000));
}
catch (Exception ex) {
LOGGER.error("Thread.sleep() failed", ex);
if (DO_SLEEP) {
try {
Thread.sleep(random.nextInt(1000));
} catch (Exception ex) {
LOGGER.error("Thread.sleep() failed", ex);
}
}
String greeting = GREETINGS[random.nextInt(GREETINGS.length)];
LOGGER.info("Picked greeting : {}", greeting);

0 comments on commit abe194a

Please sign in to comment.