How to configure GWT stacktrace deobfuscator under Tomcat?

I want to configure a remote logging service with the deobfuscate option. I know that by default, symbol maps are generated in the / WEB -INF / deploy / MODULNAME / symbolMaps folder, and the GWT remote logger implementation (RemoteLoggingServiceImpl) uses the StackTraceDeobfuscator, which requires working with the symbolMaps symbol. I think RemoteLoggingServiceImpl should automatically set the correct path to the symbolMaps directory, but in debug mode I found that the setSymbolMapsDirectory method is not being called on RemoteLoggingServiceImpl. To solve this problem, I manually call this method using a "proxy":

public class ConfigurableRemoteLoggingServiceImpl extends RemoteLoggingServiceImpl { @Override public void init(final ServletConfig config) throws ServletException { super.init(config); final String symbolMapsDirectory = config.getInitParameter("symbolMapsDirectory"); setSymbolMapsDirectory(symbolMapsDirectory); } } 

and in web.xml

 <servlet> <servlet-name>remoteLogging</servlet-name> <servlet-class>pl.dandelite.empik.sdl.manager.server.service.ConfigurableRemoteLoggingServiceImpl</servlet-class> <init-param> <param-name>symbolMapsDirectory</param-name> <param-value>C:/symbolMaps</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>remoteLogging</servlet-name> <url-pattern>/sdlconsole/remote_logging</url-pattern> </servlet-mapping> 

and at compile time define dir using -extra parametr

This solution works, but only when I set the absolute path to the symbolMaps directory, which is a little impractical;)

Now my question is: what is the correct way to configure RemoteLoggingServiceImpl using StackTraceDeobfuscator on Tomcat?

+4
source share
1 answer

This is how I set up the character directory:

 @Override public void init(ServletConfig config) throws ServletException { super.init(config); // Synchronized so that in a multi-module deployment, there are no conflicts. synchronized (RemoteLoggingServiceImpl.class) { // Initialize SLF$j bridge logging to redirect jul logs to slf4j. We remove any // default loggers to ensure logging doesn't happen to stdout or stderr. java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (Handler handler : handlers) { rootLogger.removeHandler(handler); } SLF4JBridgeHandler.install(); } String moduleName = config.getInitParameter("module.name"); if (StringUtils.isBlank(moduleName)) { _logger.error("No module name defined. Please set the module.name servlet init " + "parameter to point to the GWT module and enable extra symbolMaps at " + "/extra/<module name>/symbolMaps in the servlet context to facilitate " + "deobfuscation of stack traces."); } else { String path = config.getServletContext().getRealPath( "/WEB-INF/deploy/" + moduleName + "/symbolMaps/"); if (path != null) { setSymbolMapsDirectory(path); } } // end else. } 
+1
source

All Articles