[
https://issues.apache.org/jira/browse/LOG4J2-1100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Charles Leclerc updated LOG4J2-1100:
------------------------------------
Description:
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 (the
file log doesn't work) :
{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.
was:
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 (the
file log doesn't work) :
{noformat}
2015-08-21 11:08:41,503 ERROR Error processing element Policy: CLASS_NOT_FOUND
2015-08-21 11:08:41,546 ERROR Unable to locate plugin for Policy
2015-08-21 11:08:41,553 ERROR Unable to invoke factory method in class class
org.apache.logging.log4j.core.appender.RollingFileAppender for element
RollingFile. java.lang.NullPointerException
at
org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.findNamedNode(PluginElementVisitor.java:100)
at
org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:87)
at
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:251)
at
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:771)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:707)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:699)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at
org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:422)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:494)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:510)
at
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:199)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:146)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:1)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:177)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:447)
at ca.bell.bbm.ps.security.btat.BTATServer.<clinit>(BTATServer.java:45)
2015-08-21 11:08:41,555 ERROR Null object returned for RollingFile in Appenders.
2015-08-21 11:08:41,564 ERROR Unable to locate appender File for logger
{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.
> 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 (the
> file log doesn't work) :
> {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: [email protected]
For additional commands, e-mail: [email protected]