I have to implement log4j in plugin project. after that i want to export a jar from this project and put this jar to the another eclipse plugin folder. For this i have create log4j.properties file here is code,
log4j.rootLogger=DEBUG, stdout, file
# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}%-5p %c{1}:%L - %m%n
# Redirect log messages to a log file, support file rolling.
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=D:\\log4j-application.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c {1}:%L - %m%n
and also add this code to the Activator.java,
private static Logger logger=Logger.getLogger("Automatics_plugin");
"Automatics_plugin" is my project name.thereafter also add log4j .jar in project configuration build path and add this log4j.jar to the MANIFEST.MF in plugin.xml. Also i have write a code in Activator.java class in start()
URL confURL = getBundle().getEntry("log4j.properties");
PropertyConfigurator.configure(FileLocator.toFileURL(confURL).getFile());
after export a jar and put this jar to another eclipse i got an exception "org.eclipse.core.runtime.CoreException: Plug-in Automatics_plugin was unable to load class com.automatics_plugin.login.view.OpenView.".then I excluded this code and again export jar and that time it will running succesfully. but log4j still failed to create on local. Please look this issue. Advance thanks.