Update archiving logs functionality
Change-Id: I833e913e0157725bf483d6f45588c3f02db42a9c
Related-prod: PROD-28239
diff --git a/save_jenkins_console/console_get_reports.sh b/save_jenkins_console/console_get_reports.sh
index b7bbe14..2124624 100755
--- a/save_jenkins_console/console_get_reports.sh
+++ b/save_jenkins_console/console_get_reports.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-source /home/ubuntu/programs/osccore-qa-testing-tools/save_jenkins_console/.venv/bin/activate
-python /home/ubuntu/programs/osccore-qa-testing-tools/save_jenkins_console/save_jenkins_console/jenkins_api.py
+source /home/ubuntu/osccore-qa-testing-tools/save_jenkins_console/.venv/bin/activate
+python /home/ubuntu/osccore-qa-testing-tools/save_jenkins_console/save_jenkins_console/jenkins_api.py
rm -fr /tmp/oscore_qa_logs/*
diff --git a/save_jenkins_console/save_jenkins_console/config.py b/save_jenkins_console/save_jenkins_console/config.py
index ab72bf2..89bf306 100755
--- a/save_jenkins_console/save_jenkins_console/config.py
+++ b/save_jenkins_console/save_jenkins_console/config.py
@@ -39,3 +39,4 @@
LOGGIGNG_FOLDER = '/tmp/oscore_qa_logs/'
LOGGIGNG_JENKINS_API = 'jenkins_api.log'
LOGGIGNG_UTILS = 'utils.log'
+LOG_FILENAME = 'manage_files.log'
diff --git a/save_jenkins_console/save_jenkins_console/manage_files.py b/save_jenkins_console/save_jenkins_console/manage_files.py
index db69b46..0836624 100755
--- a/save_jenkins_console/save_jenkins_console/manage_files.py
+++ b/save_jenkins_console/save_jenkins_console/manage_files.py
@@ -17,9 +17,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import config
+import logging
import os
import time
+logging.basicConfig(
+ format='[%(asctime)s][%(name)s][%(levelname)s] %(message)s',
+ datefmt='%d-%m-%Y %H:%M:%S',
+ handlers=[logging.FileHandler('{}{}'.format(
+ config.LOGGIGNG_FOLDER, config.LOG_FILENAME)), logging.StreamHandler()],
+ level=logging.INFO)
+logger = logging.getLogger('delete_old_files')
+
def delete_old_files(days, path):
logger.info("Removing files older than {} days".format(days))