You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Vincenzo D'Amore <v....@gmail.com> on 2017/04/19 07:27:53 UTC

log4j configuration reload

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: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251

Re: log4j configuration reload

Posted by Vincenzo D'Amore <v....@gmail.com>.
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 <v....@gmail.com>
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: v.damore@gmail.com
> skype: free.dev
> mobile: +39 349 8513251 <349%20851%203251>
>



-- 
Vincenzo D'Amore
email: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251

Re: log4j configuration reload

Posted by Shawn Heisey <ap...@elyograg.org>.
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