logmgr-logback

JDK LogManager implementation for logback

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.github.schnitker.logmanager
ArtifactId

ArtifactId

logmgr-logback
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

logmgr-logback
JDK LogManager implementation for logback
Project URL

Project URL

https://github.com/Schnitker/LogManager
Project Organization

Project Organization

Rainer Schnitker
Source Code Management

Source Code Management

https://github.com/Schnitker/LogManager

Download logmgr-logback

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.2

Project Modules

There are no modules declared in this project.

LogManager

JDK LogManager implementations for Log4j, Log4j2, Logback and servlet containers.

Introduction

My favorite Framework Jersey (JAX-RS 2.0) uses JDK logging. There are some disadvantages with JDK Logging:

This project allows you to redirect JDK logging to Log4j (1.x or 2.x) or Logback without performance costs. Configuration changes are immediately noticed by the JDK logging wrapper. The JDK LogManager and Logger are completely replaced.

The Jersey Grizzly HTTP server (jersey-container-grizzly2-http) works fine with all wrapper implementations.

Usage (for applications)

  • Set system property in main method:
    System.setProperty( "java.util.logging.manager", JulLogManager.class.getName() );

  • Set system property on command line:
    java -Djava.util.logging.manager=com.github.schnitker.logmgr.log4j.JulLogManager

Servlet container

Note that the JDK LogManager does not work well with servlet containers.

There is an context class loader friendly implementation in the module 'logmgr-factory'. The factory searches through the Java ServiceLoader for an implementation of com.github.schnitker.logmgr.JulLoggerFactory. The module 'logmgr-factory' must be added to the bootstrap libraries and the system property java.util.logging.manager must be set.

Every web application instance can contain one logging wrapper.

|             Bootstrap                 | 
| (logmgr-factory) |
+------------------+--------------------+
| Webapp1 | Webapp2 |
| (logmgr-log4j) | (logmgr-logback) |
Tomcat
  • Eclipse start: Add the VM argument -Djava.util.logging.manager=com.github.schnitker.logmgr.JulLogManager and add the logmgr-factory jar file in the run/debug configuration.
  • Installation: You must extend the CLASSPATH environment variable (add logmgr-factory.jar) and set the LOGGING_MANAGER environment variable to com.github.schnitker.logmgr.JulLogManager in the catalina shell script.

Maven Repository

Current artifacts:

  • Log4j 1.x implementation:
    'com.github.schnitker.logmanager:logmgr-log4j:1.0.2'

  • Log4j 2.x implementation:
    'com.github.schnitker.logmanager:logmgr-log4j2:1.0.2'

  • Logback implementation:
    'com.github.schnitker.logmanager:logmgr-logback:1.0.2'

  • Servlet container implementation:
    'com.github.schnitker.logmanager:logmgr-factory:1.0.2'

Gradle

The project uses the gradle build system.

  • Eclipse Setup: Run the command 'gradlew eclipse' or 'gradlew cleanEclipse eclipse'.

  • Building artifacts: Call 'gradlew assemble'.

Versions

Version
1.0.2
1.0.1