Hi,

In a tcl source module in my Rivet website I'm launching a thread to handle periodic database management. I'm having trouble getting that thread to log to the apache log.

Part of the SetupDatabase proc launches the thread with -

tsv::set [namespace current] Tid [thread::create -preserved [subst {
    #
    # Give the new thread access to the same website code base and copy the
    # module configuration over.
    #
    set auto_path "$::auto_path"
    namespace eval [namespace current] {
        array set Config \{[array get Config]\}
    }

    [namespace current]::Log "(\[pid\]) New thread created at \[clock format \[clock seconds\]\]"

    if {\[catch "package require Rivet" output ropts\]} {
        [namespace current]::Log "(\[pid\]) package require Rivet failed: \$output"
    }

    thread::wait     ; # DEBUG


The Log function was created to capture some logging output and it simply appends the message into a log file in the website's tmp directory (adjacent directory to the source files). I can see in this log file that the new thread is created (line 2) but the "package require Rivet" fails with the "invalid command name ::rivet::inspect" (line 3)?

(31279) SetupDatabase: Launching the management thread.
(31279) New thread created at Sat Jun 01 22:26:40 AEST 2024
(31279) package require Rivet failed: invalid command name "::rivet::inspect"
A test message from the thread at Sat Jun 01 22:26:40 AEST 2024
A test message from the thread at Sat Jun 01 22:26:41 AEST 2024
scotty@server1:/home/Shares/Engineering/Web/SVP-Technical-Services$


I'm trying to load the Rivet package in this new thread because I want to use the ::rivet::apache_log_error function. It's rather opaque inside the thread and I have to examine the sqlite data base operations. It's certainly not doing maintenance correctly.

Am I do this correctly by trying to package require Rivet?

I know that if I try to call ::rivet::apache_log_error from inside the thread protected by catch I get:

(32512) New thread created at Sat Jun 01 22:46:31 AEST 2024
(32512) ::rivet::apache_log_error failed: invalid command name "::rivet::apache_log_error"

Kind regards,
Scott



--
+-----------------------------------------------------------------------------+
|...will make the wilderness a pool of water, the dry land springs of water...|
+-----------------------------------------------------------------------------+
| Scott Pitcher                            sco...@svptechnicalservices.com.au |
| +61-3-9008-5695 (B)                                  SVP Technical Services |
|PGP: https://gnupg.org/                                   ABN 79 220 496 603 |
|KEY: https://pgp.mit.edu/pks/lookup?op=vindex&search=0xEDBE43639EFD884D      |
+-----------------------------------------------------------------------------+

DISCLAIMER:
The content of this email is confidential and strictly intended only for the
recipient(s) specified in the message. If you have received this message by
mistake it is strictly forbidden to keep this email in any form, electronic
or hard copy, or to share any part of it with any one else, without the prior,
written consent of the author. If you have received this message by mistake,
please let me know by replying to this email, and then destroy it and any
copies.

SECURITY:
I prefer to send and receive confidential messages protected by PGP public
key encryption. If you are willing to or are interested in protecting our
email communication with PGP encryption, please refer to https://gnupg.org/.

Attachment: OpenPGP_0xEDBE43639EFD884D.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to