[PATCH 2 of 2] Merged

Wald Commits scm-commit at wald.intevation.org
Mon Jan 20 14:54:43 CET 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1390226075 -3600
# Node ID 772c22b0ea12188a28cfbf807b3ad4070f6ff564
# Parent  91a57b66c7ed5f0498eef662c3e90527774b4948
# Parent  e1c30527c10486328a097436c29e00c883da7971
Merged

diff -r 91a57b66c7ed -r 772c22b0ea12 .hgignore
--- a/.hgignore	Mon Jan 20 12:44:16 2014 +0100
+++ b/.hgignore	Mon Jan 20 14:54:35 2014 +0100
@@ -22,3 +22,4 @@
 etl/test-output # eclipse junit/testng plugin output
 \.swp
 \.swo
+\.jar
diff -r 91a57b66c7ed -r 772c22b0ea12 backend/contrib/import_river.sh
--- a/backend/contrib/import_river.sh	Mon Jan 20 12:44:16 2014 +0100
+++ b/backend/contrib/import_river.sh	Mon Jan 20 14:54:35 2014 +0100
@@ -70,7 +70,7 @@
    -p, --port=<number>             Use port number <number>. Default: $DEFAULT_PORT
    -d, --db-name=<database_name>   Name of the database / backend. Default: $DEFAULT_BACKEND_NAME
    -l, --log-dir=<directory>       Directory in which to create the log files.
-                                   Default: $LOG_DIR
+                                   Default: $PWD/logs
    --postgres                      Database is PostgreSQL
    --skip-hydro                    Skip import of hydrological data
    --skip-morpho                   Skip import of morphological data
@@ -80,8 +80,8 @@
 exit 0
 }
 
-OPTS=`getopt -o ?u:w:h:p:d: \
-     -l help,username:,password:,host:,port:,db-name:,skip-hydro,skip-morpho,skip-geo,skip-prf,postgres \
+OPTS=`getopt -o ?u:w:h:p:d:l: \
+     -l help,username:,password:,host:,port:,db-name:,log-dir:,skip-hydro,skip-morpho,skip-geo,skip-prf,postgres \
      -n $0 -- "$@"`
 if [ $? != 0 ] ; then usage; fi
 eval set -- "$OPTS"
@@ -146,7 +146,7 @@
 if [ -z $BACKEND_NAME ]; then
   BACKEND_NAME=$DEFAULT_BACKEND_NAME
 fi
-if [ -z $LOGDIR ]; then
+if [ -z $LOG ]; then
   LOG=$DEFAULT_LOG
 fi
 
@@ -164,6 +164,16 @@
 LOG_DIR=${LOG}/`basename $GEW_FILE .gew`-$DATE
 mkdir -p ${LOG_DIR}
 
+cat > "$LOG_DIR/log4j.properties" << "EOF"
+log4j.rootLogger=DEBUG, IMPORTER
+log4j.appender.IMPORTER.layout=org.apache.log4j.PatternLayout
+log4j.appender.IMPORTER.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.IMPORTER=org.apache.log4j.RollingFileAppender
+log4j.appender.IMPORTER.File=./import.log
+log4j.appender.IMPORTER.MaxFileSize=100000KB
+log4j.appender.IMPORTER.MaxBackupIndex=10
+EOF
+
 if [ "$POSTGRES" = "TRUE" ]; then
     JAR=$(echo "$JAR" | sed 's/importer/importer_psql/')
     if [ ! -r "$JAR" ]; then
@@ -189,7 +199,8 @@
     LOG_FILE=${LOG_DIR}/hydro.log
     echo Importing Hydrological data.
     echo Logging into: $LOG_FILE
-    sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties
+    sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \
+        $LOG_DIR/log4j.properties
     java -jar \
     -Xmx$MIN_MEMORY \
     -server \
@@ -236,7 +247,8 @@
     LOG_FILE=${LOG_DIR}/morpho.log
     echo Importing Morphological data.
     echo Logging into: $LOG_FILE
-    sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties
+    sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \
+        $LOG_DIR/log4j.properties
     java -jar \
     -Xmx$MIN_MEMORY \
     -server \
@@ -283,7 +295,8 @@
     LOG_FILE=${LOG_DIR}/prf.log
     echo Importing cross section data.
     echo Logging into: $LOG_FILE
-    sed 's!./import.log!'"$LOG_FILE"'!' conf/log4j.properties > $LOG_DIR/log4j.properties
+    sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \
+        $LOG_DIR/log4j.properties
     java -jar \
     -Xmx$MIN_MEMORY \
     -server \
diff -r 91a57b66c7ed -r 772c22b0ea12 backend/doc/documentation/de/importer-hydr-morph.tex
--- a/backend/doc/documentation/de/importer-hydr-morph.tex	Mon Jan 20 12:44:16 2014 +0100
+++ b/backend/doc/documentation/de/importer-hydr-morph.tex	Mon Jan 20 14:54:35 2014 +0100
@@ -908,3 +908,6 @@
 \end{lstlisting}
 Alternativ können auch in diesem Skript einige Variablen 
 (\textit{DEFAULT\_*}) angepasst werden.
+Das Logging kann in diesem Fall nicht wie oben beschrieben
+über \textit{conf/log4j.properties} angepasst werden, da hier
+mehrere Log-Dateien geschrieben werden müssen.


More information about the Dive4elements-commits mailing list