Skip to content

Commit 9d182e5

Browse files
committed
Enhance logging output on errors.
1 parent ffbaa88 commit 9d182e5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

rootfs/var/www/leaf-isle-bagger/drupal/utilities.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,22 @@ def create_aip(node_list, bagger_app_path):
113113
# https://docs.python.org/3/library/subprocess.html
114114
logging.info(f" Generating AIP: {node}")
115115
try:
116-
subprocess.run(
116+
ret = subprocess.run(
117117
[
118118
"./bin/console",
119119
"app:islandora_bagger:create_bag",
120-
"-vvv",
121120
"--settings=var/sample_per_bag_config.yaml",
122121
f"--node={node}",
123122
],
124123
stdout=subprocess.PIPE,
125124
stderr=subprocess.STDOUT,
126-
check=True,
125+
check=False,
127126
cwd=bagger_app_path,
128127
text=True,
129128
)
129+
if ret.returncode != 0:
130+
logging.critical(f"{ret.stdout}")
131+
ret.check_returncode()
130132
except subprocess.CalledProcessError as e:
131133
logging.error(f"{e}")
132134
except Exception as e:

rootfs/var/www/leaf-isle-bagger/leaf-bagger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def main():
129129
logging_handlers.append(logging.FileHandler(args.error_log))
130130

131131
# Config Logging
132-
logging.basicConfig(level=args.logging_level, handers=logging_handlers)
132+
logging.basicConfig(level=args.logging_level, handlers=logging_handlers)
133133
logging.getLogger("swiftclient").setLevel(logging.CRITICAL)
134134

135135
username, password = drupalUtilities.get_drupal_credentials()

0 commit comments

Comments
 (0)