Reputation: 21
I want to configure a parameter for the exception interceptor to log exceptions. So I created a package in struts.xml and copied the default-stack from struts-default.xml. However it doesn't log exceptions and seems to still use the defaultStack.
Here is my struts.xml:
<struts>
<package name="default" extends="struts-default">
<interceptors>
<interceptor-stack name="myStack">
<interceptor-ref name="exception">
<param name="logEnabled"> true </param>
<param name="logCategory"> struts </param>
<param name="logLevel"> ERROR </param>
</interceptor-ref>
...
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack" />
</package>
</struts>
Upvotes: 2
Views: 4673
Reputation: 1088
This should work fine, provided all the new actions that you add are in the same package, i.e, "default" package which extends struts-default.
AFAIK there can be just 1 possibility because of which it can go wrong, and that will be : You have written your actions in a different package(that again extends struts-default rather than "default"-the custom package), and thus, it would use the defaultStack as the default interceptor stack, which is the default stack for struts-default.
So, if you want the default stack to be over-ridden by myStack, make sure that your action is inside your custom package - "default" or inside a package that extends your custom package "default" rather than the struts-default package.
Upvotes: 1