When I setup log4j for a class, for example:
private final Logger log = Logger.getLogger(LoginAction.class);
with config
log4j.rootLogger = INFO, abc
log4j.appender.abc = org.apache.log4j.ConsoleAppender
log4j.appender.abc.layout = org.apache.log4j.SimpleLayout
it will output all messagess info and warn even those from framework and something else I'm not interesting in. So, how output only my messages defined in code like:
log.warn("login error: " + email);
log.info("login success: " + email);
将log4j.rootLogger = INFO, abc
为log4j.rootLogger = ERROR, abc
并使用日志级别info
为您的软件包构建另一个记录器
log4j.logger.<your package>= INFO, abc
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.