You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Justin Mason <jm...@jmason.org> on 2005/05/23 09:04:43 UTC

Re: debug and STDERR

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


FWIW, you may be open to use

    my $f = fileno(STDERR);
    close(STDERR);

    use POSIX ();
    if ($f != 2) { POSIX::close(2); }

    open STDERR, ">log.txt" or warn "open failed";


ie. persuade perl to set up your *own* stderr on fd 2.   Perl will
generally use fd 2 for warnings etc.

however, the PerlScript engine may have totally rerouted where "STDERR"
goes on that platform, in which case you'd need to ask them ;)

- --j.

Steven Manross writes:
> Thanks for the response.
> 
> Well, I am calling the SA classes directly as perl via "PerlScript"...
> Similar to VB and how an ASP page is called from IIS (but by
> perlse.dll).  
> 
> EX:
> <SCRIPT LANGUAGE="PerlScript">
> use Mail::SpamAssassin;
> Etc, etc.
> 
> </SCRIPT>
> 
> Namely, the SMTP Exchange interface ('Simple Mail Transfer Protocol'
> service) allows scripts to run in the form of an SMTP "Event Sink".
> Which hands me the message as an OLE Object..  I then make an
> RFC-formatted string out of the mail, and hand it off to SA in the form
> of:
> 
> sub is_message_spam {
>   my $message_txt = $_[0];
>   my $spamtest = $_[1];
>   my $mail = $spamtest->parse($message_txt); 
>   my $status = $spamtest->check($mail);
>   $mail = $status->get_message();
>   $_[2] = $mail;
>   $_[3] = $status;
>   $message_txt = $status->rewrite_mail();
>   $_[0] = $message_txt;
>   if ($status->is_spam()) {
>     return 1;
>   } else {
>     return 0;
>   }
> }
> 
> I'd presume that the STDERR call that I made should work, <grin>being
> that no one has corrected my code yet</grin>..  (it does work from a
> console window [doing spamassassin.bat -D <message.txt -- with a modded
> spamassassin.bat to remap STDERR], but not from the Event Sink).  So,
> I'd agree with you that something (namely inetinfo.exe) could be taking
> STDERR away from something I have access to.  There are a few articles
> in their support KB about IIS not allowing STDERR access to web pages,
> so, I am not surprised that a similar service (IIS-based SMTP) would
> have the same issues.  I've tried a few KB articles to try to regain
> access to it, without avail.)
> 
> So, I'm kind of lost on what to do to get the debug info (without
> modding the Distribution files, being that my SMTP service doesn't allow
> me access to it).  I'm beginning to doubt that my problem is something I
> can overcome without a mod, and/or that someone wants to write/maintain
> a mod for it.  :)
> 
> Thanks,
> Steven
> 
> P.S. I'd like to thank everyone involved in this project.  SA is truly
> an amazing work of art;  Well-crafted, maintained, and the user support
> community is top-notch as well.
> 
> -----Original Message-----
> From: Loren Wilton [mailto:lwilton@earthlink.net] 
> Sent: Sunday, May 22, 2005 3:12 PM
> To: users@spamassassin.apache.org
> Subject: Re: debug and STDERR
> 
> > I find it odd that MS would not give my access to STDERR, but it looks
> > to be the case. :(
> 
> You do usually have have access to stderr on a Windows platform.
> However,
> it is entirely possible that it has been hijacked by whatever the
> process is
> that is calling SA and doesn't end up where you think; OR, depending on
> how
> SA is started, SA might be a "non console" process, and will have
> stderr>NULL.
> 
> The first thing I'd consider trying would be starting whatever is
> creating/calling SA with something like "2>logfile.txt" and see if you
> can
> get logging that way.
> 
> If that doesn't work, and you can't freopen stderr to something else
> inside
> SA, than some other trick will probably be necessary.
> 
>         Loren
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFCkYCLMJF5cimLx9ARAnwsAJ9soG7Nf1rqU+RAlPH2X6XbZKhToACfem3J
hF6wxZKVJVSToxEQsbZ+XbM=
=gtoD
-----END PGP SIGNATURE-----