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.
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());