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

Add logback-access, update readme #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export TWILIO_ACCOUNT_SID=AC4ee8a4bf66c95837fc46316395718baa
export TWILIO_API_KEY=SKed26b2f58b7b62c4df51afe84cf4f2e3
export TWILIO_API_SECRET=4aSAYLTwH56owOwCYWpnjK4zEEVFEKYQ
export TWILIO_IPM_SERVICE_SID=ISfe24d1ae731340d581045465b1a253bd
export TWILIO_AUTH_TOKEN=a9133ec06fdfb0ecf529b94cffd7772e
export DB_URL=jdbc:postgresql://localhost:5432/browser_calls
export DB_USERNAME=jose
export DB_PASSWORD=

export TWILIO_APPLICATION_SID=APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export TWILIO_PHONE_NUMBER=+17072053552

21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<a href="https://www.twilio.com">
<img src="https://static0.twilio.com/marketing/bundles/marketing/img/logos/wordmark-red.svg" alt="Twilio" width="250" />
</a>

# Server Notifications with Servlets

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

1. First clone this repository and `cd` into it:
```

```bash
git clone git@github.com:TwilioDevEd/server-notifications-servlets.git
cd server-notifications-servlets
```
Expand All @@ -19,32 +24,32 @@ Use Twilio to send SMS alerts so that you never miss a critical issue.

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

```
```bash
export TWILIO_ACCOUNT_SID=your account sid
export TWILIO_AUTH_TOKEN=your auth token
```

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

```
```bash
export TWILIO_PHONE_NUMBER=your Twilio phone number
```

3. Make sure the tests succeed:

```
```bash
mvn compile test
```

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

```
mvn compile && mvn jetty:run
```bash
mvn compile && mvn jetty:run --debug
```

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

That's it!

## Meta

Expand Down
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio</artifactId>
<version>7.0.0-rc-29</version>
<version>7.7.0</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>1.2.2</version>
</dependency>


<!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/jetty-logback-access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<!-- =============================================================== -->
<!-- Configure the Logback Request Log -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Set name="RequestLog">
<New id="RequestLog" class="ch.qos.logback.access.jetty.RequestLogImpl">
<Set name="name">logback-access</Set>
<Set name="resource">/logback-access.xml</Set>
<Call name="start"/>
</New>
</Set>
</Configure>
1 change: 1 addition & 0 deletions src/main/resources/jetty-logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4JLog
8 changes: 8 additions & 0 deletions src/main/resources/logback-access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%fullRequest%n%n%fullResponse</pattern>
</encoder>
</appender>
<appender-ref ref="CONSOLE" />
</configuration>
16 changes: 16 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Example LOGBACK Configuration File
http://logback.qos.ch/manual/configuration.html
-->
<configuration scan="true" scanPeriod="30 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>