more appenders for logback


License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.github.bingoohuang
ArtifactId

ArtifactId

logback-more-appenders
Last Version

Last Version

0.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

more appenders for logback
more appenders for logback
Project URL

Project URL

http://github.com/bingoohuang/logback-more-appenders
Source Code Management

Source Code Management

http://github.com/bingoohuang/logback-more-appenders

Download logback-more-appenders

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.bingoohuang/logback-more-appenders/ -->
<dependency>
    <groupId>com.github.bingoohuang</groupId>
    <artifactId>logback-more-appenders</artifactId>
    <version>0.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.bingoohuang/logback-more-appenders/
implementation 'com.github.bingoohuang:logback-more-appenders:0.0.3'
// https://jarcasting.com/artifacts/com.github.bingoohuang/logback-more-appenders/
implementation ("com.github.bingoohuang:logback-more-appenders:0.0.3")
'com.github.bingoohuang:logback-more-appenders:jar:0.0.3'
<dependency org="com.github.bingoohuang" name="logback-more-appenders" rev="0.0.3">
  <artifact name="logback-more-appenders" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.bingoohuang', module='logback-more-appenders', version='0.0.3')
)
libraryDependencies += "com.github.bingoohuang" % "logback-more-appenders" % "0.0.3"
[com.github.bingoohuang/logback-more-appenders "0.0.3"]

Dependencies

compile (4)

Group / Artifact Type Version
com.github.bingoohuang : blackcat-instrument Optional jar 0.0.10
ch.qos.logback : logback-classic jar 1.2.3
org.apache.commons : commons-lang3 jar 3.7
com.google.guava : guava jar 20.0

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok Optional jar 1.16.20

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
com.github.bingoohuang : diamond-client jar 0.0.18

Project Modules

There are no modules declared in this project.

logback-more-appenders

more appenders for logback

MultiKeysSiftingAppender

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <appender name="SIFT" class="com.github.bingoohuang.logback.more.appenders.MultiKeysSiftingAppender">
        <discriminator class="com.github.bingoohuang.logback.more.appenders.MultiKeysMDCBasedDiscriminator">
            <key>userId,userType</key>
            <defaultValue>unknown</defaultValue>
        </discriminator>
        <sift>
            <appender name="FILE-${userType}-${userId}" class="ch.qos.logback.core.FileAppender">
                <file>log-${userType}-${userId}.log</file>
                <append>false</append>
                <layout class="ch.qos.logback.classic.PatternLayout">
                    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}:%L - %m%n</pattern>
                </layout>
            </appender>
        </sift>
    </appender>

    <root level="debug">
        <appender-ref ref="SIFT"/>
    </root>
</configuration>

MaskPatternLayout for mask credit card number.

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <appender name="Console1" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="com.github.bingoohuang.logback.more.layout.MaskPatternLayout">
                <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - Console1: %m%n</pattern>
                <regexes><![CDATA[(\d{6})\d{6}(\d{3,5}[xX]?) (\d)\d{3}(\d)]]></regexes>
                <masks>$1++++++$2 $1***$2</masks>
            </layout>
        </encoder>
    </appender>
    <appender name="Console2" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - Console2: %replace(%m){'(\d{6})\d{6}(\d{3,5}[xX]?)', '$1++++++$2'}%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="Console1"/>
        <appender-ref ref="Console2"/>
    </root>

</configuration>

Versions

Version
0.0.3
0.0.2
0.0.1