comparison backend/contrib/import_river.sh @ 9726:0a5239a1e46e 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Wed, 02 Mar 2022 10:26:50 +0100
parents f7c49975cc15
children
comparison
equal deleted inserted replaced
9725:da398790fa32 9726:0a5239a1e46e
149 RIVER_NAME=$(grep "Gew.sser" "$1" | sed 's/Gew.sser: //') 149 RIVER_NAME=$(grep "Gew.sser" "$1" | sed 's/Gew.sser: //')
150 DATE=$(date +%Y.%m.%d_%H%M) 150 DATE=$(date +%Y.%m.%d_%H%M)
151 LOG_DIR=${LOG}/`basename $GEW_FILE .gew`-$DATE 151 LOG_DIR=${LOG}/`basename $GEW_FILE .gew`-$DATE
152 mkdir -p ${LOG_DIR} 152 mkdir -p ${LOG_DIR}
153 153
154 cat > "$LOG_DIR/log4j.properties" << "EOF" 154 cat > "$LOG_DIR/log4j2.xml" << "EOF"
155 log4j.rootLogger=INFO, IMPORTER 155 <?xml version="1.0" encoding="UTF-8"?>
156 log4j.appender.IMPORTER.layout=org.apache.log4j.PatternLayout 156 <Configuration>
157 log4j.appender.IMPORTER.layout.ConversionPattern=%d [%t] %-5p %c - %m%n 157 <Appenders>
158 log4j.appender.IMPORTER=org.apache.log4j.RollingFileAppender 158 <RollingFile
159 log4j.appender.IMPORTER.File=./import.log 159 name="RollingFile"
160 log4j.appender.IMPORTER.MaxFileSize=100000KB 160 fileName="import.log"
161 log4j.appender.IMPORTER.MaxBackupIndex=10 161 filePattern="import.log.%i">
162 <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5p %c - %m%n"/>
163 <SizeBasedTriggeringPolicy size="100000 KB"/>
164 <DefaultRolloverStrategy max="10"/>
165 </RollingFile>
166 </Appenders>
167 <Loggers>
168 <Root level="DEBUG">
169 <AppenderRef ref="RollingFile"/>
170 </Root>
171 </Loggers>
172 </Configuration>
162 EOF 173 EOF
163 174
164 if [ "$POSTGRES" = "TRUE" ]; then 175 if [ "$POSTGRES" = "TRUE" ]; then
165 JAR=$(echo "$JAR" | sed 's/importer/importer_psql/') 176 JAR=$(echo "$JAR" | sed 's/importer/importer_psql/')
166 if [ ! -r "$JAR" ]; then 177 if [ ! -r "$JAR" ]; then
184 195
185 import_hydro(){ 196 import_hydro(){
186 LOG_FILE=${LOG_DIR}/hydro.log 197 LOG_FILE=${LOG_DIR}/hydro.log
187 echo Importing Hydrological data. 198 echo Importing Hydrological data.
188 echo Logging into: $LOG_FILE 199 echo Logging into: $LOG_FILE
189 sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \ 200 sed -i "s/import.log/$LOG_FILE/" $LOG_DIR/log4j2.xml
190 $LOG_DIR/log4j.properties
191 java -jar \ 201 java -jar \
192 -Xmx$MIN_MEMORY \ 202 -Xmx$MIN_MEMORY \
193 -server \ 203 -server \
194 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ 204 -Dlog4j2.configurationFile=file://$LOG_DIR/log4j2.xml \
195 -Dflys.backend.user=$DBUSER \ 205 -Dflys.backend.user=$DBUSER \
196 -Dflys.backend.password=$DBPASS \ 206 -Dflys.backend.password=$DBPASS \
197 -Dflys.backend.url=$BACKEND_URL \ 207 -Dflys.backend.url=$BACKEND_URL \
198 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ 208 -Dflys.backend.driver=$BACKEND_DB_DRIVER \
199 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ 209 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \
233 243
234 import_morpho(){ 244 import_morpho(){
235 LOG_FILE=${LOG_DIR}/morpho.log 245 LOG_FILE=${LOG_DIR}/morpho.log
236 echo Importing Morphological data. 246 echo Importing Morphological data.
237 echo Logging into: $LOG_FILE 247 echo Logging into: $LOG_FILE
238 sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \ 248 sed -i "s/import.log/$LOG_FILE/" $LOG_DIR/log4j2.xml
239 $LOG_DIR/log4j.properties
240 java -jar \ 249 java -jar \
241 -Xmx$MIN_MEMORY \ 250 -Xmx$MIN_MEMORY \
242 -server \ 251 -server \
243 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ 252 -Dlog4j2.configurationFile=file://$LOG_DIR/log4j2.xml \
244 -Dflys.backend.user=$DBUSER \ 253 -Dflys.backend.user=$DBUSER \
245 -Dflys.backend.password=$DBPASS \ 254 -Dflys.backend.password=$DBPASS \
246 -Dflys.backend.url=$BACKEND_URL \ 255 -Dflys.backend.url=$BACKEND_URL \
247 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ 256 -Dflys.backend.driver=$BACKEND_DB_DRIVER \
248 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ 257 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \
282 291
283 import_prf(){ 292 import_prf(){
284 LOG_FILE=${LOG_DIR}/prf.log 293 LOG_FILE=${LOG_DIR}/prf.log
285 echo Importing cross section data. 294 echo Importing cross section data.
286 echo Logging into: $LOG_FILE 295 echo Logging into: $LOG_FILE
287 sed -i 's!\(log4j.appender.IMPORTER.File=\).*!\1'"$LOG_FILE"'!' \ 296 sed -i "s/import.log/$LOG_FILE/" $LOG_DIR/log4j2.xml
288 $LOG_DIR/log4j.properties
289 java -jar \ 297 java -jar \
290 -Xmx$MIN_MEMORY \ 298 -Xmx$MIN_MEMORY \
291 -server \ 299 -server \
292 -Dlog4j.configuration=file://$LOG_DIR/log4j.properties \ 300 -Dlog4j2.configurationFile=file://$LOG_DIR/log4j2.xml \
293 -Dflys.backend.user=$DBUSER \ 301 -Dflys.backend.user=$DBUSER \
294 -Dflys.backend.password=$DBPASS \ 302 -Dflys.backend.password=$DBPASS \
295 -Dflys.backend.url=$BACKEND_URL \ 303 -Dflys.backend.url=$BACKEND_URL \
296 -Dflys.backend.driver=$BACKEND_DB_DRIVER \ 304 -Dflys.backend.driver=$BACKEND_DB_DRIVER \
297 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ 305 -Dflys.backend.dialect=$BACKEND_DB_DIALECT \

http://dive4elements.wald.intevation.org