You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Charles Leclerc (JIRA)" <ji...@apache.org> on 2015/08/22 02:52:45 UTC
[jira] [Comment Edited] (LOG4J2-1100) Unable to configure Multiple
triggering policies on rolling file appender using yaml configuration file
[ https://issues.apache.org/jira/browse/LOG4J2-1100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14707715#comment-14707715 ]
Charles Leclerc edited comment on LOG4J2-1100 at 8/22/15 12:52 AM:
-------------------------------------------------------------------
This XML configuration worked fine :
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<RollingFile name="File" fileName="${sys:user.home}/.btat/btat.log" filePattern="${sys:user.home}/.btat/logs/btat-%d{yyyy-MM}-%i.log.gz">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
<DefaultRolloverStrategy max="20" />
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>
{code}
was (Author: scmouette):
This XML configuration worked fine :
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<RollingFile name="File" fileName="${sys:user.home}/.btat/btat.log"
filePattern="${sys:user.home}/.btat/logs/btat-%d{yyyy-MM}-%i.log.gz">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
<DefaultRolloverStrategy max="20" />
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>
{code}
> Unable to configure Multiple triggering policies on rolling file appender using yaml configuration file
> -------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-1100
> URL: https://issues.apache.org/jira/browse/LOG4J2-1100
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.3
> Reporter: Charles Leclerc
> Priority: Minor
>
> I wanted to use yaml instead of XML for better lisibility of the configuration. Here is the configuration I am using :
> {noformat}
> Configuration:
> status: warn
>
> Appenders:
> Console:
> - name: Console
> target: SYSTEM_OUT
> PatternLayout:
> Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
> RollingFile:
> - name: File
> fileName: "${sys:user.home}/.btat/btat.log"
> filePattern: "${sys:user.home}/.btat/logs/btat-%d{yyyy-MM}-%i.log.gz"
> PatternLayout:
> Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
> Policies:
> - TimeBasedTriggeringPolicy:
> interval: 7
> - SizeBasedTriggeringPolicy:
> size: 100 MB
> DefaultRolloverStrategy:
> max: 20
> Loggers:
> Root:
> level: info
> AppenderRef:
> - ref: Console
> - ref: File
> {noformat}
> When running the application I have the following error in the console :
> {noformat}
> 2015-08-21 11:25:26,052 ERROR appender RollingFile has no parameter that matches element Policies
> {noformat}
> I tried different changes but had no success. From what I understand the configuration above seems to be correct, but I may be wrong.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org