in reply to Re: How can I catch a Server message displayed in Sybase::CTlib module
in thread How can I catch a Server message displayed in Sybase::CTlib module

Hi shmem,

Thank you very much.
I have executed the above code, and I have got the expected result.

I still need some help. Sorry if it is silly.

Still, my question is,
where can I send the below err statements into log file. I have tried them and was not able to throw into log file.

ct_callback(CS_CLIENTMSG_CB, \&msg_cb);
ct_callback(CS_SERVERMSG_CB, "srv_cb");

sub msg_cb {
my($layer, $origin, $severity, $number, $msg, $osmsg, $dbh) = @_;

printf STDERR "\nOpen Client Message: (In msg_cb)\n";
printf STDERR "Message number: LAYER = (%ld) ORIGIN = (%ld) ",
$layer, $origin;
printf STDERR "SEVERITY = (%ld) NUMBER = (%ld)\n",
$severity, $number;
printf STDERR "Message String: %s\n", $msg;
if (defined($osmsg)) {
printf STDERR "Operating System Error: %s\n", $osmsg;
}
CS_SUCCEED;
}

sub srv_cb {
my($dbh, $number, $severity, $state, $line, $server,
$proc, $msg) = @_;

# If $dbh is defined, then you can set or check attributes
# in the callback, which can be tested in the main body
# of the code.

printf STDERR "\nServer message: (In srv_cb)\n";
printf STDERR "Message number: %ld, Severity %ld, ",
$number, $severity;

printf STDERR "State %ld, Line %ld\n", $state, $line;

if (defined($server)) {
printf STDERR "Server '%s'\n", $server;
}

if (defined($proc)) {
printf STDERR " Procedure '%s'\n", $proc;
}

printf STDERR "Message String: %s\n", $msg; CS_SUCCEED;
}

please, help required...

Thanks in advance!!!

  • Comment on Re^2: How can I catch a Server message displayed in Sybase::CTlib module

Replies are listed 'Best First'.
Re^3: How can I catch a Server message displayed in Sybase::CTlib module
by Anonymous Monk on May 07, 2009 at 12:24 UTC
    open file, print to filehandle you opened, close filehandle