[
https://issues.apache.org/jira/browse/LOG4J2-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ralph Goers closed LOG4J2-3385.
-------------------------------
Resolution: Not A Problem
Closing since the reporter found a solution.
> 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
> Priority: Major
>
> I'm using the latest (v2.17.1) 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.
> But when I run it, only the application.log file gets created. There's no
> date and time in the file name. And also, nothing is logged inside the file;
> it's empty. Any idea what I might be configuring wrong.
> 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}
> *+Update:+*
> When I add rootLogger level,
> {code:java}
> rootLogger.level = debug
> rootLogger.appenderRefs = rolling
> rootLogger.appenderRef.stdout.ref = RollingFile {code}
> am able to see the contents now in the file. Is it necessary to have root
> logger configured always?
>
> Although am still not able to generate multiple files based on each
> application run. It just created application.log file and keeps on appending
> the log of each run in the same file.
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)