Skip to content

Commit 0f123fd

Browse files
Merge pull request BuildCLI#98 from wheslleyrimar/develop
Develop to Main
2 parents dc644c0 + 85cddaa commit 0f123fd

File tree

3 files changed

+52
-21
lines changed

3 files changed

+52
-21
lines changed

pom.xml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@
5858
<artifactId>junit-jupiter-api</artifactId>
5959
<scope>test</scope>
6060
</dependency>
61+
<dependency>
62+
<groupId>ch.qos.logback</groupId>
63+
<artifactId>logback-core</artifactId>
64+
<version>1.5.6</version>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.slf4j</groupId>
69+
<artifactId>slf4j-api</artifactId>
70+
<version>2.0.16</version>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>ch.qos.logback</groupId>
75+
<artifactId>logback-classic</artifactId>
76+
<version>1.5.6</version>
77+
</dependency>
78+
6179
</dependencies>
6280

6381
<build>
@@ -94,14 +112,14 @@
94112
<artifactId>versions-maven-plugin</artifactId>
95113
<version>2.18.0</version>
96114
</plugin>
97-
<plugin>
98-
<groupId>org.apache.maven.plugins</groupId>
99-
<artifactId>maven-compiler-plugin</artifactId>
100-
<configuration>
101-
<source>17</source>
102-
<target>17</target>
103-
</configuration>
104-
</plugin>
105-
</plugins>
115+
<plugin>
116+
<groupId>org.apache.maven.plugins</groupId>
117+
<artifactId>maven-compiler-plugin</artifactId>
118+
<configuration>
119+
<source>17</source>
120+
<target>17</target>
121+
</configuration>
122+
</plugin>
123+
</plugins>
106124
</build>
107125
</project>

src/main/java/org/buildcli/log/SystemOutLogger.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
package org.buildcli.log;
22

3-
import java.util.logging.ConsoleHandler;
4-
import java.util.logging.Level;
5-
import java.util.logging.Logger;
3+
import org.buildcli.BuildCLI;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
67

78
public class SystemOutLogger {
89

9-
private static final Logger logger = Logger.getAnonymousLogger();
10-
11-
static {
12-
var handler = new ConsoleHandler();
13-
handler.setFormatter(new SystemOutFormatter());
14-
logger.addHandler(handler);
15-
logger.setUseParentHandlers(false);
16-
logger.setLevel(Level.ALL);
17-
}
10+
private static final Logger logger = LoggerFactory.getLogger(BuildCLI.class);
1811

1912
private SystemOutLogger() { }
2013

src/main/resources/logback.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<encoder>
4+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
5+
</encoder>
6+
</appender>
7+
8+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
9+
<file>${user.home}/logs/builcli.log</file>
10+
<encoder>
11+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}-%msg%n</pattern>
12+
</encoder>
13+
</appender>
14+
<appender-ref ref="FILE" />
15+
16+
<root level="DEBUG">
17+
<appender-ref ref="STDOUT" />
18+
<appender-ref ref="FILE" />
19+
</root>
20+
</configuration>

0 commit comments

Comments
 (0)