此内容没有您所选择的语言版本。
7.12.4. Using XML for exception handling
Since annotations cannot be added to all exception classes, Seam also lets us specify this functionality in
pages.xml
.
The final
<exception>
declaration does not specify a class, and acts as catch-all for any exception without specified handling via annotations or in pages.xml
.
You can also use EL to specify the
view-id
to redirect to.
You can also access the handled exception instance through EL. Seam places it in the conversation context. For example, to access the exception message:
org.jboss.seam.handledException
holds the nested exception that was handled by an exception handler. The outermost (wrapper) exception is also available as org.jboss.seam.caughtException
.
7.12.4.1. Suppressing exception logging 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
For the exception handlers defined in
pages.xml
, it is possible to declare the level at which the exception will be logged, or to suppress exception logging altogether. The log
and log-level
attributes are used to control exception logging. No log message will be generated when the specified exception occurs when log="false"
is set, as shown here:
If the
log
attribute is not specified, then it defaults to true
— that is, the exception will be logged. Alternatively, you can specify the log-level
to control the level at which the exception will be logged:
The acceptable values for
log-level
are: fatal, error, warn, info, debug
, and trace
. If the log-level
is not specified, or if an invalid value is configured, log-level
will default to error
.