I am currently building a web application using struts2 and deploying it to a
Glassfish v2.1 application server. I have an issue, in that when a struts2
action results in an Exception, no stack trace is being output to the
server.log, in fact nothing is reported in the log at all. This makes
debugging very tedious.

I am including several parts of my code in the hope that someone can assist
me with turning this error logging on. This code is set up to deliberately
cause a NullPointerException, which I would expect to be logged with a stack
trace to the server.log.

Please note that this issue occurs regardless of struts.devMode being true
or false

struts.xml package
<package name="Game-web" extends="struts-default">
  <action name="GameSearch_search" class="app.GameSearchAction"
method="search">
    <result>game_search.jsp</result>
  </action>
</package>

GamSearchAction search method (I have deliberately set this to cause a
NullPointerException)
public String search() {
  Date date = null;
  date.equals(null);
  return Action.SUCCESS;
}

log4j.properties
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=INFO, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %-5p %c.%M:%L - %m%n

# try setting struts logging to INFO
log4j.logger.org.apache.struts2=INFO
log4j.logger.com.opensymphony.xwork2=INFO

Result
The result of going to
http://localhost:8080/Game-web/GameSearch_search.action is the default
glassfish 500 error server page.

HTTP Status 500 -

type Exception report

message

descriptionThe server encountered an internal error () that prevented it
from fulfilling this request.

exception

java.lang.NullPointerException

note The full stack traces of the exception and its root causes are
available in the Sun GlassFish Enterprise Server v2.1 logs.
Sun GlassFish Enterprise Server v2.1
-- 
View this message in context: 
http://www.nabble.com/Struts2-is-not-outputting-to-the-Glassfish-server.log-tp25131136p25131136.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to