https://github.com/easonlai/serving-web-content-demo
Java Spring Boot web content with logback (logback-spring) logging configuration demo repo.
https://github.com/easonlai/serving-web-content-demo
containerization java javaspringboot logback logback-spring logging
Last synced: about 1 month ago
JSON representation
Java Spring Boot web content with logback (logback-spring) logging configuration demo repo.
- Host: GitHub
- URL: https://github.com/easonlai/serving-web-content-demo
- Owner: easonlai
- Created: 2021-06-13T08:44:19.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-23T12:49:24.000Z (over 4 years ago)
- Last Synced: 2025-01-08T12:13:48.630Z (over 1 year ago)
- Topics: containerization, java, javaspringboot, logback, logback-spring, logging
- Language: Java
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java Spring Boot Web Content with logback (logback-spring) Logging Configuration Demo Repo
This is demo repo to demostrate how to work with build-in & [logback (logback-spring)](https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/html/boot-features-logging.html) logging in Java Spring Boot web. Logging will output to STROUT and log path (/logs/log.log). This repo also contain containerization materials for futher deployment in Kubernetes (K8S) cluster (e.g Azure Kubernetes Service (AKS)).
Readme update 1.0
## With Java Spring Boot Build-in Logging
```shell
/src/main/resources/application.properties
```
## With Logback (logback-spring) Logging
* Logging format = Datetime, Host IP, Process ID, Log Level, Java Class for Logging, Client IP, Message for Logging
```shell
/src/main/resources/logback-spring.xml
```
## Build with Maven
```shell
mvn clean package
```
## Run locally
```shell
java -jar target/serving-web-content-demo-0.0.1.jar
```
## Test web app locally
```shell
http://localhost:8080
```
## Containerize
1. Build a docker image using `Dockerfile`:
```
docker build -t serving-web-content-demo .
```
2. Run docker image locally
```
docker run --rm -p 8080:8080 serving-web-content-demo
```
3. Then you can access the web app at http://localhost:8080 in browser.
## Deploy to K8S
```shell
kubectl apply -f serving-web-content-demo-aks.yaml
```