From cb810de745da6c9ec3e269c924efd6d7433d3cf3 Mon Sep 17 00:00:00 2001 From: Sumeet Gajbhar Date: Wed, 22 May 2019 20:06:43 +0530 Subject: [PATCH] BAEL-2927 added logging configuration for tomcat logs (#6967) --- .../controller/GreetingsController.java | 14 ++++++++++++++ .../main/resources/application-tomcat.properties | 8 +++++++- .../src/main/resources/application.properties | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 spring-boot-ops-2/src/main/java/com/baeldung/springbootconfiguration/controller/GreetingsController.java diff --git a/spring-boot-ops-2/src/main/java/com/baeldung/springbootconfiguration/controller/GreetingsController.java b/spring-boot-ops-2/src/main/java/com/baeldung/springbootconfiguration/controller/GreetingsController.java new file mode 100644 index 0000000000..2d73564c4d --- /dev/null +++ b/spring-boot-ops-2/src/main/java/com/baeldung/springbootconfiguration/controller/GreetingsController.java @@ -0,0 +1,14 @@ +package com.baeldung.springbootconfiguration.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class GreetingsController { + + @GetMapping("/greetings/{username}") + public String getGreetings(@PathVariable("username") String userName) { + return "Hello " + userName + ", Good day...!!!"; + } +} diff --git a/spring-boot-ops-2/src/main/resources/application-tomcat.properties b/spring-boot-ops-2/src/main/resources/application-tomcat.properties index d7c1ba9ac3..42d03a066e 100644 --- a/spring-boot-ops-2/src/main/resources/application-tomcat.properties +++ b/spring-boot-ops-2/src/main/resources/application-tomcat.properties @@ -1,5 +1,5 @@ # server configuration -server.port=80 +server.port=4010 server.address=127.0.0.1 ## Error handling configuration @@ -21,3 +21,9 @@ server.tomcat.accesslog.directory=logs server.tomcat.accesslog.file-date-format=yyyy-MM-dd server.tomcat.accesslog.prefix=access_log server.tomcat.accesslog.suffix=.log +server.tomcat.accesslog.pattern=common +server.tomcat.basedir=tomcat + +## Tomcat internal server logs +logging.level.org.apache.tomcat=DEBUG +logging.level.org.apache.catalina=DEBUG \ No newline at end of file diff --git a/spring-boot-ops-2/src/main/resources/application.properties b/spring-boot-ops-2/src/main/resources/application.properties index 8b13789179..fc3fff1d38 100644 --- a/spring-boot-ops-2/src/main/resources/application.properties +++ b/spring-boot-ops-2/src/main/resources/application.properties @@ -1 +1 @@ - +spring.profiles.active=tomcat