log-appender-factory

Library that helps produce log appenders using log4j and YAML configuration

License

License

GroupId

GroupId

com.github.itzmedinesh
ArtifactId

ArtifactId

log-appender-factory
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom
Description

Description

log-appender-factory
Library that helps produce log appenders using log4j and YAML configuration
Project URL

Project URL

https://github.com/itzmedinesh/log-appender-factory.git
Source Code Management

Source Code Management

https://github.com/itzmedinesh/log-appender-factory

Download log-appender-factory

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.itzmedinesh/log-appender-factory/ -->
<dependency>
    <groupId>com.github.itzmedinesh</groupId>
    <artifactId>log-appender-factory</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.itzmedinesh/log-appender-factory/
implementation 'com.github.itzmedinesh:log-appender-factory:1.0.0'
// https://jarcasting.com/artifacts/com.github.itzmedinesh/log-appender-factory/
implementation ("com.github.itzmedinesh:log-appender-factory:1.0.0")
'com.github.itzmedinesh:log-appender-factory:pom:1.0.0'
<dependency org="com.github.itzmedinesh" name="log-appender-factory" rev="1.0.0">
  <artifact name="log-appender-factory" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.itzmedinesh', module='log-appender-factory', version='1.0.0')
)
libraryDependencies += "com.github.itzmedinesh" % "log-appender-factory" % "1.0.0"
[com.github.itzmedinesh/log-appender-factory "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
log4j : log4j jar 1.2.17
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar 2.6.3
com.fasterxml.jackson.core : jackson-databind jar 2.6.3

Project Modules

There are no modules declared in this project.

log-appender-factory


Library to produce log4j appenders and chain it with the loggers defined in the input configuration. Wrapping log4j for ease of use with yaml

Versions on maven

https://mvnrepository.com/artifact/com.github.itzmedinesh/log-appender-factory

Sample YAML configuration


dailyFileAppenderConfig:
-
  loggerLayoutPattern: TTCC_CONVERSION_PATTERN
  loggerFileName: d:/logconftest.log
  loggerName: LogConfigTest
  loggerLevel: INFO
  rollingSchedule: MINUTELY_PATTERN
fileAppenderConfig:   
-   
  loggerLayoutPattern: TTCC_CONVERSION_PATTERN    
  loggerFileName: d:/logconftest1.log   
  loggerName: LogConfigTest1   
  loggerLevel: INFO   
  appendLogs: true   
  maxBackupFiles: 5   
  maxFileSize: 20KB   
-    
  loggerLayoutPattern: TTCC_CONVERSION_PATTERN   
  loggerFileName: d:/logconftest2.log   
  loggerName: LogConfigTest2   
  loggerLevel: INFO   
  appendLogs: true   
  maxBackupFiles: 5   
  maxFileSize: 20KB   

Producing appenders and chaining it to named loggers


LogConfigurator.init(getLoggerConfig());

Logging


private static final LogWriter MSGLOGGER = LoggerRepository.getLogger("LogConfigTest1");
MSGLOGGER.info ("Some message!");

Note:

If you are trying to get logger with the names not configured in the yml, log4j will throw a warning that no appenders are found for the given logger name. Log statements will be rejected.

Versions

Version
1.0.0