Trace: • Logging
The application itself logs messages in Javascript console of your browser (developer tools). The network tab in developer tools shows all requests, the payload and responses. This is very helpful for debugging.
If you want to know what's happening on server-side. This is not enough. The server-side runs on a Java application server like Tomcat or Wildfly. To enable logging on server-side, simply do following:
Create the directory classes in your applications WEB-INF folder. The folder already contains lib, rad directories and web.xml file. In the newly created classes folder, create a file logging.properties with following content:
- logging.properties
##################################################################################################### # HANDLER definition ##################################################################################################### # development handlers #handlers = java.util.logging.ConsoleHandler # tomcat handlers handlers = java.util.logging.ConsoleHandler, org.apache.juli.FileHandler # application handlers #handlers = java.util.logging.FileHandler ##################################################################################################### # HANDLER configuration ##################################################################################################### java.util.logging.ConsoleHandler.level = ALL java.util.logging.ConsoleHandler.formatter = com.sibvisions.util.log.jdk.JdkLineFormatter java.util.logging.FileHandler.level = ALL java.util.logging.FileHandler.pattern = application_%g.log java.util.logging.FileHandler.limit = 10000 java.util.logging.FileHandler.count = 5 java.util.logging.FileHandler.formatter = com.sibvisions.util.log.jdk.JdkLineFormatter org.apache.juli.FileHandler.level = ALL org.apache.juli.FileHandler.directory = ${catalina.base}/logs org.apache.juli.FileHandler.limit = 10000 org.apache.juli.FileHandler.count = 5 org.apache.juli.FileHandler.formatter = com.sibvisions.util.log.jdk.JdkLineFormatter org.apache.juli.FileHandler.prefix = application_%g. ##################################################################################################### # Package specifig log levels ##################################################################################################### .level = SEVERE org.restlet.level = OFF #javax.rad.util.level = SEVERE # INFO logs request URL, FINE also logs json, ALL everything com.sibvisions.rad.server.http.rest.ApplicationResource.level = FINE # Websocket logging #com.sibvisions.rad.server.http.rest.WebSocketListener.level = ALL
Use handlers to define where logged messages will be available.
ConsoleHandler logs messages in console (standard output).
FileHandler is used for file output.
If you enable logging for com.sibvisions.rad.server.http.rest.ApplicationResource, your requests will be logged and it dependes on the log level what you'll see. If you set INFO, only request URLs will be logged. The level FINE also logs json request messages and responses.