antlr3 - Logging to custom logger in ANTLR 3.5 -


by default, parser classes generted antlr 3.5 write error entries in systemerr log. there way direct these entries custom logger based log4j.

in grammar file write:

    @members {     private static org.apache.log4j.logger logger = org.apache.log4j.logger.getlogger("classname");     }      @rulecatch{       catch(recognitionexception rex) {         logger.error("failed ", rex);       }     }  // rules 

Comments

Popular posts from this blog

javascript - addthis share facebook and google+ url -

java - Simulate the tossing of a coin three times and print out the percentage of cases in which one gets three tails -

c++ - Class declaration error at explicit keyword -