关闭Quartz工作日志(Turning off Quartz job logging)

2019-10-30 07:06发布

在我的应用程序,石英作业,一旦应用程序部署计划。 我有两个日志文件home-log-search.loghome-log-app.log ,既为特定的记录。 搜索日志文件只记录访问者的IP和休息的所有记录(例外,调试信息)记录在应用程序日志文件。

我现在面临的问题是,越来越记录在默认石英报表home-log-search.log不要求文件。

如何禁用日志记录? level设置为OFF不会奏效。 我也跟着禁用石英记录 ,但也没有帮助。

下面是我的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);
}
}

Answer 1:

你需要禁用日志记录石英Java包,这是org.quartz.*

它看起来好像你已经配置错误log4j的这条线

log4j.logger.searchLogger.quartz=OFF, searchLogger

相反,它应该读

log4j.logger.org.quartz=OFF



文章来源: Turning off Quartz job logging