You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Jitin Dominic (Jira)" <ji...@apache.org> on 2022/02/02 11:14:00 UTC

[jira] [Created] (LOG4J2-3385) New log file on each run

Jitin Dominic created LOG4J2-3385:
-------------------------------------

             Summary: New log file on each run
                 Key: LOG4J2-3385
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3385
             Project: Log4j 2
          Issue Type: Question
            Reporter: Jitin Dominic


I'm using the latest log4j2 dependencies in my grails 2.5.4 application. Following are the dependencies used:
 * log4j-api
 * log4j-core
 * log4j-1.2-api
 * log4j-slf4j-impl

 

I'm trying to configure the _log4j2.properties_ in a way to create a new file based on date and time on each application run.

Here's my log4j2.properties file:
{code:java}
appender.rolling.type = RollingFile
appender.rolling.name = RollingFile
appender.rolling.fileName = /home/jd/application.log
appender.rolling.filePattern = /home/jd/application.%d{dd-MMM-hh}.log

appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n

appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true

appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5
 
logger.rolling.name =
org.apache.logging.log4j.core.appender.RollingFileAppender

logger.rolling.level = debug
logger.rolling.additivity = false
logger.rolling.appenderRefs = rolling
logger.rolling.appenderRef.rolling.ref = RollingFile
 {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)