public interface ServerLogging
Smart GWT's server-side classes have extensive built-in diagnostics which are output via the Apache Log4j library (see below for other alternatives).
At startup, Smart GWT will automatically load the file log4j.isc.config.xml
from the classpath and use it to configure Log4j. log4j.isc.config.xml
is in
Log4j's standard
XML configuration
format,
and sets default log threshold levels for various subsystems to produce output that is
generally appropriate for both development and production systems. Various Smart GWT
documentation may encourage you to enable certain diagnostic logs using this file when
troubleshooting specific problems.
There's a iscLog4jConfiguration
JVM argument, which if explicitly set will be used
instead
of the default log4j.isc.config.xml
configuration file. It should point to an
alternative
configuration file using the same Log4j's standard
XML configuration
format:
-DiscLog4jConfiguration=log4j.custom.config.xmlNote if the
iscLog4jConfiguration
is present, but the configuration file could not
be
loaded, Smartclient will fallback to default log4j.isc.config.xml
configuration.
The Server Logs tab of the Smart GWT Developer
Console
provides the
ability to view the most recent 500 log entries, and change log threshold levels dynamically
at runtime.
Smart GWT server logging can alternatively use the Simple Logging Facade for Java (slf4j), which allows logs to be sent to a variety of different logging frameworks that support slf4j.
To send all logging to slf4j, the iscUseSlf4j
VM argument must be set to true
on the command line, like this:
-DiscUseSlf4j=trueIf slf4j is used and the underlying log system is still Log4j, Smart GWT will still configure Log4j using
log4j.isc.config.xml
as describe above unless you
pass an additional command line argument to prevent this:
-DiscUseLog4jConfig=falseIf slf4j is used with any other logging system, Smart GWT will not attempt to apply configuration - see the SLF4J user manual for details on how to configure slf4j.
Note that the features of the "Server Logs" tab will not be available if using slf4j, even if Log4j is also used.
If log4j is used and custom loggers are configured in log4j.isc.config.xml
file, use DataTools.getLoggerRespository()
method to access them on server side,
like this:
DataTools.getLoggerRepository().getLogger(CustomClass.class.getName());
Used to log slow SQL queries. SQL query is condidered "slow" if its execution time exceeds
configured threshold, see the global sql.log.queriesSlowerThan
server.properties SQL setting
and more specific
DataSource.logSlowSQL
setting for more details.
Set category logging level to "DEBUG" to log all slow queries:
<category name="com.isomorphic.SLOW_SQL"> <priority value="DEBUG" /> </category>or enable logging for specific
operation
types
:
<category name="com.isomorphic.SLOW_SQL.fetch"> <priority value="DEBUG" /> </category> <category name="com.isomorphic.SLOW_SQL.update"> <priority value="DEBUG" /> </category>