Skip to content

Commit fecfad1

Browse files
committed
[NYS2AWS-156] improved original code for env. variables log configuration
1 parent 9478eff commit fecfad1

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

xenit/solr6/local/94-init-solr-logging.sh

+3-13
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,11 @@ echo "Working directory is..."
1515
pwd
1616

1717
# Section that allows the loggers to be configured using env. variables.
18-
## 1. If it does not yet exist, create a backup of the original log4j.properties file.
19-
## reason: both this section, as well as the 'JSON_LOGGING' section below, apply changes to log4j.properties in a destructive manner.
20-
backup_file_exists=$(ls ${SOLR_INSTALL_HOME}/logs/log4j.properties.bak 2>/dev/null | wc -l)
21-
if [ $backup_file_exists -eq 0 ]; then
22-
echo "Could not find a backup of the original log4j.properties file at ${SOLR_INSTALL_HOME}/logs/log4j.properties.bak. Creating one now..."
23-
cp ${SOLR_INSTALL_HOME}/logs/log4j.properties ${SOLR_INSTALL_HOME}/logs/log4j.properties.bak
24-
fi
25-
## 2. Revert back to the original log4j.properties file.
26-
echo "Reverting ${SOLR_INSTALL_HOME}/logs/log4j.properties to the original state..."
27-
cp ${SOLR_INSTALL_HOME}/logs/log4j.properties.bak ${SOLR_INSTALL_HOME}/logs/log4j.properties
28-
## 3. Introduce a new section in the log4j.properties file that clearly states that these properties are set using env. variables.
18+
## 1. Introduce a new section in the log4j.properties file that clearly states that these properties are set using env. variables.
2919
env_variables_properties_section_start="### 94-init-solr-logging.sh: this section is automatically configured using env. variables with the 'LOG_' prefix; do not modify this section manually! ###"
3020
env_variables_properties_section_stop="### 94-init-solr-logging.sh: end of automatically configured section ###"
3121
echo "${env_variables_properties_section_start}" >> ${SOLR_INSTALL_HOME}/logs/log4j.properties
32-
## 4. write the env. variables to the log4j.properties file.
22+
## 2. write the env. variables to the log4j.properties file.
3323
echo "Writing env. variables with the 'LOG_' prefix to ${SOLR_INSTALL_HOME}/logs/log4j.properties..."
3424
for var in $(env | grep '^LOG_'); do
3525
var_without_log_prefix=${var#LOG_}
@@ -40,7 +30,7 @@ for var in $(env | grep '^LOG_'); do
4030

4131
echo "${var_without_log_prefix}" >> ${SOLR_INSTALL_HOME}/logs/log4j.properties
4232
done
43-
## 5. End the section.
33+
## 3. End the section.
4434
echo "${env_variables_properties_section_stop}" >> ${SOLR_INSTALL_HOME}/logs/log4j.properties
4535

4636
# if JSON_LOGGING is true, we manipulate the layout of the logging

0 commit comments

Comments
 (0)