![JAR search and dependency download from the Maven repository](/logo.png)
org.zeroturnaround.javarebel.integration.log4j.Log4jPlugin Maven / Gradle / Ivy
The newest version!
package org.zeroturnaround.javarebel.integration.log4j;
import org.zeroturnaround.javarebel.ClassResourceSource;
import org.zeroturnaround.javarebel.Integration;
import org.zeroturnaround.javarebel.IntegrationFactory;
import org.zeroturnaround.javarebel.LoggerFactory;
import org.zeroturnaround.javarebel.Plugin;
import org.zeroturnaround.javarebel.integration.log4j.cbp.CategoryCBP;
import org.zeroturnaround.javarebel.integration.log4j.cbp.Log4jCBP;
import org.zeroturnaround.javarebel.integration.log4j.cbp.OptionConverterCBP;
/**
* Log4j jRebel plugin. Permits to hot reload log4j configuration.
*
* @author Richard Julien
* @version 1.0
*/
public class Log4jPlugin implements Plugin {
public void preinit() {
LoggerFactory.getInstance().echo("Intitializing Log4J plugin");
ClassLoader cl = Log4jPlugin.class.getClassLoader();
//Getting integration instance
final Integration integration = IntegrationFactory.getInstance();
//Add bytecode processing to log4j Manager
integration.addIntegrationProcessor(cl, "org.apache.log4j.LogManager", new Log4jCBP());
//Add bytecode processing to log4j Config converter
integration.addIntegrationProcessor(cl, "org.apache.log4j.helpers.OptionConverter", new OptionConverterCBP());
//Add bytecode processing to log4j Category
integration.addIntegrationProcessor(cl, "org.apache.log4j.Category", new CategoryCBP());
}
public boolean checkDependencies(ClassLoader cl, ClassResourceSource crs) {
return crs.getClassResource("org.apache.log4j.LogManager") != null;
}
public String getId() {
return "log4j-plugin";
}
public String getName() {
return "Log4j plugin";
}
public String getDescription() {
return "Reloads full configuration of log4j";
}
public String getAuthor() {
return "Julien Richard";
}
public String getWebsite() {
return "http://www.zeroturnaround.com/jrebel/";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy