1

I use log4j.properties with a Solr 5.2. My Solr is working in the production environment so I do not want to restart it unless it's really necessary.

What I changed:

log4j.appender.file=org.apache.log4j.RollingFileAppender 

to:

log4j.appender.APP=path.to.class.CustomRollingFileAppender
log4j.appender.APP.DatePattern='.'yyyy-MM-dd
log4j.appender.APP.TimeInterval=1

I would like Solr to use the changed log4j.properties file without Solr process restarted.

Is it possible?

freedev
  • 25,946
  • 8
  • 108
  • 125
Anti
  • 11
  • 2

2 Answers2

0

No, you are going to need to restart Solr so the new setting in log4j.properties kicks in.

What you can do without restarting changing the level logging for any class. You do this in

  1. Go to Solr dashboard
  2. go under Logging/Level (that would be http://localhost:8983/solr/#/~logging/level in my local installation)

Any change there will be reset when you restart Solr. This does not help you in your case, just mentioning for completeness, it might be enough for some people.

Persimmonium
  • 15,593
  • 11
  • 47
  • 78
0

As far as I know is not possible reload the log4j configuration automatically in Solr or at least is not implemented such behaviour.

So you need to restart you Solr instance.

But given that Solr uses Log4J version 1.2 for logging, have a look at this (is taken from Log4j FAQ):

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.

This means that you can, alternatively, develop your own component in order to implement the behaviour you need.

freedev
  • 25,946
  • 8
  • 108
  • 125