Merge pull request #5459 from eugenp/fix-logging-boot

fix boot logging modules
This commit is contained in:
Loredana Crusoveanu 2018-10-19 20:42:17 +03:00 committed by GitHub
commit 55fbc18541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 65 additions and 64 deletions

View File

@ -482,6 +482,7 @@
<module>spring-boot-mvc</module> <module>spring-boot-mvc</module>
<module>spring-boot-vue</module> <module>spring-boot-vue</module>
<module>spring-boot-logging-log4j2</module> <module>spring-boot-logging-log4j2</module>
<module>spring-boot-disable-console-logging</module>
<module>spring-cloud-data-flow</module> <module>spring-cloud-data-flow</module>
<module>spring-cloud</module> <module>spring-cloud</module>
<module>spring-cloud-bus</module> <module>spring-cloud-bus</module>
@ -1024,6 +1025,7 @@
<module>spring-boot-security</module> <module>spring-boot-security</module>
<module>spring-boot-mvc</module> <module>spring-boot-mvc</module>
<module>spring-boot-logging-log4j2</module> <module>spring-boot-logging-log4j2</module>
<module>spring-boot-disable-console-logging</module>
<module>spring-cloud-data-flow</module> <module>spring-cloud-data-flow</module>
<module>spring-cloud</module> <module>spring-cloud</module>
<module>spring-cloud-bus</module> <module>spring-cloud-bus</module>
@ -1380,6 +1382,7 @@
<module>spring-boot-security</module> <module>spring-boot-security</module>
<module>spring-boot-mvc</module> <module>spring-boot-mvc</module>
<module>spring-boot-logging-log4j2</module> <module>spring-boot-logging-log4j2</module>
<module>spring-boot-disable-console-logging</module>
<module>spring-cloud-data-flow</module> <module>spring-cloud-data-flow</module>
<module>spring-cloud</module> <module>spring-cloud</module>
<module>spring-cloud-bus</module> <module>spring-cloud-bus</module>

View File

@ -0,0 +1,2 @@
### Relevant Articles:
- [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging)

View File

@ -3,10 +3,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>disabling-console-jul</artifactId> <artifactId>disabling-console-jul</artifactId>
<!-- this needs to use the boot parent directly in order to not inherit logback dependencies -->
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>disabling-console-logging</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>2.0.5.RELEASE</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -3,10 +3,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>disabling-console-log4j2</artifactId> <artifactId>disabling-console-log4j2</artifactId>
<!-- this needs to use the boot parent directly in order to not inherit logback dependencies -->
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>disabling-console-logging</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>2.0.5.RELEASE</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -2,8 +2,16 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>disabling-console-logging</artifactId> <artifactId>spring-boot-disable-console-logging</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
<artifactId>disabling-console-logback</artifactId> <artifactId>disabling-console-logback</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project> </project>

View File

@ -1,14 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>disabling-console-logging</artifactId> <artifactId>spring-boot-disable-console-logging</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>Projects for Disabling Spring Boot Console Logging tutorials</description> <description>Projects for Disabling Spring Boot Console Logging tutorials</description>
<parent> <parent>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>spring-boot-logging-log4j2</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath>
</parent> </parent>
<modules> <modules>

View File

@ -1,3 +1,2 @@
### Relevant Articles: ### Relevant Articles:
- [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging) - [Logging in Spring Boot](http://www.baeldung.com/spring-boot-logging)
- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging)

View File

@ -4,41 +4,58 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-logging-log4j2</artifactId> <artifactId>spring-boot-logging-log4j2</artifactId>
<packaging>pom</packaging> <packaging>jar</packaging>
<description>Projects for Spring Boot Logging tutorials</description> <description>Demo project for Spring Boot Logging with Log4J2</description>
<!-- this needs to use the boot parent directly in order to not inherit logback dependencies -->
<parent> <parent>
<artifactId>parent-boot-2</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<groupId>com.baeldung</groupId> <groupId>org.springframework.boot</groupId>
<version>0.0.1-SNAPSHOT</version> <version>2.0.5.RELEASE</version>
<relativePath>../parent-boot-2</relativePath>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<modules>
<module>spring-boot-logging-log4j2-app</module>
<module>disabling-console-logging</module>
</modules>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
</plugin> <configuration>
</plugins> <forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IntTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build> </build>
<properties>
</properties>
</project> </project>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-logging-log4j2-app</artifactId>
<packaging>jar</packaging>
<description>Demo project for Spring Boot Logging with Log4J2</description>
<parent>
<artifactId>spring-boot-logging-log4j2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -32,6 +32,6 @@ public class LoggingController {
loggerNative.warn("This WARN message been printed by Log4j2 without passing through SLF4J"); loggerNative.warn("This WARN message been printed by Log4j2 without passing through SLF4J");
loggerNative.error("This ERROR message been printed by Log4j2 without passing through SLF4J"); loggerNative.error("This ERROR message been printed by Log4j2 without passing through SLF4J");
loggerNative.fatal("This FATAL message been printed by Log4j2 without passing through SLF4J"); loggerNative.fatal("This FATAL message been printed by Log4j2 without passing through SLF4J");
return "Howdy! Check out the Logs to see the output printed directly throguh Log4j2..."; return "Howdy! Check out the Logs to see the output printed directly through Log4j2...";
} }
} }