0

在我的应用程序中,一旦部署应用程序,就会安排石英作业。我有两个日志文件home-log-search.loghome-log-app.log,都用于特定的日志记录。搜索日志文件仅记录访问者的 IP,其余所有日志记录(异常、调试信息)都记录在 App 日志文件中。

我面临的问题是,默认的 Quartz 语句正在登录home-log-search.log文件,这不是必需的。

如何禁用该日志记录?将级别设置为关闭不起作用。我还关注了禁用石英日志记录,但这也没有帮助。

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

1 回答 1

2

您需要禁用quartz java包的日志记录,即org.quartz.*

看起来好像你用这一行错误配置了 log4j

log4j.logger.searchLogger.quartz=OFF, searchLogger

相反,它应该阅读

log4j.logger.org.quartz=OFF

于 2013-06-14T21:40:21.430 回答