Configuring RollingFileAppender in log4j

前端 未结 8 1317
谎友^
谎友^ 2020-12-01 01:43

I\'m working on a set of web services and we\'d like to have a daily rotated log.

I\'m trying to get org.apache.log4j.rolling.RollingFileAppender from t

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 02:42

    Update: at least as early as 2013 (see Mubashar's comment) this started working.


    According to Log4jXmlFormat you cannot configure it with log4j.properties, but only using the XML config format:

    Note that TimeBasedRollingPolicy can only be configured with xml, not log4j.properties

    Unfortunately, the example log4j.xml they provide doesn't work either:

    log4j:ERROR Parsing error on line 14 and column 76
    log4j:ERROR Element type "rollingPolicy" must be declared.
    ...
    log4j:WARN Please set a rolling policy for the RollingFileAppender named 'FILE'
    

提交回复
热议问题