flexible-appender

A convenient and customizable appender library for log4j.

License

License

Categories

Categories

Logging Application Layer Libs
GroupId

GroupId

com.janosgats.logging
ArtifactId

ArtifactId

flexible-appender
Last Version

Last Version

1.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

flexible-appender
A convenient and customizable appender library for log4j.
Project URL

Project URL

https://github.com/janosgats/flexibleappender
Source Code Management

Source Code Management

https://github.com/janosgats/flexibleappender

Download flexible-appender

How to add to project

<!-- https://jarcasting.com/artifacts/com.janosgats.logging/flexible-appender/ -->
<dependency>
    <groupId>com.janosgats.logging</groupId>
    <artifactId>flexible-appender</artifactId>
    <version>1.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.janosgats.logging/flexible-appender/
implementation 'com.janosgats.logging:flexible-appender:1.1.6'
// https://jarcasting.com/artifacts/com.janosgats.logging/flexible-appender/
implementation ("com.janosgats.logging:flexible-appender:1.1.6")
'com.janosgats.logging:flexible-appender:jar:1.1.6'
<dependency org="com.janosgats.logging" name="flexible-appender" rev="1.1.6">
  <artifact name="flexible-appender" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.janosgats.logging', module='flexible-appender', version='1.1.6')
)
libraryDependencies += "com.janosgats.logging" % "flexible-appender" % "1.1.6"
[com.janosgats.logging/flexible-appender "1.1.6"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.8.6
org.apache.logging.log4j : log4j-core jar 2.13.2
commons-io : commons-io jar 2.7

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.mockito : mockito-junit-jupiter jar 3.3.3
org.junit.jupiter : junit-jupiter-api jar 5.5.2
org.junit.jupiter : junit-jupiter-params jar 5.5.2

Project Modules

There are no modules declared in this project.

Flexible Appender for extending Log4j functionality

Mix the four separated component of FlexibleAppender to create an appender that makes you happy!

The components:

  • Enableable (filter that runs when instantiating an appender)
  • LogFilter (filter that runs for every log event)
  • LogLineBuilder (constructs a loggable line)
  • LogLineOutput (writes the log line into a stream/file/anything)


Maven import from central repository:

<dependencies>
      <dependency>
            <groupId>com.janosgats.logging</groupId>
            <artifactId>flexible-appender</artifactId>
      </dependency>
 </dependencies>


Factoring common appenders

To quickly create an appender for a common use case, you can use the CommonAppenderFactory class to spare some code in your repository:

@Plugin(name = "LocalDevConsoleAppender", category = "Core", elementType = "appender", printObject = true)
public class LocalDevConsoleAppender extends FlexibleAppender {
    public LocalDevConsoleAppender(String name, Filter filter, Layout<? extends Serializable> layout, boolean ignoreExceptions, Property[] properties) {
        super(name, filter, layout, ignoreExceptions, properties);
    }

    @PluginFactory
    public static LocalDevConsoleAppender createAppender(
            @PluginAttribute("name") String name,
            @PluginElement("Layout") Layout<? extends Serializable> layout,
            @PluginElement("Filter") final Filter filter,
            @PluginAttribute("otherAttribute") String otherAttribute) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {

        return (LocalDevConsoleAppender) new CommonAppenderFactory<>(LocalDevConsoleAppender.class)
                .usePluginFactoryParameters(name, layout, filter, null)
                .createForLocalDevConsole("LOGGING_ENABLE_LOCALDEV_CONSOLE_APPENDER","LOGGING_ENABLE_LOCALDEV_CONSOLE_APPENDER");
    }
}

Versions

Version
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0