You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Scott Pitcher <sc...@svptechnicalservices.com.au> on 2023/05/10 12:14:12 UTC

Logging from ChildInitScript

Hi,

I have a website with a RivetServerConf ChildInitScript pointing to a 
tcl script. The script works and operates normally. The only command 
that does not work is /::rivet::apache_log_error/. The following command 
in the script produces no log message:

::rivet::apache_log_error alert "childinit.tcl running ..."

The code execute and I I change the level from alert to some random 
string like abcdef for example, then the script doesn't run at all and 
when the normal session script runs, the child hasn't opened the 
databases and the client script fails too.

Is there a way of logging from the ChildInitScript?

Kind regards,
Scott


-- 
+--------------------------------------------------------------------------------+
| ... will make the wilderness a pool of water, the dry land springs of water ...|
+--------------------------------------------------------------------------------+
| Scott PitcherScotty@svptechnicalservices.com.au  |
| +61-3-9008-5695 (B)                                        +61-479-042-834 (M) |
| SVP Technical Services                                      ABN 79 220 496 603 |
|PGP:https://gnupg.org/                                                          |
|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 tohttps://gnupg.org/.


Re: Logging from ChildInitScript

Posted by Massimo Manghi <ma...@unipr.it>.
I committed to the repository a solution to the issue of logging to a
specific virtual host log file during interpreter initialization
(ChildInitScript). Scott, would you kindly check if it works for you?
Thank you

  -- Massimo

On 11/05/23 09:15, Scott Pitcher wrote:
> Ah thanks. Yes I've got 4 virtual hosts and now I've found the log
> messages in the main logs under /var/log/apache2/....
>
> I was having init problems and without the log messages I was shooting
> in the dark. Thanks again :)
>
> Kind regards,
> Scott
>
>

Firma il tuo 5xmille all’Università di Parma, aiutaci a essere sempre più accoglienti e inclusivi verso le nostre studentesse e i nostri studenti - Indica 00308780345 nella tua dichiarazione dei redditi.

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Logging from ChildInitScript

Posted by Massimo Manghi <ma...@rivetweb.org>.
Good. We can do much better on this issue. I'm going to take on the task 
of analyzing a possible solution. It should be feasible and it's a 
further reason for releasing 3.2.3

  -- Massimo


On 11/05/23 09:15, Scott Pitcher wrote:
> Ah thanks. Yes I've got 4 virtual hosts and now I've found the log 
> messages in the main logs under /var/log/apache2/....
> 
> I was having init problems and without the log messages I was shooting 
> in the dark. Thanks again :)
> 
> Kind regards,
> Scott
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Logging from ChildInitScript

Posted by Scott Pitcher <sc...@svptechnicalservices.com.au>.
Ah thanks. Yes I've got 4 virtual hosts and now I've found the log 
messages in the main logs under /var/log/apache2/....

I was having init problems and without the log messages I was shooting 
in the dark. Thanks again :)

Kind regards,
Scott


On 10/5/23 23:25, Massimo Manghi wrote:
> Perhaps you're running the script for a virtual host with an ErrorLog 
> different from the default virtual host log file.
>
> Virtual hosts get their own server record structure and 
> ::rivet::apache_log_error can tell which virtual host is serving a 
> request from the server_rec structure pointed from a request_rec 
> structure (private->r->server).
>
> When ChildInitScript runs no request_rec structure is defined 
> therefore the server record of the default server is used
>
> serverRec = ((private == NULL) || (private->r == NULL)) ? 
> module_globals->server : private->r->server;
>
> if I'm correct your messages should have ended up in the default error 
> file.
>
> This is clearly a point where mod_rivet could be improved.
>
>
>  -- Massimo
>
>
> On 10/05/23 14:14, Scott Pitcher wrote:
>> Hi,
>>
>> I have a website with a RivetServerConf ChildInitScript pointing to a 
>> tcl script. The script works and operates normally. The only command 
>> that does not work is /::rivet::apache_log_error/. The following 
>> command in the script produces no log message:
>>
>> ::rivet::apache_log_error alert "childinit.tcl running ..."
>>
>> The code execute and I I change the level from alert to some random 
>> string like abcdef for example, then the script doesn't run at all 
>> and when the normal session script runs, the child hasn't opened the 
>> databases and the client script fails too.
>>
>> Is there a way of logging from the ChildInitScript?
>>
>> Kind regards,
>> Scott
>>
>>
>> -- 
>> +--------------------------------------------------------------------------------+ 
>>
>> | ... will make the wilderness a pool of water, the dry land springs 
>> of water ...|
>> +--------------------------------------------------------------------------------+ 
>>
>> | Scott PitcherScotty@svptechnicalservices.com.au  |
>> | +61-3-9008-5695 (B) +61-479-042-834 (M) |
>> | SVP Technical Services ABN 79 220 496 603 |
>> |PGP:https://gnupg.org/ |
>> |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 tohttps://gnupg.org/.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org

-- 
+--------------------------------------------------------------------------------+
| ... will make the wilderness a pool of water, the dry land springs of water ...|
+--------------------------------------------------------------------------------+
| Scott Pitcher                               Scotty@svptechnicalservices.com.au |
| +61-3-9008-5695 (B)                                        +61-479-042-834 (M) |
| SVP Technical Services                                      ABN 79 220 496 603 |
|PGP: https://gnupg.org/                                                         |
|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/.


Re: Logging from ChildInitScript

Posted by Massimo Manghi <ma...@rivetweb.org>.
Perhaps you're running the script for a virtual host with an ErrorLog 
different from the default virtual host log file.

Virtual hosts get their own server record structure and 
::rivet::apache_log_error can tell which virtual host is serving a 
request from the server_rec structure pointed from a request_rec 
structure (private->r->server).

When ChildInitScript runs no request_rec structure is defined therefore 
the server record of the default server is used

serverRec = ((private == NULL) || (private->r == NULL)) ? 
module_globals->server : private->r->server;

if I'm correct your messages should have ended up in the default error file.

This is clearly a point where mod_rivet could be improved.


  -- Massimo


On 10/05/23 14:14, Scott Pitcher wrote:
> Hi,
> 
> I have a website with a RivetServerConf ChildInitScript pointing to a 
> tcl script. The script works and operates normally. The only command 
> that does not work is /::rivet::apache_log_error/. The following command 
> in the script produces no log message:
> 
> ::rivet::apache_log_error alert "childinit.tcl running ..."
> 
> The code execute and I I change the level from alert to some random 
> string like abcdef for example, then the script doesn't run at all and 
> when the normal session script runs, the child hasn't opened the 
> databases and the client script fails too.
> 
> Is there a way of logging from the ChildInitScript?
> 
> Kind regards,
> Scott
> 
> 
> -- 
> +--------------------------------------------------------------------------------+
> | ... will make the wilderness a pool of water, the dry land springs of water ...|
> +--------------------------------------------------------------------------------+
> | Scott PitcherScotty@svptechnicalservices.com.au  |
> | +61-3-9008-5695 (B)                                        +61-479-042-834 (M) |
> | SVP Technical Services                                      ABN 79 220 496 603 |
> |PGP:https://gnupg.org/                                                          |
> |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 tohttps://gnupg.org/.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Logging from ChildInitScript

Posted by Brice Hamon <no...@gmail.com>.
Hi Scott,

It does work for us.
In our Init script we use this proc, and we call it when log is needed.
The logs appear in the apache log file.

#
-----------------------------------------------------------------------------
# Global loggin
#
-----------------------------------------------------------------------------
proc log {sev txt} {
    if {[string equal $sev ERROR]} {
        ::rivet::apache_log_error err $txt
    } else {
        ::rivet::apache_log_error notice $txt
    }
}


On Wed, May 10, 2023 at 8:14 AM Scott Pitcher <
scotty@svptechnicalservices.com.au> wrote:

> Hi,
>
> I have a website with a RivetServerConf ChildInitScript pointing to a tcl
> script. The script works and operates normally. The only command that does
> not work is *::rivet::apache_log_error*. The following command in the
> script produces no log message:
>
> ::rivet::apache_log_error alert "childinit.tcl running ..."
>
> The code execute and I I change the level from alert to some random string
> like abcdef for example, then the script doesn't run at all and when the
> normal session script runs, the child hasn't opened the databases and the
> client script fails too.
>
> Is there a way of logging from the ChildInitScript?
>
> Kind regards,
> Scott
>
>
> --
> +--------------------------------------------------------------------------------+
> | ... will make the wilderness a pool of water, the dry land springs of water ...|
> +--------------------------------------------------------------------------------+
> | Scott Pitcher                               Scotty@svptechnicalservices.com.au |
> | +61-3-9008-5695 (B)                                        +61-479-042-834 (M) |
> | SVP Technical Services                                      ABN 79 220 496 603 |
> |PGP: https://gnupg.org/                                                         |
> |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/.
>
>