Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
默认情况下,由 ANTLR 3.5 生成的解析器类将错误条目写入 SystemErr 日志。有没有办法将这些条目定向到基于 Log4J 的自定义记录器。
在你的语法文件中写:
@members { private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("ClassName"); } @rulecatch{ catch(RecognitionException rex) { logger.error("Failed ", rex); } } // rules