Re: lucene-solr:master: SOLR-8186: Solr start scripts, only log to console when running in foreground

2016-09-22 Thread Jan Høydahl
Yep, will propose a safer way

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 22. sep. 2016 kl. 10.38 skrev Uwe Schindler :
> 
> Hi Janhoy,
> 
> the commit breaks forbidden-apis checks, because direct usage of Log4J 
> instead of Slf4J warppers is not wanted for application code. I think this 
> one is special, so I'd move the silencer stuff to a private method that’s 
> called from init(). This private method could be @SuppressForbidden. Please 
> don't make the whole class or init() suppressed.
> 
> I'd still add this in a huge try-catch block, so users not using log4j don't 
> break. We have similar stuff at other places, too. I think we also have a 
> separate class to initialize the logging system, so the DispatchFilter is the 
> wrong place for this to live: CheckLoggingConfiguration.java
> 
> Uwe
> 
> -
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de 
> eMail: u...@thetaphi.de 
> 
>> -Original Message-
>> From: jan...@apache.org  [mailto:jan...@apache.org 
>> ]
>> Sent: Thursday, September 22, 2016 1:21 AM
>> To: comm...@lucene.apache.org 
>> Subject: lucene-solr:master: SOLR-8186: Solr start scripts, only log to 
>> console
>> when running in foreground
>> 
>> Repository: lucene-solr
>> Updated Branches:
>>  refs/heads/master 7561461f7 -> 2ef34e9e2
>> 
>> 
>> SOLR-8186: Solr start scripts, only log to console when running in foreground
>> 
>> 
>> Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/lucene-
>> solr/commit/2ef34e9e
>> Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2ef34e9e
>> Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2ef34e9e
>> 
>> Branch: refs/heads/master
>> Commit: 2ef34e9e24ac2c0bd72de54c3edda9ba3aa43728
>> Parents: 7561461
>> Author: Jan HC8ydahl mailto:jan...@apache.org>>
>> Authored: Thu Sep 22 01:18:27 2016 +0200
>> Committer: Jan HC8ydahl mailto:jan...@apache.org>>
>> Committed: Thu Sep 22 01:18:27 2016 +0200
>> 
>> --
>> solr/CHANGES.txt |  3 +++
>> solr/bin/solr|  2 +-
>> solr/bin/solr.cmd| 17 -
>> .../java/org/apache/solr/core/CoreContainer.java |  4 +++-
>> .../apache/solr/servlet/SolrDispatchFilter.java  | 19 +++
>> solr/server/resources/log4j.properties   |  4 ++--
>> solr/webapp/web/WEB-INF/web.xml  | 17 +
>> 7 files changed, 57 insertions(+), 9 deletions(-)
>> --
>> 
>> 
>> http://git-wip-us.apache.org/repos/asf/lucene-
>> solr/blob/2ef34e9e/solr/CHANGES.txt
>> --
>> diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
>> index 0119917..391381a 100644
>> --- a/solr/CHANGES.txt
>> +++ b/solr/CHANGES.txt
>> @@ -87,6 +87,9 @@ New Features
>> 
>> * SOLR-9319: DELETEREPLICA can accept a 'count' and remove appropriate
>> replicas (Nitin Sharma, noble)
>> 
>> +* SOLR-8186: Reduce logging to logs/solr--console.log when not
>> running in foreground mode
>> +  Show timestamp also in foreground log. Also removes some logging noise.
>> (janhoy)
>> +
>> Bug Fixes
>> --
>> 
>> 
>> http://git-wip-us.apache.org/repos/asf/lucene-
>> solr/blob/2ef34e9e/solr/bin/solr
>> --
>> diff --git a/solr/bin/solr b/solr/bin/solr
>> index e2a665d..d3c6530 100755
>> --- a/solr/bin/solr
>> +++ b/solr/bin/solr
>> @@ -1547,7 +1547,7 @@ function launch_solr() {
>> exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar
>> "${SOLR_JETTY_CONFIG[@]}"
>>   else
>> # run Solr in the background
>> -nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS \
>> +nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -
>> Dsolr.log.muteconsole \
>>  "-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh
>> $SOLR_PORT $SOLR_LOGS_DIR" \
>> -jar start.jar "${SOLR_JETTY_CONFIG[@]}" \
>>  1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $!
>>> "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
>> 
>> http://git-wip-us.apache.org/repos/asf/lucene-
>> solr/blob/2ef34e9e/solr/bin/solr.cmd
>> --
>> diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
>> index e9c8f84..2e6e6a9 100644
>> --- a/solr/bin/solr.cmd
>> +++ b/solr/bin/solr.cmd
>> @@ -968,15 +968,22 @@ IF "%FG%"=="1" (
>>   REM run solr in the foreground
>>   title "Solr-%SOLR_PORT%"
>>   echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
>> -  "%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS%
>> %GCLOG_OPT%:

RE: lucene-solr:master: SOLR-8186: Solr start scripts, only log to console when running in foreground

2016-09-22 Thread Uwe Schindler
Hi Janhoy,

the commit breaks forbidden-apis checks, because direct usage of Log4J instead 
of Slf4J warppers is not wanted for application code. I think this one is 
special, so I'd move the silencer stuff to a private method that’s called from 
init(). This private method could be @SuppressForbidden. Please don't make the 
whole class or init() suppressed.

I'd still add this in a huge try-catch block, so users not using log4j don't 
break. We have similar stuff at other places, too. I think we also have a 
separate class to initialize the logging system, so the DispatchFilter is the 
wrong place for this to live: CheckLoggingConfiguration.java

Uwe

-
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -Original Message-
> From: jan...@apache.org [mailto:jan...@apache.org]
> Sent: Thursday, September 22, 2016 1:21 AM
> To: comm...@lucene.apache.org
> Subject: lucene-solr:master: SOLR-8186: Solr start scripts, only log to 
> console
> when running in foreground
> 
> Repository: lucene-solr
> Updated Branches:
>   refs/heads/master 7561461f7 -> 2ef34e9e2
> 
> 
> SOLR-8186: Solr start scripts, only log to console when running in foreground
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucene-
> solr/commit/2ef34e9e
> Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2ef34e9e
> Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2ef34e9e
> 
> Branch: refs/heads/master
> Commit: 2ef34e9e24ac2c0bd72de54c3edda9ba3aa43728
> Parents: 7561461
> Author: Jan HC8ydahl 
> Authored: Thu Sep 22 01:18:27 2016 +0200
> Committer: Jan HC8ydahl 
> Committed: Thu Sep 22 01:18:27 2016 +0200
> 
> --
>  solr/CHANGES.txt |  3 +++
>  solr/bin/solr|  2 +-
>  solr/bin/solr.cmd| 17 -
>  .../java/org/apache/solr/core/CoreContainer.java |  4 +++-
>  .../apache/solr/servlet/SolrDispatchFilter.java  | 19 +++
>  solr/server/resources/log4j.properties   |  4 ++--
>  solr/webapp/web/WEB-INF/web.xml  | 17 +
>  7 files changed, 57 insertions(+), 9 deletions(-)
> --
> 
> 
> http://git-wip-us.apache.org/repos/asf/lucene-
> solr/blob/2ef34e9e/solr/CHANGES.txt
> --
> diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
> index 0119917..391381a 100644
> --- a/solr/CHANGES.txt
> +++ b/solr/CHANGES.txt
> @@ -87,6 +87,9 @@ New Features
> 
>  * SOLR-9319: DELETEREPLICA can accept a 'count' and remove appropriate
> replicas (Nitin Sharma, noble)
> 
> +* SOLR-8186: Reduce logging to logs/solr--console.log when not
> running in foreground mode
> +  Show timestamp also in foreground log. Also removes some logging noise.
> (janhoy)
> +
>  Bug Fixes
>  --
> 
> 
> http://git-wip-us.apache.org/repos/asf/lucene-
> solr/blob/2ef34e9e/solr/bin/solr
> --
> diff --git a/solr/bin/solr b/solr/bin/solr
> index e2a665d..d3c6530 100755
> --- a/solr/bin/solr
> +++ b/solr/bin/solr
> @@ -1547,7 +1547,7 @@ function launch_solr() {
>  exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar
> "${SOLR_JETTY_CONFIG[@]}"
>else
>  # run Solr in the background
> -nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS \
> +nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -
> Dsolr.log.muteconsole \
>   "-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh
> $SOLR_PORT $SOLR_LOGS_DIR" \
>  -jar start.jar "${SOLR_JETTY_CONFIG[@]}" \
>   1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $!
> > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
> 
> http://git-wip-us.apache.org/repos/asf/lucene-
> solr/blob/2ef34e9e/solr/bin/solr.cmd
> --
> diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
> index e9c8f84..2e6e6a9 100644
> --- a/solr/bin/solr.cmd
> +++ b/solr/bin/solr.cmd
> @@ -968,15 +968,22 @@ IF "%FG%"=="1" (
>REM run solr in the foreground
>title "Solr-%SOLR_PORT%"
>echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
> -  "%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS%
> %GCLOG_OPT%:"!SOLR_LOGS_DIR!"/solr_gc.log -
> Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -
> DSTOP.KEY=%STOP_KEY% ^
> --Djetty.port=%SOLR_PORT% -Dsolr.solr.home="%SOLR_HOME%" -
> Dsolr.install.dir="%SOLR_TIP%" -Djetty.home="%SOLR_SERVER_DIR%" -
> Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar
> "%SOLR_JETTY_CONFIG%"
> +  "%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS%
> %GCLOG_OPT%:"!SOLR_LOGS_DIR!"/solr_gc.log ^
> +-Dlog4j.configuration="%LOG