0 Replies Latest reply: Dec 7, 2008 3:25 PM by 843810 RSS

    log4j - issue in configuring the file name for daily rolling file adapter

    843810
      We have configured the log4j properties. We want to create back-up of log file each hour. The file name of the log file is MyApp.log and as per the below configuration after each hour backup file is created as

      MyApp.log<<time>>

      but we want that file should be created in follogin format

      MyApp<<time>>.log

      Below are the log4j properties configured, please let us know, what should be the correct option to create the filename in desired format.

      # Set root logger level to DEBUG and its only appender to MyApp.
      log4j.rootLogger=DEBUG, MyApp

      log4j.appender.MyApp=org.apache.log4j.DailyRollingFileAppender
      log4j.appender.MyApp.File=D:/logs/MyApp.log
      log4j.appender.MyApp.DatePattern='.'yyyy-MM-dd-HH
      log4j.appender.MyApp.Append=true
      log4j.appender.MyApp.layout=org.apache.log4j.PatternLayout
      log4j.appender.MyApp.layout.ConversionPattern=[%d{yyyy-MM-dd} %d{HH:mm:ss z}] %m%n