Hi Atita,
You should definetely go with log4j configuration as anything else would be 
redoing what log4j can do. You already have slowQueryThresholdMillies to make 
slow queries log with WARN and you can configure log4j to put such logs (class 
+ level) to a separate file.
This seems like frequent question and not sure why putting logs to separate 
file is not a default configuration - maybe it would make things bit more 
complicated with logs view in admin console…
If get stuck, let me know (+ Solr version) and I’ll play a bit and send you 
configs.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 9 Oct 2017, at 16:27, Atita Arora <atitaar...@gmail.com> wrote:
> 
> Hi ,
> 
> I have a situation here where I am required to log the slow queries into a
> seperate log file which then can be used for optimization purposes.
> For now this log is aggregated into the mainstream log marking
> [slow:......].
> I looked into the code and the configuration and I am really clueless as to
> how do I go about seperating the slow query logs as it needs another file
> appender
> to be created other than the one already present in the log4j.
> If I create another appender I can do so by degregating through log levels
> , so that moves all the WARN logs to another file (which is not what I am
> looking for).
> Also from the code prespective , I feel how about if I introduce another
> config setting along with the slowQueryThresholdMillis value , something
> like
> 
> slowQueryLogFile = get("query/slowQueryLogFile", logfilepath);
> 
> 
> where slowQueryLogFile and if present it logs into this file otherwise it
> works on the already present along with
> 
> slowQueryThresholdMillis = getInt("query/slowQueryThresholdMillis", -1);
> 
> 
> or should I tweak log4j ?
> I am not sure if anyone has done that before or have any pointers to guide
> me on this.
> Please help.
> 
> Thanks in advance,
> Atita

Reply via email to