Development and Production Modes
Development and Production Modes
Beehive applications can be run in either development or production mode:
In development mode, if the tag <netui:exceptions showDevModeStackTrace="true"/> is present on a JSP and an exception occurs, then the stack trace will be displayed.
In production mode, the opposite is true: if the tag <netui:exceptions showDevModeStackTrace="true"/> is present and an exception occurs, then the stack trace won't be displayed.
By default, applications run in production mode, i.e., exception stack traces are not shown.
Similarly, assertions are disabled by default.
Note
If you want to display the stack trace for exceptions in all cases (whether you're in production mode or development mode), you can
set the <netui:exceptions> tag's showStackTrace attribute
to "true".
<netui:exceptions showStackTrace="true">
<netui:exceptions showStackTrace="true">
Controlling the Visibility of Assertions and Exceptions
Beehive uses two switches to control the visibility of assertions and exceptions.
- -ea
- Controls whether assertions are enabled or not. Assertions are disabled by default. If assertions are enabled, then Beehive assumes development mode as well: i.e., exception stack traces are made visible. (See below for enabling assertions but disabling exception stack traces.)
- -beehive.productionmode
- Controls whether exception stack traces are displayed by the tag <netui:exceptions showDevModeStackTrace="true"/>. By default, stack traces are not displayed.
- export JAVA_OPTS=
- Same as the 'default' setting. In Tomcat, this leaves assertions disabled and results in Beehive assuming production mode. If you have <netui:exceptions showDevModeStackTrace="true"/> in a page and an exception occurs, you won't see the stack trace.
- export JAVA_OPTS=-ea
- Using this setting for Tomcat, assertions are enabled and Beehive assumes development mode. If you have <netui:exceptions showDevModeStackTrace="true"/> in one of your pages and an exception occurs, then you will see the stack trace.
- export JAVA_OPTS="-ea -Dbeehive.productionmode=true"
- This is a case where the assumption made by Beehive is overridden: assertions are enabled, but Beehive will run in production mode. If you have <netui:exceptions showDevModeStackTrace="true"/> in a page and an exception occurs, you won't see the stack trace.