-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli] Write to stdout/stderr, allow redirection (#207)
* [cli] Write to stdout/stderr, allow redirection Previously, slf4j-simple from generator core was being used. This writes to only a single stream (STDERR) and is confusing from a CLI tooling perspective. This consumes logback in CLI, and excludes core's slf4j-simple dependency. This allows us to define multiple appenders, one for STDOUT and one for STDERR. WARN messages and lower are written to STDOUT. ERROR is written to STDERR. * [cli] Limit logs to match prev implementation * Remove slf4j-simple from core project, to avoid conflicts with consumer logger implementations
- Loading branch information
1 parent
0fb1ffa
commit f4c66d9
Showing
5 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 27 additions & 5 deletions
32
modules/openapi-generator-cli/src/main/resources/logback.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<layout class="ch.qos.logback.classic.PatternLayout"> | ||
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> | ||
</layout> | ||
<target>System.out</target> | ||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||
<level>ERROR</level> | ||
<onMatch>DENY</onMatch> | ||
<onMismatch>NEUTRAL</onMismatch> | ||
</filter> | ||
</appender> | ||
<logger name="io.swagger" level="debug"/> | ||
<root level="error"> | ||
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender"> | ||
<target>System.err</target> | ||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<level>ERROR</level> | ||
</filter> | ||
</appender> | ||
<logger name="io.swagger" level="warn"> | ||
<appender-ref ref="STDOUT"/> | ||
<appender-ref ref="STDERR"/> | ||
</logger> | ||
<logger name="org.openapitools" level="info"> | ||
<appender-ref ref="STDOUT"/> | ||
<appender-ref ref="STDERR"/> | ||
</logger> | ||
<root level="error"> | ||
<appender-ref ref="STDERR"/> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters