在我的应用程序中,一旦部署了应用程序,就会安排石英作业。我有两个日志文件home-log-search.log
和home-log-app.log
,两者都用于特定日志记录。搜索日志文件仅用于记录访问者的IP,其余所有日志记录(例外,调试信息)都记录在应用程序日志文件中。
我面临的问题是,默认的Quartz语句被记录在home-log-search.log
文件中,这不是必需的。
如何禁用该日志记录?将级别设置为关闭不起作用。我也跟着disable quartz logging,但这也没有帮助。
以下是我的 log4j.properties
# properties file for testing logging service
log4j.debug = true
# Set root category priority to DEBUG and its only appender to CONSOLE.
log4j.rootCategory=INFO, searchLogger
log4j.appender.searchLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.searchLogger.File=${catalina.home}/logs/home-search-log.log
log4j.appender.searchLogger.DatePattern='.'yyyy-MM-dd
log4j.logger.searchLogger.quartz=OFF, searchLogger
log4j.appender.searchLogger.Append=true
log4j.appender.searchLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.searchLogger.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-4p %m%n
log4j.logger.appLogger=DEBUG, appLogger
log4j.additivity.appLogger = false
log4j.appender.appLogger=org.apache.log4j.RollingFileAppender
log4j.appender.appLogger.maxFileSize=5000KB
log4j.appender.appLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.appLogger.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c : %m%n
log4j.appender.appLogger.File=${catalina.home}/logs/home-app-log.log
以下是我的工作安排课程
public class SubscriptionNotificationJobScheduler {
/**
* config bundle
*/
private static ResourceBundle configBundle = ResourceBundle.getBundle("config");
public SubscriptionNotificationJobScheduler(String path) throws ParseException, SchedulerException{
JobDetail job = new JobDetail();
job.setName(SubscriptionConstants.JOB_NAME);
job.setJobClass(SubscriptionNotificationJob.class);
JobDataMap map = new JobDataMap();
map.put("contextPath", path);
job.setJobDataMap(map);
CronTrigger trigger = new CronTrigger();
trigger.setName(SubscriptionConstants.TRIGGER_NAME);
trigger.setCronExpression(configBundle.getString("monday.cron.trigger"));
//schedule it
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(job, trigger);
}
}
答案 0 :(得分:2)
您需要禁用quartz java包的日志记录,即org.quartz.*
看起来你用这行
错误配置了log4j log4j.logger.searchLogger.quartz=OFF, searchLogger
相反应该阅读
log4j.logger.org.quartz=OFF