Skip to content

Commit

Permalink
Enhance logging output on errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferya committed Jan 15, 2025
1 parent bb3f045 commit c0dc5c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions rootfs/var/www/leaf-isle-bagger/drupal/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,22 @@ def create_aip(node_list, bagger_app_path):
# https://docs.python.org/3/library/subprocess.html
logging.info(f" Generating AIP: {node}")
try:
subprocess.run(
ret = subprocess.run(
[
"./bin/console",
"app:islandora_bagger:create_bag",
"-vvv",
"--settings=var/sample_per_bag_config.yaml",
f"--node={node}",
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=True,
check=False,
cwd=bagger_app_path,
text=True,
)
if ret.returncode != 0:
logging.critical(f"{ret.stdout}")
ret.check_returncode()
except subprocess.CalledProcessError as e:
logging.error(f"{e}")
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion rootfs/var/www/leaf-isle-bagger/leaf-bagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def main():
logging_handlers.append(logging.FileHandler(args.error_log))

# Config Logging
logging.basicConfig(level=args.logging_level, handers=logging_handlers)
logging.basicConfig(level=args.logging_level, handlers=logging_handlers)
logging.getLogger("swiftclient").setLevel(logging.CRITICAL)

username, password = drupalUtilities.get_drupal_credentials()
Expand Down

0 comments on commit c0dc5c9

Please sign in to comment.