We have a dynamic web project which uses log4j.jar (has it's own log4j.xml) to create custom application logs and it also uses an api which has its own log4j.jar (has it's own log4j.xml). And the dynamic web project is hosted on websphere and the api is configured as a shared library.
When the api methods are invoked from the module. The following errors are printed in the SystemErr.log file.
Parent: com.ibm.ws.classloader.ProtectionClassLoader@61ea61ea
Delegation Mode: PARENT_LAST] whereas object of type
[5/30/13 8:05:29:421 EDT] 00000039 SystemErr R log4j:ERROR "org.apache.log4j.DailyRollingFileAppender" was loaded by [
com.ibm.ws.classloader.CompoundClassLoader@d4c0d4c[war:ModuleName of the Web Project]
Local ClassPath:class path is printed
[5/30/13 5:32:55:632 UTC] 0000003e SystemErr R log4j:ERROR Could not instantiate appender named LOGGER_NAME.
[5/30/13 5:32:55:632 UTC] 0000003e SystemErr R log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
[5/30/13 5:32:55:632 UTC] 0000003e SystemErr R log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
[5/30/13 5:32:55:633 UTC] 0000003e SystemErr R log4j:ERROR [
com.ibm.ws.classloader.ExtJarClassLoader@18d418d4[server:0]
Local ClassPath: class path is printed
The log4j can not be removed from the api since it is required to initialize the api on server startup. And when the api is invoked from the module the above mentioned errors are printed.
Dynamic web projects log4j.properties
log4j.rootLogger=DEBUG, APP_LOGGER_NAME1
log4j.appender.APP_LOGGER_NAME1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.APP_LOGGER_NAME1.layout=org.apache.log4j.PatternLayout
log4j.appender.APP_LOGGER_NAME1.layout.ConversionPattern=[%20.20d{dd/MMM/yyyy-HH:mm:ss}] %6.6p - %-35.35c{2} :: %m%n
log4j.appender.APP_LOGGER_NAME1.File=path of log file
log4j.appender.APP_LOGGER_NAME1.DatePattern='.'yyyy-MM-dd
API log4j.properties
log4j.rootLogger=DEBUG, APP_LOGGER_NAME2
log4j.appender.APP_LOGGER_NAME2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.APP_LOGGER_NAME2.layout=org.apache.log4j.PatternLayout
log4j.appender.APP_LOGGER_NAME2.layout.ConversionPattern=[%20.20d{dd/MMM/yyyy-HH:mm:ss}] %6.6p - %-35.35c{2} :: %m%n
log4j.appender.APP_LOGGER_NAME2.File=path of log file
log4j.appender.APP_LOGGER_NAME2.DatePattern='.'yyyy-MM-dd
Please note we have a AIX box where the application servers are hosted and log file name and file permissions are correct. Due to business code of conduct I have not pasted them in the description of the problem.