-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[cli] Write to stdout/stderr, allow redirection #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
<excludes> | ||
<exclude>logback.xml</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
|
@@ -78,6 +77,12 @@ | |
<groupId>org.openapitools</groupId> | ||
<artifactId>openapi-generator</artifactId> | ||
<version>${project.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<!--https://github.com/airlift/airline--> | ||
<dependency> | ||
|
@@ -91,9 +96,9 @@ | |
<version>2.3.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>${slf4j-version}</version> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.0.13</version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why you have picked version It seems to me that this is an implementation for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the version documented as the native implementation on slf4j: https://www.slf4j.org/manual.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This page seems outdated to me... See: https://logback.qos.ch/download.html Or on maven central: Do we want to update to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmini this won't necessarily work. SLF4J's site is current. Let me explain how slf4j works, as there seems to be some confusion. slf4j provides an abstraction atop common logging frameworks. It does this via bindings that just need to exist in your classpath. It natively includes bindings to logback. This is why you don't have to add a binding jar, only the logback implementation. The logback usage is locked to logback 1.0.13 (see https://github.com/qos-ch/slf4j/blob/master/pom.xml) because it uses interfaces specific to that version. If you upgrade to a newer version of logback, you'd have to check if it is ABI compatible with 1.0.13. If it isn't, you can have exceptions thrown when code is JIT'd. That's obviously not ideal. It might just work with some luck, but I see no reason to chance it. Similarly, if we don't exclude the simple logger binding explicitly, it opens us to the possibility of pulling this in as a transitive dependency. This simple logging package is the only one I've found that writes to stderr only, so allowing that to be included would result in a regression in this bug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you a lot for the explanations... |
||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
|
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 was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jimschubert:
For me this is similar to unnecessary or commented code, it will be very difficult to understand from the outside or for us in few weeks or months. I would remove those lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove this, it can result in a transient dependency pulling in the simple binding, and a warning.