Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 18cd167

Browse files
committed
Add logback-access, update readme
1 parent 0c1da39 commit 18cd167

File tree

7 files changed

+84
-9
lines changed

7 files changed

+84
-9
lines changed

.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export TWILIO_ACCOUNT_SID=AC4ee8a4bf66c95837fc46316395718baa
2+
export TWILIO_API_KEY=SKed26b2f58b7b62c4df51afe84cf4f2e3
3+
export TWILIO_API_SECRET=4aSAYLTwH56owOwCYWpnjK4zEEVFEKYQ
4+
export TWILIO_IPM_SERVICE_SID=ISfe24d1ae731340d581045465b1a253bd
5+
export TWILIO_AUTH_TOKEN=a9133ec06fdfb0ecf529b94cffd7772e
6+
export DB_URL=jdbc:postgresql://localhost:5432/browser_calls
7+
export DB_USERNAME=jose
8+
export DB_PASSWORD=
9+
10+
export TWILIO_APPLICATION_SID=APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
11+
export TWILIO_PHONE_NUMBER=+17072053552
12+

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<a href="https://www.twilio.com">
2+
<img src="https://static0.twilio.com/marketing/bundles/marketing/img/logos/wordmark-red.svg" alt="Twilio" width="250" />
3+
</a>
4+
15
# Server Notifications with Servlets
26

37
[![Build
@@ -10,7 +14,8 @@ Use Twilio to send SMS alerts so that you never miss a critical issue.
1014
### Local Development
1115

1216
1. First clone this repository and `cd` into it:
13-
```
17+
18+
```bash
1419
git clone git@github.com:TwilioDevEd/server-notifications-servlets.git
1520
cd server-notifications-servlets
1621
```
@@ -19,32 +24,32 @@ Use Twilio to send SMS alerts so that you never miss a critical issue.
1924

2025
You can find the AccountSID and the AuthToken at https://www.twilio.com/user/account/settings.
2126

22-
```
27+
```bash
2328
export TWILIO_ACCOUNT_SID=your account sid
2429
export TWILIO_AUTH_TOKEN=your auth token
2530
```
2631

2732
The Twilio Phone Number can be found at https://www.twilio.com/user/account/phone-numbers/incoming.
2833

29-
```
34+
```bash
3035
export TWILIO_PHONE_NUMBER=your Twilio phone number
3136
```
3237

3338
3. Make sure the tests succeed:
3439

35-
```
40+
```bash
3641
mvn compile test
3742
```
3843

39-
4. Run the application.
44+
4. Run the application. The `--debug` flag is optional, it enables logging of requests,
45+
responses and other application events.
4046

41-
```
42-
mvn compile && mvn jetty:run
47+
```bash
48+
mvn compile && mvn jetty:run --debug
4349
```
4450

4551
5. Check it out at [http://localhost:8080](http://localhost:8080)
4652

47-
That's it!
4853

4954
## Meta
5055

pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@
2626
<dependency>
2727
<groupId>com.twilio.sdk</groupId>
2828
<artifactId>twilio</artifactId>
29-
<version>7.0.0-rc-29</version>
29+
<version>7.7.0</version>
3030
</dependency>
3131

32+
<!-- Logging -->
33+
<dependency>
34+
<groupId>ch.qos.logback</groupId>
35+
<artifactId>logback-classic</artifactId>
36+
<version>1.2.2</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>ch.qos.logback</groupId>
40+
<artifactId>logback-core</artifactId>
41+
<version>1.2.2</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>ch.qos.logback</groupId>
45+
<artifactId>logback-access</artifactId>
46+
<version>1.2.2</version>
47+
</dependency>
48+
49+
3250
<!-- Gson -->
3351
<dependency>
3452
<groupId>com.google.code.gson</groupId>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
3+
4+
<!-- =============================================================== -->
5+
<!-- Configure the Logback Request Log -->
6+
<!-- =============================================================== -->
7+
<Configure id="Server" class="org.eclipse.jetty.server.Server">
8+
<Set name="RequestLog">
9+
<New id="RequestLog" class="ch.qos.logback.access.jetty.RequestLogImpl">
10+
<Set name="name">logback-access</Set>
11+
<Set name="resource">/logback-access.xml</Set>
12+
<Call name="start"/>
13+
</New>
14+
</Set>
15+
</Configure>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4JLog

src/main/resources/logback-access.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<configuration>
2+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
3+
<encoder>
4+
<pattern>%fullRequest%n%n%fullResponse</pattern>
5+
</encoder>
6+
</appender>
7+
<appender-ref ref="CONSOLE" />
8+
</configuration>

src/main/resources/logback.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Example LOGBACK Configuration File
4+
http://logback.qos.ch/manual/configuration.html
5+
-->
6+
<configuration scan="true" scanPeriod="30 seconds">
7+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
8+
<encoder>
9+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
10+
</encoder>
11+
</appender>
12+
13+
<root level="debug">
14+
<appender-ref ref="STDOUT" />
15+
</root>
16+
</configuration>

0 commit comments

Comments
 (0)