[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slf4j-user
Subject:    Re: [slf4j-user] Fwd: SLF4J Warning - Loggers will not work as they were created during initializati
From:       Debraj Manna <subharaj.manna () gmail ! com>
Date:       2018-01-16 16:53:44
Message-ID: CAF6DVKNy0dJGmK_rOisZT=EFr3vw_tUMXUdi5oqdpBYqg4jCFg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


This is not an issue with slf4j. I am hitting the below issue with
dropwizard and logback.

https://github.com/dropwizard/dropwizard/issues/1367

It seems this has been fixed in 1.2.0 as explained here
<https://github.com/dropwizard/dropwizard/pull/1900>.

Once I manage to upgrade dropwizard to 1.2.0. I will post my finding here
again.

On Tue, Jan 16, 2018 at 3:24 PM, Ceki <ceki@qos.ch> wrote:

> If you are going to update, go for the latest.
>
> On 16.01.2018 05:13, Debraj Manna wrote:
>
>> Thanks Ceki.
>>
>> Ok I am using slf4j-api 1.7.5. Even after initialization I am not seeing
>> the logging events being logged while using that logger. I will update to
>> the slf4j 1.7.15 and post back with the results.
>>
>> On Tue, Jan 16, 2018 at 2:51 AM, Ceki <ceki@qos.ch <mailto:ceki@qos.ch>>
>> wrote:
>>
>>
>>     As of SLF4J 1.7.15, slf4j-api stores and replays events that were
>>     created during the initialization phase. In previous versions, these
>>     events were lost. However, logging events occurring after
>>     initialization should work fine in all versions.
>>
>>     I suggest upgrading slf4j-api to 1.7.25.
>>
>>     On 15.01.2018 20:14, Debraj Manna wrote:
>>
>>
>>         ---------- Forwarded message ----------
>>         From: *Debraj Manna* <subharaj.manna@gmail.com
>>         <mailto:subharaj.manna@gmail.com>
>>         <mailto:subharaj.manna@gmail.com <mailto:subharaj.manna@gmail.com
>> >>>
>>         Date: Tue, Jan 16, 2018 at 12:30 AM
>>         Subject: SLF4J Warning - Loggers will not work as they were
>>         created during initialization phase
>>         To: slf4j-user@qos.ch <mailto:slf4j-user@qos.ch>
>>         <mailto:slf4j-user@qos.ch <mailto:slf4j-user@qos.ch>>
>>
>>
>>         Cross-posting from stackoverflow
>>         <https://stackoverflow.com/questions/48268724/slf4j-warning-
>> loggers-will-not-work-as-they-were-created-during-initialization
>>         <https://stackoverflow.com/questions/48268724/slf4j-warning-
>> loggers-will-not-work-as-they-were-created-during-initialization>>
>>
>>         I am using slf4j with logback in a dropwizard application.
>>         During the application initialization I am seeing logs like below
>>
>>         |SLF4J:Thefollowing loggers will not work because they were
>>         created SLF4J:during the defaultconfiguration phase of the
>>         underlying logging system.SLF4J:Seealso
>>         http://www.slf4j.org/codes.html#substituteLogger
>>         <http://www.slf4j.org/codes.html#substituteLogger>
>>         <http://www.slf4j.org/codes.html#substituteLogger
>>         <http://www.slf4j.org/codes.html#substituteLogger>>SLF4J:com
>> .vnera.healthandmetrics.VneraMetrics|
>>
>>         I am using |logback.xml| with my dropwizard application. My code
>>         flow looks like below
>>
>>         |publicclassVneraMetrics{privatestaticfinalLoggerlogger
>>         =LoggerFactory.getLogger(VneraMetrics.class);...// This method
>>         is getting called from Service.run() during the dropwizard
>>         application initializationpublicStringgetSomeValue(){// logger
>>         is not accessed from this functionreturn"Some initialized
>>         value";}}publicclassServiceextendsApplication<Conf>{publicst
>> aticfinalLoggerlogger
>>         =LoggerFactory.getLogger(Service.class);publicstaticvoidmain
>> (Stringargs[]){logger.info
>>         <http://logger.info>("Some logs");Serviceservice
>>
>>         =newService();service.run(dropWizardArgs);Utils.reloadLogger
>> ();}}|
>>
>>         |Utils.reloadLogger()| is loading the loggback configuration as
>>         discussed here
>>
>>         |publicstaticvoidreloadLogger(){StringloggingConfig
>>         =System.getProperty("logback.configurationFile");if(loggingConfig
>> ==null){System.out.println("Logging
>>         Config is null");}LoggerContextloggerContext
>>         =(LoggerContext)LoggerFactory.getILoggerFactory();loggerCont
>> ext.reset();JoranConfiguratorconfigurator
>>         =newJoranConfigurator();try{InputStreamconfigStream
>>         =FileUtils.openInputStream(newFile(loggingConfig));configura
>> tor.setContext(loggerContext);configurator.doConfigure(configStream);//
>>         loads logback
>>         fileconfigStream.close();System.out.println("Loaded
>>         configuration
>>         file");}catch(JoranException|IOExceptione){e.printStackTrace
>> ();System.out.println("Failed
>>         to log configuration file");System.exit(1);}}}|
>>
>>         *Versions*
>>
>>            * Logback - 1.2.3
>>            * Dropwizard - 1.0.2
>>
>>         Can some one let me know what does the SLF4J warning denotes? I
>>         have seen the substituteLogger
>>         <http://www.slf4j.org/codes.html#substituteLogger
>>         <http://www.slf4j.org/codes.html#substituteLogger>> page but
>>         this does not mention how can I get around this? On trying to
>>         use logger in |VneraMetrics| it is not printing anything.
>>
>>
>>
>>
>>         _______________________________________________
>>         slf4j-user mailing list
>>         slf4j-user@qos.ch <mailto:slf4j-user@qos.ch>
>>         http://mailman.qos.ch/mailman/listinfo/slf4j-user
>>         <http://mailman.qos.ch/mailman/listinfo/slf4j-user>
>>
>>     _______________________________________________
>>     slf4j-user mailing list
>>     slf4j-user@qos.ch <mailto:slf4j-user@qos.ch>
>>     http://mailman.qos.ch/mailman/listinfo/slf4j-user
>>     <http://mailman.qos.ch/mailman/listinfo/slf4j-user>
>>
>>
>>

[Attachment #5 (text/html)]

<div dir="ltr">This is not an issue with slf4j. I am hitting the below issue with \
dropwizard and logback.  <div><br></div><div><a \
href="https://github.com/dropwizard/dropwizard/issues/1367">https://github.com/dropwizard/dropwizard/issues/1367</a><br></div><div><br></div><div>It \
seems this has been fixed in 1.2.0 as explained <a \
href="https://github.com/dropwizard/dropwizard/pull/1900">here</a>.  \
</div><div><br></div><div>Once I manage to upgrade dropwizard to 1.2.0. I will post \
my finding here again.  </div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Tue, Jan 16, 2018 at 3:24 PM, Ceki <span dir="ltr">&lt;<a \
href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex">If you are going to update, go for the latest.<span \
class=""><br> <br>
On 16.01.2018 05:13, Debraj Manna wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><span class=""> Thanks Ceki.<br>
<br>
Ok I am using slf4j-api 1.7.5. Even after initialization I am not seeing the logging \
events being logged while using that logger. I will update to the slf4j 1.7.15 and \
post back with the results.<br> <br></span><span class="">
On Tue, Jan 16, 2018 at 2:51 AM, Ceki &lt;<a href="mailto:ceki@qos.ch" \
target="_blank">ceki@qos.ch</a> &lt;mailto:<a href="mailto:ceki@qos.ch" \
target="_blank">ceki@qos.ch</a>&gt;&gt; wrote:<br> <br>
<br>
      As of SLF4J 1.7.15, slf4j-api stores and replays events that were<br>
      created during the initialization phase. In previous versions, these<br>
      events were lost. However, logging events occurring after<br>
      initialization should work fine in all versions.<br>
<br>
      I suggest upgrading slf4j-api to 1.7.25.<br>
<br>
      On 15.01.2018 20:14, Debraj Manna wrote:<br>
<br>
<br>
            ---------- Forwarded message ----------<br>
            From: *Debraj Manna* &lt;<a href="mailto:subharaj.manna@gmail.com" \
                target="_blank">subharaj.manna@gmail.com</a><br>
            &lt;mailto:<a href="mailto:subharaj.manna@gmail.com" \
target="_blank">subharaj.manna@gmail.c<wbr>om</a>&gt;<br></span><span class="">  \
&lt;mailto:<a href="mailto:subharaj.manna@gmail.com" \
target="_blank">subharaj.manna@gmail.c<wbr>om</a> &lt;mailto:<a \
href="mailto:subharaj.manna@gmail.com" \
target="_blank">subharaj.manna@gmail.c<wbr>om</a>&gt;&gt;&gt;<br>  Date: Tue, Jan 16, \
                2018 at 12:30 AM<br>
            Subject: SLF4J Warning - Loggers will not work as they were<br>
            created during initialization phase<br>
            To: <a href="mailto:slf4j-user@qos.ch" \
target="_blank">slf4j-user@qos.ch</a> &lt;mailto:<a href="mailto:slf4j-user@qos.ch" \
target="_blank">slf4j-user@qos.ch</a>&gt;<br></span><div><div class="h5">  \
&lt;mailto:<a href="mailto:slf4j-user@qos.ch" target="_blank">slf4j-user@qos.ch</a> \
&lt;mailto:<a href="mailto:slf4j-user@qos.ch" \
target="_blank">slf4j-user@qos.ch</a>&gt;&gt;<br> <br>
<br>
            Cross-posting from stackoverflow<br>
            &lt;<a href="https://stackoverflow.com/questions/48268724/slf4j-warning-loggers-will-not-work-as-they-were-created-during-initialization" \
rel="noreferrer" target="_blank">https://stackoverflow.com/que<wbr>stions/48268724/slf \
4j-warning-<wbr>loggers-will-not-work-as-they-<wbr>were-created-during-initializa<wbr>tion</a><br>
  &lt;<a href="https://stackoverflow.com/questions/48268724/slf4j-warning-loggers-will-not-work-as-they-were-created-during-initialization" \
rel="noreferrer" target="_blank">https://stackoverflow.com/que<wbr>stions/48268724/slf \
4j-warning-<wbr>loggers-will-not-work-as-they-<wbr>were-created-during-initializa<wbr>tion</a>&gt;&gt;<br>
 <br>
            I am using slf4j with logback in a dropwizard application.<br>
            During the application initialization I am seeing logs like below<br>
<br>
            |SLF4J:Thefollowing loggers will not work because they were<br>
            created SLF4J:during the defaultconfiguration phase of the<br>
            underlying logging system.SLF4J:Seealso<br>
            <a href="http://www.slf4j.org/codes.html#substituteLogger" \
rel="noreferrer" target="_blank">http://www.slf4j.org/codes.htm<wbr>l#substituteLogger</a><br>
  &lt;<a href="http://www.slf4j.org/codes.html#substituteLogger" rel="noreferrer" \
target="_blank">http://www.slf4j.org/codes.ht<wbr>ml#substituteLogger</a>&gt;<br>  \
&lt;<a href="http://www.slf4j.org/codes.html#substituteLogger" rel="noreferrer" \
target="_blank">http://www.slf4j.org/codes.ht<wbr>ml#substituteLogger</a><br>  &lt;<a \
href="http://www.slf4j.org/codes.html#substituteLogger" rel="noreferrer" \
target="_blank">http://www.slf4j.org/codes.ht<wbr>ml#substituteLogger</a>&gt;&gt;SLF4J:com<wbr>.vnera.healthandmetrics.VneraM<wbr>etrics|<br>
 <br>
            I am using |logback.xml|  with my dropwizard application. My code<br>
            flow looks like below<br>
<br>
            |publicclassVneraMetrics{priva<wbr>testaticfinalLoggerlogger<br>
            =LoggerFactory.getLogger(Vnera<wbr>Metrics.class);...// This method<br>
            is getting called from Service.run() during the dropwizard<br>
            application initializationpublicStringgetS<wbr>omeValue(){// logger<br>
            is not accessed from this functionreturn&quot;Some initialized<br>
            value&quot;;}}publicclassServiceext<wbr>endsApplication&lt;Conf&gt;{publicst<wbr>aticfinalLoggerlogger<br>
  =LoggerFactory.getLogger(Servi<wbr>ce.class);publicstaticvoidmain<wbr>(Stringargs[]){<a \
href="http://logger.info" rel="noreferrer" \
target="_blank">logger.info</a><br></div></div>  &lt;<a href="http://logger.info" \
rel="noreferrer" target="_blank">http://logger.info</a>&gt;(&quot;Some \
                logs&quot;);Serviceservice<div><div class="h5"><br>
            =newService();service.run(drop<wbr>WizardArgs);Utils.reloadLogger<wbr>();}}|<br>
 <br>
            |Utils.reloadLogger()|  is loading the loggback configuration as<br>
            discussed here<br>
<br>
            |publicstaticvoidreloadLogger(<wbr>){StringloggingConfig<br>
            =System.getProperty(&quot;logback.c<wbr>onfigurationFile&quot;);if(loggingC<wbr>onfig \
==null){System.out.println(&quot;Lo<wbr>gging<br>  Config is \
                null&quot;);}LoggerContextloggerCon<wbr>text<br>
            =(LoggerContext)LoggerFactory.<wbr>getILoggerFactory();loggerCont<wbr>ext.reset();JoranConfiguratorc<wbr>onfigurator<br>
  =newJoranConfigurator();try{In<wbr>putStreamconfigStream<br>
            =FileUtils.openInputStream(new<wbr>File(loggingConfig));configura<wbr>tor. \
setContext(loggerContext);<wbr>configurator.doConfigure(<wbr>configStream);//<br>  \
                loads logback<br>
            fileconfigStream.close();Syste<wbr>m.out.println(&quot;Loaded<br>
            configuration<br>
            file&quot;);}catch(JoranException|I<wbr>OExceptione){e.printStackTrace<wbr>();System.out.println(&quot;Failed<br>
  to log configuration file&quot;);System.exit(1);}}}|<br>
<br>
            *Versions*<br>
<br>
                 * Logback - 1.2.3<br>
                 * Dropwizard - 1.0.2<br>
<br>
            Can some one let me know what does the SLF4J warning denotes? I<br>
            have seen the substituteLogger<br>
            &lt;<a href="http://www.slf4j.org/codes.html#substituteLogger" \
rel="noreferrer" target="_blank">http://www.slf4j.org/codes.ht<wbr>ml#substituteLogger</a><br>
  &lt;<a href="http://www.slf4j.org/codes.html#substituteLogger" rel="noreferrer" \
target="_blank">http://www.slf4j.org/codes.ht<wbr>ml#substituteLogger</a>&gt;&gt;  \
                page but<br>
            this does not mention how can I get around this? On trying to<br>
            use logger in |VneraMetrics|  it is not printing anything.<br>
<br>
<br>
<br>
<br>
            ______________________________<wbr>_________________<br>
            slf4j-user mailing list<br></div></div>
            <a href="mailto:slf4j-user@qos.ch" target="_blank">slf4j-user@qos.ch</a> \
&lt;mailto:<a href="mailto:slf4j-user@qos.ch" \
target="_blank">slf4j-user@qos.ch</a>&gt;<br>  <a \
href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" \
target="_blank">http://mailman.qos.ch/mailman/<wbr>listinfo/slf4j-user</a><span \
class=""><br>  &lt;<a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" \
rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman<wbr>/listinfo/slf4j-user</a>&gt;<br>
 <br>
      ______________________________<wbr>_________________<br>
      slf4j-user mailing list<br></span>
      <a href="mailto:slf4j-user@qos.ch" target="_blank">slf4j-user@qos.ch</a> \
&lt;mailto:<a href="mailto:slf4j-user@qos.ch" \
                target="_blank">slf4j-user@qos.ch</a>&gt;<br>
      <a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" \
target="_blank">http://mailman.qos.ch/mailman/<wbr>listinfo/slf4j-user</a><br>  \
&lt;<a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" \
target="_blank">http://mailman.qos.ch/mailman<wbr>/listinfo/slf4j-user</a>&gt;<br> \
<br> <br>
</blockquote>
</blockquote></div><br></div>


[Attachment #6 (text/plain)]

_______________________________________________
slf4j-user mailing list
slf4j-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic