You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/09/22 17:56:21 UTC

svn commit: r1525383 - in /jena/trunk/jena-fuseki: log4j.properties run_fuseki src/main/java/org/apache/jena/fuseki/FusekiCmd.java

Author: andy
Date: Sun Sep 22 15:56:21 2013
New Revision: 1525383

URL: http://svn.apache.org/r1525383
Log:
JENA-536 Use file log4j.properties in the start-up directory if available.

Removed:
    jena/trunk/jena-fuseki/log4j.properties
Modified:
    jena/trunk/jena-fuseki/run_fuseki
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java

Modified: jena/trunk/jena-fuseki/run_fuseki
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/run_fuseki?rev=1525383&r1=1525382&r2=1525383&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/run_fuseki (original)
+++ jena/trunk/jena-fuseki/run_fuseki Sun Sep 22 15:56:21 2013
@@ -22,7 +22,7 @@
 export FUSEKI_HOME=${FUSEKI_HOME:-$HOME/Jena/jena-fuseki}
 if [ ! -e $FUSEKI_HOME ]
 then
-     echo "$FUSEKI_HOME does not exist" 1>&2
+    echo "$FUSEKI_HOME does not exist" 1>&2
     exit 1
     fi
 if [ ! -d $FUSEKI_HOME ]
@@ -52,7 +52,7 @@ do
     fi
 done
 
-FUSEKI_LOG=${FUSEKI_LOG:-} # "-D-Dlog4j.configuration=file:$FUSEKI_HOME/log4j.properties"
+FUSEKI_LOG=${FUSEKI_LOG:-}
 JVM_ARGS="${JVM_ARGS:--Xmx1200M}"
 #JVM_ARGS="$JVM_ARGS -XX:MaxDirectMemorySize=1G"
 

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java?rev=1525383&r1=1525382&r2=1525383&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java Sun Sep 22 15:56:21 2013
@@ -20,6 +20,7 @@ package org.apache.jena.fuseki;
 
 import static org.apache.jena.fuseki.Fuseki.serverLog ;
 
+import java.io.File ;
 import java.io.InputStream ;
 import java.util.List ;
 
@@ -84,12 +85,35 @@ public class FusekiCmd extends CmdARQ
         ) ;
 
     
-    static {
-        // Check if default command logging.
-        if ( "set".equals(System.getProperty("log4j.configuration", "set") ) )
-            Log.resetLogging(log4Jsetup) ; 
+    // Set logging.
+    // 1/ Use log4j.configuration is defined.
+    // 2/ Use file:log4j.properties 
+    // 3/ Use Built in.
+    
+    static void setLogging() {
+        // No loggers have been created but configuration may have been set up. 
+        String x = System.getProperty("log4j.configuration", null) ;
+        
+        if ( x != null && ! x.equals("set") ) {
+            // "set" indicates that CmdMain set logging.
+            // Use standard log4j initialization.
+            return ;
+        }
+        
+        String fn = "log4j.properties" ;
+        File f = new File(fn) ;
+        if ( f.exists() ) {
+            System.out.println("File") ;
+            // Use file log4j.properties
+            System.setProperty("log4j.configuration", "file:"+fn) ;
+            return ;
+        }
+        // Use built-in for Fuseki.
+        Log.resetLogging(log4Jsetup) ;     
     }
     
+    static { setLogging() ; }
+
     // Arguments:
     // --update