Just so that you are clear, my problem is intermittent, sort of.
When I have a clean Glassfish/Liferay without my web application portlet, everything seems to be fine. Then I drop my portlet web application under Glassfish/deploy folder and it gets auto deployed. Logging works fine and my app log files are correctly generated. Now when I stop and start glassfish a number of times (anywhere between 1 to 5), at some point in time, logging fails. The message that I see in glassfish's server.log file is:
[#|2011-06-16T13:49:25.071-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;|log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.|#]
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by |#]
----------> Parent Classloader:
urlSet = 
doneCalled = false
Parent -> java.net.URLClassLoader@cb42cf
] whereas object of type |#]
After this error appears, no matter how many times I restart Glassfish, the error always shows up at start up. Also, my web app's log files are no longer generated! The only workaround that works for me is to undeploy my web app, clean up glassfish directories, restart glassfish and redeploy my web app.
As you can imagine, this is not much of a workaround since doing this in production env, (power failure, system reboot, etc) will be extremely painful.
My web application contains a log4j.properties file in the WEB-INF/classes folder. Neither log4j or commons-logging are packaged in the WEB-INF/lib directory. When my web app gets deployed, I can see that LifeRay does indeed add those jars files to the web apps's lib directory. If I try to delete these jars and restart glassfish, I get a NoClassDefFoundError
ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
I'm trying to understand what kinda fix I can expect with Liferay 6.0 EE or 6.1 CE.
My env is:
Glassfish server 3.1
Our web app which is soon to be deployed to production will run on Unix platform.
Thanks for your help.