Do we have any good example in the code to follow?

On Thu, May 4, 2017 at 2:47 AM, Remko Popma <[email protected]> wrote:

> Yes, if you search for "ignoring" you should find a few other places where
> error handling is done similarly.
>
> (Shameless plug) Every java main() method deserves http://picocli.info
>
> > On May 4, 2017, at 5:20, Gary Gregory <[email protected]> wrote:
> >
> > The problem is that users see an exception in their log and panic. I've
> > seen this time and time again. Nothing is wrong with the app; the logging
> > or another component is misconfigured is all. The component tells you
> > something is wrong and the app continues normally. Usually.
> >
> > I'm not sure how to address this aside from a less alarming message,
> maybe
> > adding something like "Log4j will continue without this setting".
> >
> > Gary
> >
> > On May 3, 2017 12:54 PM, "Matt Sicker" <[email protected]> wrote:
> >
> > Exactly what Ralph said. The established pattern we have right now is
> > StatusLogger.error, return null. Who wants their logging framework
> blowing
> > up their application anyways? ;)
> >
> >> On 3 May 2017 at 10:41, Ralph Goers <[email protected]> wrote:
> >>
> >> 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.
> >>
> >>
> >>
> >
> >
> > --
> > Matt Sicker <[email protected]>
>



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