@Override
public final void init(ServletConfig config) throws ServletException {
super.init(config);
String cwd = "<unknown>";
try {
cwd = new File(".").getCanonicalPath();
} catch (IOException ignore) {
}
deobfuscatorList = new ArrayList<StackTraceDeobfuscator>();
for (@SuppressWarnings("unchecked")
Enumeration<String> e = config.getInitParameterNames(); e.hasMoreElements();) {
String name = e.nextElement();
if (name.startsWith(PARAMETER_SYMBOL_MAPS)) {
String path = config.getInitParameter(name);
File symbolMapsDirectory = new File(path);
// bugfix
if (symbolMapsDirectory.isDirectory()) {
deobfuscatorList.add(new StackTraceDeobfuscator(path));
} else {
URL symbolMapsUrl;
try {
symbolMapsUrl = config.getServletContext().getResource(path);
if (symbolMapsUrl.getProtocol().equalsIgnoreCase("file")) {
symbolMapsDirectory = new File(symbolMapsUrl.getFile());
}
else {
String realPath = getServletContext().getRealPath(path);
symbolMapsDirectory = new File(realPath);
}
}
catch (MalformedURLException e1) {
Log.warn("Servlet configuration parameter '" + name + "' specifies directory '" + path
+ "' which does not exist or is not relative to your server's current working directory '" + cwd + "'");
}
if (symbolMapsDirectory.isDirectory()) {
deobfuscatorList.add(new StackTraceDeobfuscator(symbolMapsDirectory.getAbsolutePath()));
} else {
Log.warn("Servlet configuration parameter '" + name + "' specifies directory '" + path
+ "' which does not exist or is not relative to your server's current working directory '" + cwd + "'");
}
}
}
}
if (deobfuscatorList.isEmpty()) {
Log.warn("In order to enable stack trace deobfuscation, please specify the '"
+ PARAMETER_SYMBOL_MAPS + "' <init-param> for the " + RemoteLoggerServlet.class.getName()
+ " servlet in your web.xml");
}
accessControlAllowOriginHeader = config.getInitParameter(ACCESS_CONTROL_ALLOW_ORIGIN);
Log.info("Initialized MyRemoteLoggerServlet");
}
Now I find that remote logging only works with error and fatal messages. When I set
I do not get any trace, debug, info, warn messages reported to the server. They appear in the console but only error and fatal written to server logs.
Thanks for help Fred.