log4j configuration reload

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

log4j configuration reload

Vincenzo D'Amore
Hi all,

I'm investigating around latest version of Solr (6.4.1) if it is possible
reload the log4j.properties configuration file without Solr restart.

As far as I understood it isn't possible, or at least, it's impossible
without develop an ad hoc component.

Do you know if there are workarounds or best practices about?

Best regards,
Vincenzo


--
Vincenzo D'Amore
email: [hidden email]
skype: free.dev
mobile: +39 349 8513251
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: log4j configuration reload

Vincenzo D'Amore
An update, I've found this:

http://logging.apache.org/log4j/1.2/faq.html#a3.6

*Is there a way to get log4j to automatically reload a configuration file
> if it changes?*



>
> Yes. Both the DOMConfigurator and the PropertyConfigurator support
> automatic reloading through the configureAndWatch method. See the API
> documentation for more details.
> Because the configureAndWatch launches a separate wathdog thread, and
> because there is no way to stop this thread in log4j 1.2, the
> configureAndWatch method is unsafe for use in J2EE envrironments where
> applications are recycled.


Anyone has tried it?


On Wed, Apr 19, 2017 at 9:27 AM, Vincenzo D'Amore <[hidden email]>
wrote:

> Hi all,
>
> I'm investigating around latest version of Solr (6.4.1) if it is possible
> reload the log4j.properties configuration file without Solr restart.
>
> As far as I understood it isn't possible, or at least, it's impossible
> without develop an ad hoc component.
>
> Do you know if there are workarounds or best practices about?
>
> Best regards,
> Vincenzo
>
>
> --
> Vincenzo D'Amore
> email: [hidden email]
> skype: free.dev
> mobile: +39 349 8513251 <349%20851%203251>
>



--
Vincenzo D'Amore
email: [hidden email]
skype: free.dev
mobile: +39 349 8513251
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: log4j configuration reload

Shawn Heisey-2
In reply to this post by Vincenzo D'Amore
On 4/19/2017 1:27 AM, Vincenzo D'Amore wrote:
> I'm investigating around latest version of Solr (6.4.1) if it is possible
> reload the log4j.properties configuration file without Solr restart.
>
> As far as I understood it isn't possible, or at least, it's impossible
> without develop an ad hoc component.
>
> Do you know if there are workarounds or best practices about?

This would depend on exactly what you changed.  If the change involves
logging levels at the top level or for a specific class, you can simply
make the same change in the logging tab of the admin UI, and it will
take effect immediately.  If you changed something else, you will need
to restart Solr.

The log4j library itself may have the ability to make changes without a
restart, but since you're running an application that somebody else
wrote, you're stuck with what that application can do.  Logging levels
are the only thing that Solr currently has code to change on the fly.

Thanks,
Shawn

Loading...