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:16:00 UTC

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

     [ https://issues.apache.org/jira/browse/LOG4J2-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jitin Dominic updated LOG4J2-3385:
----------------------------------
    Description: 
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}

  was:
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.

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}


> 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}



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