cloudbees-log4j-extras

CloudBees Log4j Extras (JMX, ...)

License

License

GroupId

GroupId

com.cloudbees.extras
ArtifactId

ArtifactId

cloudbees-log4j-extras
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

cloudbees-log4j-extras
CloudBees Log4j Extras (JMX, ...)

Download cloudbees-log4j-extras

How to add to project

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

Dependencies

compile (3)

Group / Artifact Type Version
log4j : log4j jar 1.2.17
com.google.code.findbugs : jsr305 Optional jar 2.0.1
org.hamcrest : hamcrest-library jar 1.3

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.0.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

CloudBees Log4J Extras

Log4jConfigurer JMX MBean

The Log4jConfigurer JMX MBean exposes main Log4j configuration information and operations via JMX

Log4jConfigurer attributes and operations

  • ObjectName: com.cloudbees:type=Log4jConfigurer,context=/myapp,name=Log4jConfigurer where context is the application context (e.g. "/" for the root context or "/myapp" for an app with context "myapp")
  • Attributes
    • String[] LoggerList: list of active loggers
  • Operations
  • String getLoggerLevel(loggerName): logger level or null if logger is not defined or if the level of this logger is not defined.
  • String getLoggerEffectiveLevel(loggerName): effective logger level, never null
  • String printLog4jEffectiveConfiguration(): print the Log4j effective configuration rendered in the properties format
  • void setLoggerLevel(loggerName, level): set the level of the given logger. If the given level is null or unknown level will set logger level to null`

Embedded Log4jConfigurer JMX MBean in a Servlet 3+ application

Just add cloudbees-log4j-extras to your classpath, and let your Servlet 3+ container discover the com.cloudbees.log4j.jmx.Log4jConfigurerWebListener class that is annotated with @WebListener.

Please note that @WebListener annotated classes are discovered if you enable classpath scanning with metadata-complete="false" in web.xml.

Maven dependency

<dependency>
    <groupId>com.cloudbees.extras</groupId>
    <artifactId>cloudbees-log4j-extras</artifactId>
    <version>1.0.1</version>
</dependency>

web.xml fragment with metadata-complete="false"

<web-app
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        version="3.0" metadata-complete="false">
   ...
</web-app>

Embedded Log4jConfigurer JMX MBean in a Servlet 2 application

Declare a com.cloudbees.log4j.jmx.Log4jConfigurer listener in web.xml

Maven dependency

<dependency>
    <groupId>com.cloudbees.extras</groupId>
    <artifactId>cloudbees-log4j-extras</artifactId>
    <version>1.0.1</version>
</dependency>

web.xml fragment with <listener>

<web-app ...>
    <listener>
        <listener-class>com.cloudbees.log4j.jmx.Log4jConfigurerWebListener</listener-class>
    </listener>
</web-app>
com.cloudbees.extras

CloudBees Community

Versions

Version
1.0.1
1.0.0