Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
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

Open

Description

@ludoch

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?

private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("jar:file:/Users/ludo/.m2/repository/jstl/jstl/1.2/jstl-1.2.jar!/META-INF/fn.tld", Long.valueOf(1153410282000L));
_jspx_dependants.put("file:/Users/ludo/.m2/repository/jstl/jstl/1.2/jstl-1.2.jar", Long.valueOf(1451600304000L));
}

So far, I do not see any side effect, and I guess this is a bug in the jasper compiler?

Activity

  1. self-assigned this
    on May 7, 2016
  2. janbartel commented on May 9, 2016

    @janbartel
    Contributor

    @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.

  3. janbartel commented on May 9, 2016

    @janbartel
    Contributor

    @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:

    1. 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.
    2. 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-".
    3. Depending on how you're running the JspC precompiler we could replace the org.apache.tomcat.util.scan.StandardJarScanner with a different implementation.
  4. ludoch commented on May 9, 2016

    @ludoch
    ContributorAuthor

    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...

  5. aozarov commented on Jun 2, 2016

    @aozarov
    Contributor

    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 ?

  6. janbartel commented on Jun 2, 2016

    @janbartel
    Contributor

    @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);

  7. joakime commented on Jun 3, 2016

    @joakime

    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.

  8. ludoch commented on Jun 8, 2016

    @ludoch
    ContributorAuthor

    Need testing with latest Cloud to reproduce (or not)

  9. assigned and unassigned on Jun 8, 2016
  10. aozarov commented on Jun 9, 2016

    @aozarov
    Contributor

    direction on how to get the latest cloud sdk are here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions