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 "Matt Quinn (JIRA)" <ji...@apache.org> on 2015/03/16 20:59:38 UTC

[jira] [Commented] (LOG4J2-976) Using monitorInterval with YAML config file format causes JSONParseException

    [ https://issues.apache.org/jira/browse/LOG4J2-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14363792#comment-14363792 ] 

Matt Quinn commented on LOG4J2-976:
-----------------------------------

Here is a potential patch which resolves the issue in my environment:

{noformat}
diff -r apache-log4j-2.2-src/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YamlConfiguration.java ../apache-log4j-2.2-src/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YamlConfiguration.java
18a19
> import org.apache.logging.log4j.core.config.Configuration;
19a21
> import org.apache.logging.log4j.core.config.Reconfigurable;
26c28,30
< public class YamlConfiguration extends JsonConfiguration {
---
> import java.io.IOException;
> 
> public class YamlConfiguration extends JsonConfiguration implements Reconfigurable {
38a43,55
>     @Override
>     public Configuration reconfigure() {
>         try {
>             final ConfigurationSource source = getConfigurationSource().resetInputStream();
>             if (source == null) {
>                 return null;
>             }
>             return new YamlConfiguration(source);
>         } catch (final IOException ex) {
>             LOGGER.error("Cannot locate file {}", getConfigurationSource(), ex);
>         }
>         return null;
>     }
{noformat}

> Using monitorInterval with YAML config file format causes JSONParseException
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-976
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-976
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators, Core
>    Affects Versions: 2.0.2, 2.1, 2.2
>            Reporter: Matt Quinn
>            Priority: Minor
>
> If, when using the YAML configuration file format, the monitorInterval config attribute is configured in order to automatically reconfigure logging, a JSONParseException is thrown when the configuration file is reloaded after the file changes.
> This appears to be because the YamlConfiguration class does not override the reconfigure() method from the Reconfigurable interface.  The base class implementation is called, which assumes a JSON-style grammar instead of YAML.



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