You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
how to silence some info logs in the jspc compiler #232
The GAE staging phase that precompiles the JSP using the jars in a jetty distro still emits:
2016-05-07 15:08:26.379:INFO::main: Logging initialized @555ms
2016-05-07 15:08:26.879:INFO:oajs.TldScanner:main: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
I tried to
System.setProperty("org.apache.jasper.servlet.TldScanner.level", "OFF");
in the main process calling jspc, and still sees the log entry.
Also, looking at the generated servlet of the precompiled JSP, I see hard coded path... How it is supposed to work in prod?
@ludoch How is the precompilation actually done? Are you using the jetty-maven-plugin? Can you point me at the source?
As for the jspx_dependants, I'm not sure why that is generated into the servlet. Once precompilation has happened, jasper plays no part in the the execution of the servlet, and no part of the servlet seems to call the method getDependants(). So it should not cause a problem, but I'll investigate to see why jasper might be putting it there.
@ludoch the jspx_dependents are generated to support on-the-fly recompilation. As that won't happen if the servlet is precompiled, it can safely be ignored.
For the log line "At least one JAR was scanned ..." there are a couple of options I can think of for how to get rid of it:
jasper logs it at level INFO, so if you can successfully configure logging for the org.apache.jasper.servlet.TldScanner class to WARN the message will disappear. Jasper uses the ServiceLoader to look for implementations of the org.apache.juli.logging.Log interface, falling back to java util logging if none are available. Sometimes that gets daisy-chained to other logging mechanisms: for example when running the Jspc class from a maven plugin maven hooks it up to the slf4j SimpleLogger which is configured only from $MAVEN_HOME/conf/logging/simplelogger.properties.
You can set the system property "tomcat.util.scan.StandardJarScanFilter.jarsToSkip" to a comma separated list of globbed jar filenames that should be skipped. Eg "-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=jetty-,websocket-".
Depending on how you're running the JspC precompiler we could replace the org.apache.tomcat.util.scan.StandardJarScanner with a different implementation.
This does not belong to this repository (probably should have used basecamp for it) but regardless do we have a solution (seems still to be an issue). @janbartel ?
@aozarov as mentioned, the simplest thing to do would be to suppress the log message. I don't know what log framework jspc is going to select at runtime in your environment, but there's a good chance it will default to just java util logging, in which case you could do:
Jasper uses java.util.logging, we could setup either side of the slf4j bindings for jul (either capture or appending) to allow the configuration levels to be controlled in a single place.
Activity
janbartel commentedon May 9, 2016
@ludoch How is the precompilation actually done? Are you using the jetty-maven-plugin? Can you point me at the source?
As for the jspx_dependants, I'm not sure why that is generated into the servlet. Once precompilation has happened, jasper plays no part in the the execution of the servlet, and no part of the servlet seems to call the method getDependants(). So it should not cause a problem, but I'll investigate to see why jasper might be putting it there.
janbartel commentedon May 9, 2016
@ludoch the jspx_dependents are generated to support on-the-fly recompilation. As that won't happen if the servlet is precompiled, it can safely be ignored.
For the log line "At least one JAR was scanned ..." there are a couple of options I can think of for how to get rid of it:
ludoch commentedon May 9, 2016
The jspc process is spawned from the appcfg staging phase, as a standalone
java process, with correct classpath setup....
More or less equivalent to
public static void main(String[] args) throws JasperException {
if (args.length == 0) {
System.out.println(Localizer.getMessage("jspc.usage"));
} else {
JspC jspc =
new JspC() {
@OverRide
public String getCompilerClassName() {
return LocalCompiler.class.getName();
}
};
jspc.setArgs(args);
jspc.setCompiler("extJavac");
jspc.setAddWebXmlMappings(true);
jspc.execute();
}
}
Programmatically setting the logger would be best...
aozarov commentedon Jun 2, 2016
This does not belong to this repository (probably should have used basecamp for it) but regardless do we have a solution (seems still to be an issue). @janbartel ?
janbartel commentedon Jun 2, 2016
@aozarov as mentioned, the simplest thing to do would be to suppress the log message. I don't know what log framework jspc is going to select at runtime in your environment, but there's a good chance it will default to just java util logging, in which case you could do:
Logger.getLogger("org.apache.jasper.servlet.TldScanner").setLevel(Level.WARNING);
joakime commentedon Jun 3, 2016
Jasper uses
java.util.logging, we could setup either side of the slf4j bindings for jul (either capture or appending) to allow the configuration levels to be controlled in a single place.ludoch commentedon Jun 8, 2016
Need testing with latest Cloud to reproduce (or not)
aozarov commentedon Jun 9, 2016
direction on how to get the latest cloud sdk are here.