logs location question

37 views
Skip to first unread message

Ruairi

unread,
May 19, 2025, 11:22:35 AM5/19/25
to archivematica

I'm trying to make changes to:
src/archivematica/MCPClient/clientScripts/create_transfer_mets.py

and I added so many Logger.info logs to try and debug my changes, but in dockerised archivematica I can't find them anywhere. When I do docker logs am-archivematica-mcp-client-1 , I can't see any of my info logs. I googled that I'm meant to have /var/logs/archivematics/MCPClient.log but I can't find this on my VM where I deploy archivematica. Any recommendations for debugging this? 

Thanks, Ruairi

Douglas Cerna

unread,
May 20, 2025, 6:26:22 PM5/20/25
to archiv...@googlegroups.com
Hello,

When I do docker logs am-archivematica-mcp-client-1 , I can't see any of my info logs.

Do you see any service logs at all? Or does the command return an empty response or error message?

This is probably obvious to you but this is how I'd approach it using the Compose development environment with the today's qa/* branches:



--
You received this message because you are subscribed to the Google Groups "archivematica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivematic...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/archivematica/25753053-5420-40f2-8c23-6fcb2f0205een%40googlegroups.com.


--
Douglas Cerna (he/him),
Software Developer, Artefactual Systems Inc.
http://www.artefactual.com
Message has been deleted

Ruairi

unread,
Jun 6, 2025, 12:09:18 PM6/6/25
to archivematica
Hi Douglas,

This is my file with logs:

I ran through all the steps in the gist but still never could see our *TEST* logs. Do you see anything obviously wrong in my file? 
Many thanks,
Ruairi

Douglas Cerna

unread,
Jun 6, 2025, 12:41:51 PM6/6/25
to archiv...@googlegroups.com
Hello Ruairi,

Your logger changes look fine to me. I applied a few of them on top of the current qa/1.x branch in my development environment and they seem to work:

replaceafill@vm1:~/archivematica$ git diff src/
diff --git a/src/archivematica/MCPClient/clientScripts/create_transfer_mets.py b/src/archivematica/MCPClient/clientScripts/create_transfer_mets.py
index 02adbb416..0fa032dd7 100755
--- a/src/archivematica/MCPClient/clientScripts/create_transfer_mets.py
+++ b/src/archivematica/MCPClient/clientScripts/create_transfer_mets.py
@@ -47,7 +47,9 @@ IE_PREMIS_META["xsi:type"] = "premis:intellectualEntity"
 
 
 logger = logging.getLogger(__name__)
+logger.setLevel(logging.INFO)
 
+logger.info("**TEST** Logging is working inside create_transfer_mets.")
 
 def write_mets(mets_path, transfer_dir_path, base_path_placeholder, transfer_uuid):
     """
@@ -809,7 +811,10 @@ def call(jobs):
 
     for job in jobs:
         with job.JobContext(logger=logger):
+            print("**TEST** finished create_transfer_mets")
+            logger.info("**TEST** about to start create_transfer_mets")
             args = parser.parse_args(job.args[1:])
             write_mets(
                 args.xml_file, args.base_path, args.base_path_string, args.sip_uuid
             )
+            logger.info("**TEST** finished create_transfer_mets")

Then I restarted the AM services and flushed/cleared my container logs (this is an irreversible operation btw) to start fresh:

replaceafill@vm1:~/archivematica/hack$ make restart-am-services
replaceafill@vm1:~/archivematica/hack$ sudo make flush-logs

Then I ran a transfer and your logs are there:

replaceafill@vm1:~/archivematica/hack$ docker compose logs archivematica-mcp-client | grep '**TEST**'
archivematica-mcp-client-1  | **TEST** finished create_transfer_mets
archivematica-mcp-client-1  | archivematicaClient.py: INFO      2025-06-06 16:20:19,037  archivematica.MCPClient.clientScripts.create_transfer_mets:call:815:  **TEST** about to start create_transfer_mets
archivematica-mcp-client-1  | archivematicaClient.py: INFO      2025-06-06 16:20:19,193  archivematica.MCPClient.clientScripts.create_transfer_mets:call:820:  **TEST** finished create_transfer_mets

If you wonder why the "Logging is working inside create_transfer_mets" line is not here it's because it is only written when the MCPClient service starts and parses the module. Since I flushed the logs it was lost. If I restart the services it's printed again:

replaceafill@vm1:~/archivematica/hack$ make restart-am-services
docker compose restart --no-deps archivematica-mcp-server
[+] Restarting 1/1
 ✔ Container am-archivematica-mcp-server-1  Started                                                                                                                                                                    2.2s
docker compose restart --no-deps archivematica-mcp-client
[+] Restarting 1/1
 ✔ Container am-archivematica-mcp-client-1  Started                                                                                                                                                                    1.3s
docker compose restart --no-deps archivematica-dashboard
[+] Restarting 1/1
 ✔ Container am-archivematica-dashboard-1  Started                                                                                                                                                                     1.5s
docker compose restart --no-deps archivematica-storage-service
[+] Restarting 1/1
 ✔ Container am-archivematica-storage-service-1  Started                                                                                                                                                               1.7s
replaceafill@vm1:~/archivematica/hack$ docker compose logs archivematica-mcp-client | grep '**TEST**'
archivematica-mcp-client-1  | **TEST** finished create_transfer_mets
archivematica-mcp-client-1  | archivematicaClient.py: INFO      2025-06-06 16:20:19,037  archivematica.MCPClient.clientScripts.create_transfer_mets:call:815:  **TEST** about to start create_transfer_mets
archivematica-mcp-client-1  | archivematicaClient.py: INFO      2025-06-06 16:20:19,193  archivematica.MCPClient.clientScripts.create_transfer_mets:call:820:  **TEST** finished create_transfer_mets
archivematica-mcp-client-1  | archivematicaClient.py: INFO      2025-06-06 16:30:53,225  archivematica.MCPClient.clientScripts.create_transfer_mets:<module>:52:  **TEST** Logging is working inside create_transfer_mets.

What do you see in your MCPClient logs after *** RUNNING TASK: createtransfermets_v1.0*** when your transfer runs?


Reply all
Reply to author
Forward
0 new messages