Files
openapi-generator/modules/openapi-generator-cli/src/main/resources/logback.xml
Jim Schubert 8d6286dfae [core] Normalizing vendor extension naming (#5192)
* [core] Normalizing vendor extension naming

According to [OAS 2.0][1] and [OAS 3.0][2] Specifications:

> Allows extensions to the OpenAPI Schema. The field name MUST begin with x-,
>  for example, x-internal-id. The value can be null, a primitive, an array or an object.
>  Can have any valid JSON format value.

This commit attempts to define a [clear identifier design format][3] of
maintaining lower-kebab casing and following the x- prefix defined by
OAI Specification.

Following a convention that matches that used by others (see [autorest][4]), we will remove
any confusion about naming strategies for template authors and
customizers. Following the lower-kebab convention will allow us to
convert from camelCase and missing prefixes to the desired format. For
example, these conversions are simple to make for template consistency:

* customValue => x-custom-value
* x-customValue => x-custom-value
* x-custom-value => x-custom-value

This convention also allows us to define a single standard for use
across all generators. This means no occurrence of x-operationId in one
generator and x-operation-id in another.

[1]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#patterned-objects
[2]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specificationExtensions
[3]: https://tools.ietf.org/html/draft-wilde-registries-01#section-3.4
[4]: https://github.com/Azure/autorest/tree/master/docs/extensions

* Incorporate feedback to avoid race/blocking in OnceLogger

* Remove unnecessary additional log config

* Add tests,comments for OnceLogger

* Test caffeine cache with FakeTicker
2020-02-06 22:52:58 +08:00

95 lines
3.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Prevent startup messages from Logback -->
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<!-- For those without color (the default) -->
<property name="noColorPattern"
value="[%thread] %-5level %logger{36} - %msg%n" />
<!-- For those with color (with -Dcolor set) -->
<property name="colorPattern"
value="[%thread] %highlight(%-5level) %logger{36} - %msg%n" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${noColorPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
</appender>
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${noColorPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<appender name="STDOUT_COLOR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<withJansi>true</withJansi>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${colorPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
</appender>
<appender name="STDERR_COLOR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<withJansi>true</withJansi>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${colorPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<logger name="io.swagger" level="warn">
<!-- Colorize by passing -Dcolor -->
<if condition='isDefined("color")'>
<then>
<appender-ref ref="STDOUT_COLOR"/>
<appender-ref ref="STDERR_COLOR"/>
</then>
<else>
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDERR"/>
</else>
</if>
</logger>
<logger name="org.openapitools" level="${log.level:-info}">
<!-- Colorize by passing -Dcolor -->
<if condition='isDefined("color")'>
<then>
<appender-ref ref="STDOUT_COLOR"/>
<appender-ref ref="STDERR_COLOR"/>
</then>
<else>
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDERR"/>
</else>
</if>
</logger>
<root level="error">
<!-- Colorize by passing -Dcolor -->
<if condition='isDefined("color")'>
<then>
<appender-ref ref="STDERR_COLOR"/>
</then>
<else>
<appender-ref ref="STDERR"/>
</else>
</if>
</root>
</configuration>