Project

General

Profile

Revision cf681ac9

IDcf681ac99351c860ea0b854fa6dee1dfa763c20e
Parent 3775575b
Child 04c948d8

Added by Patrick Plitzner about 2 years ago

ref #7085 Use DailyRollingFileAppender (in code)

View differences:

src/main/java/eu/etaxonomy/cdm/server/Bootloader.java
47 47
import org.apache.commons.cli.ParseException;
48 48
import org.apache.commons.io.FileUtils;
49 49
import org.apache.commons.io.FilenameUtils;
50
import org.apache.log4j.DailyRollingFileAppender;
50 51
import org.apache.log4j.Logger;
52
import org.apache.log4j.PatternLayout;
53
import org.apache.log4j.RollingFileAppender;
51 54
import org.eclipse.jetty.apache.jsp.JettyJasperInitializer;
52 55
import org.eclipse.jetty.jmx.MBeanContainer;
53 56
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
......
359 362
        }
360 363

  
361 364
        //append logger
362
//        configureFileLogger();
365
        configureFileLogger();
363 366

  
364 367
        logger.info("Starting "+APPLICATION_NAME);
365 368
        logger.info("Using  " + System.getProperty("user.home") + " as home directory. Can be specified by -Duser.home=<FOLDER>");
......
626 629
     *
627 630
     */
628 631
//   ===== removing useless RollingFileAppender logger === see #6287
629
//    private void configureFileLogger() {
630
//
631
//        PatternLayout layout = new PatternLayout("%d %p [%c] - %m%n");
632
//        try {
633
//            String logFile = logPath + File.separator + "cdmserver.log";
634
//            RollingFileAppender appender = new RollingFileAppender(layout, logFile);
635
//            appender.setMaxBackupIndex(3);
636
//            appender.setMaxFileSize("2MB");
637
//            Logger.getRootLogger().addAppender(appender);
638
//            logger.info("logging to :" + logFile);
639
//        } catch (IOException e) {
640
//            logger.error("Creating RollingFileAppender failed:", e);
641
//        }
642
//    }
632
    private void configureFileLogger() {
633

  
634
        PatternLayout layout = new PatternLayout("%d %p [%c] - %m%n");
635
        try {
636
            String logFile = logPath + File.separator + "cdmserver.log";
637
            DailyRollingFileAppender appender = new DailyRollingFileAppender(layout, logFile, "'.' yyyy-MM-dd-HH");
638
            Logger.getRootLogger().addAppender(appender);
639
            logger.info("logging to :" + logFile);
640
        } catch (IOException e) {
641
            logger.error("Creating RollingFileAppender failed:", e);
642
        }
643
    }
643 644

  
644 645

  
645 646
    /**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)