简体   繁体   中英

How do I enable logging for Google Closure Compiler?

Google's Closure Compiler has this flag for logging:

--logging_level VAL
    The logging level (standard java.util.logging.Level values)
    for Compiler progress. Does not control errors or warnings
    for the JavaScript code under compilation.

So I can set the logging level to one of: SEVERE , WARNING , INFO , CONFIG , FINE , FINER , FINEST .

But how do I enable logging, and where is the log file?

Create a file called logging.properties with the following contents:

handlers = java.util.logging.FileHandler

java.util.logging.FileHandler.pattern   = closure-compiler.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

Then set the java.util.logging.config.file Java system property to logging.properties when running the application:

java -Djava.util.logging.config.file=logging.properties \
     -jar compiler.jar \
     --js script.js \
     --logging_level FINEST

The log will be written to closure-compiler.log .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM