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

Commit 5831c4e

Browse files
committed
Add logback-access, update readme
1 parent 0c1da39 commit 5831c4e

File tree

6 files changed

+54
-9
lines changed

6 files changed

+54
-9
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
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

3232
<!-- Gson -->
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)