Generally, I would log the error to the status logger and then cause the 
factory/builder for the component to return null. 

Ralph

> On May 3, 2017, at 7:52 AM, Mikael Ståldal <[email protected]> wrote:
> 
> The main problem I have is that I get two ERROR messages for one problem.
> 
> On Wed, May 3, 2017 at 4:50 PM, Gary Gregory <[email protected]> wrote:
> 
>> As I am experiencing now in a different stack, too much is better than too
>> little ;-)
>> 
>> Are you thinking that the stack traces make it overwhelming? Or the
>> messages not clear enough?
>> 
>> Gary
>> 
>> On May 3, 2017 3:23 AM, "Mikael Ståldal" <[email protected]>
>> wrote:
>> 
>> What is an appender supposed to do when it cannot be created due to the
>> supplied configuration being invalid?
>> 
>> I tried to throw IllegalArgumentException and ConfigurationException, but
>> in both cases I get a bit too much error logging:
>> 
>> 2017-05-03 12:17:36,757 main ERROR Unable to inject fields into builder
>> class for plugin type class
>> org.apache.logging.log4j.core.appender.HttpAppender, element Http.
>> org.apache.logging.log4j.core.config.ConfigurationException:
>> java.net.MalformedURLException: unknown protocol: htt
>> at
>> org.apache.logging.log4j.core.appender.HttpManager.<init>(
>> HttpManager.java:44)
>> at
>> org.apache.logging.log4j.core.appender.HttpAppender$Builder.
>> build(HttpAppender.java:61)
>> at
>> org.apache.logging.log4j.core.appender.HttpAppender$Builder.
>> build(HttpAppender.java:46)
>> at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(
>> PluginBuilder.java:122)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createPluginObject(AbstractConfiguration.java:952)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createConfiguration(AbstractConfiguration.java:892)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createConfiguration(AbstractConfiguration.java:884)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(
>> AbstractConfiguration.java:508)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(
>> AbstractConfiguration.java:232)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> start(AbstractConfiguration.java:244)
>> at
>> org.apache.logging.log4j.core.LoggerContext.setConfiguration(
>> LoggerContext.java:545)
>> at org.apache.logging.log4j.core.LoggerContext.start(
>> LoggerContext.java:261)
>> at
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(
>> Log4jContextFactory.java:239)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:158)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:131)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:101)
>> Caused by: java.net.MalformedURLException: unknown protocol: htt
>> at java.base/java.net.URL.<init>(URL.java:634)
>> at java.base/java.net.URL.<init>(URL.java:523)
>> at java.base/java.net.URL.<init>(URL.java:470)
>> at
>> org.apache.logging.log4j.core.appender.HttpManager.<init>(
>> HttpManager.java:42)
>> ... 31 more
>> 
>> 2017-05-03 12:17:36,764 main ERROR Unable to invoke factory method in class
>> class org.apache.logging.log4j.core.appender.HttpAppender for element
>> Http.
>> java.lang.IllegalStateException: No factory method found for class
>> org.apache.logging.log4j.core.appender.HttpAppender
>> at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.
>> findFactoryMethod(PluginBuilder.java:224)
>> at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(
>> PluginBuilder.java:130)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createPluginObject(AbstractConfiguration.java:952)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createConfiguration(AbstractConfiguration.java:892)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> createConfiguration(AbstractConfiguration.java:884)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(
>> AbstractConfiguration.java:508)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(
>> AbstractConfiguration.java:232)
>> at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.
>> start(AbstractConfiguration.java:244)
>> at
>> org.apache.logging.log4j.core.LoggerContext.setConfiguration(
>> LoggerContext.java:545)
>> at org.apache.logging.log4j.core.LoggerContext.start(
>> LoggerContext.java:261)
>> at
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(
>> Log4jContextFactory.java:239)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:158)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:131)
>> at
>> org.apache.logging.log4j.core.config.Configurator.
>> initialize(Configurator.java:101)
>> 
>> 
>> --
>> [image: MagineTV]
>> 
>> *Mikael Ståldal*
>> Senior software developer
>> 
>> *Magine TV*
>> [email protected]
>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>> 
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may not
>> copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>> 
> 
> 
> 
> -- 
> [image: MagineTV]
> 
> *Mikael Ståldal*
> Senior software developer
> 
> *Magine TV*
> [email protected]
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
> 
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.


Reply via email to