You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Kalpeshkumar Soni <sh...@gmail.com> on 2005/08/29 21:51:52 UTC

IBM Websphere Portal - log4j log file is empty!

Hi
 I am facing a strange problem
 1) My log4j jar is in java/lib directory and is loaded by bootstrap loader
2) My log4j.xml is loaded properly
 The log4j.log file is created, but the file remains empty
I do not get any errors/exceptions in SystemOut.log / SystemErr.log
 except
I see this one in SystemErr.log
log4j:ERROR Servlet context [default] could not be found.
 (Looks like log4j sandbox stuff, but i cannot file any class in my code 
that has this, it means portal server is using it internally)
 I am trying to use FileSystem logging
  <appender name="dbglog" class="com.ibm.e2e.log.CompositeRollingAppender">
<param name="File" value="../PortalServer/log/log4j.log" />
<layout class="com.ibm.e2e.log.GWAPatternLayout">
<param name="ConversionPattern" value="[WBI WorkFlow Application] [%C{1}.%M] 
[%d{MM/dd HH:mm:ss}] [%p] [%j] %m%n" />
</layout>
</appender>
 public class CompositeRollingAppender extends org.apache.log4j.FileAppender{
................
  Now the interesting part is
there are two server instances (and hence two jvms) that use the same set of 
classes but different log4j.xml
 server1 and WebSphere_Portal
 lo4j logging is fine in first jvm (server1)
 but in the portal server instance, the log file remains empty
 Please help me figure out what is wrong !
 Kalpeshkumar Soni

Re: IBM Websphere Portal - log4j log file is empty!

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Kalpeshkumar Soni <sh...@gmail.com>:

> Hi
>  I am facing a strange problem
>  1) My log4j jar is in java/lib directory and is loaded by bootstrap loader
> 2) My log4j.xml is loaded properly
>  The log4j.log file is created, but the file remains empty
> I do not get any errors/exceptions in SystemOut.log / SystemErr.log
>  except
> I see this one in SystemErr.log
> log4j:ERROR Servlet context [default] could not be found.
>  (Looks like log4j sandbox stuff, but i cannot file any class in my code
> that has this, it means portal server is using it internally)

You must have a Log4j config file that is using the ServletContextLogAppender
from the log4j-sandbox.  This works under Tomcat, but hasn't been tested much
under other appservers.  I've seen similar messages from Weblogic, but haven't
had time to investigate.  In any case, just remove this appender from your
config file.  You'll probably also want to remove the listener reference for
ServletContextLogAppenderListener from web.xml as well.


>  I am trying to use FileSystem logging
>   <appender name="dbglog" class="com.ibm.e2e.log.CompositeRollingAppender">
> <param name="File" value="../PortalServer/log/log4j.log" />
> <layout class="com.ibm.e2e.log.GWAPatternLayout">
> <param name="ConversionPattern" value="[WBI WorkFlow Application] [%C{1}.%M]
> [%d{MM/dd HH:mm:ss}] [%p] [%j] %m%n" />
> </layout>
> </appender>
>  public class CompositeRollingAppender extends org.apache.log4j.FileAppender{
> ................
>   Now the interesting part is
> there are two server instances (and hence two jvms) that use the same set of
> classes but different log4j.xml
>  server1 and WebSphere_Portal
>  lo4j logging is fine in first jvm (server1)
>  but in the portal server instance, the log file remains empty
>  Please help me figure out what is wrong !
>  Kalpeshkumar Soni
>

I suspect that someone is performing manual configuration of Log4j after default
configuration has already happened (webapp startup maybe?  Look for
org.apache.log4j.servlet.InitContextListener in web.xml and comment it out). 
Furthermore, classloading behavior of the webapp is most likely parent-first,
so it is using the log4j.jar in the bootclasspath rather than its own in
WEB-INF/lib.  So, your config is getting blown away.  You might want to set up
something like LogWeb so you can view the loggers and appenders on the server
in real time.  You can also modify configuration with it as well.  Works well!


Jake


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org