-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/26/2013 07:40 AM, Daniel P. Berrange wrote:
> On Fri, Jul 26, 2013 at 07:38:31AM -0400, Daniel J Walsh wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> I can't seem to get the error reporting to turn on, what am I doing
>> wrong.,
>>
>> if (virInitialize() < 0) { fprintf(stderr, _("Failed to initialize
>> libvirt")); return EXIT_FAILURE; }
>>
>> if (virErrorInitialize() < 0) { fprintf(stderr, _("Failed to initialize
>> libvirt Error Handling")); return EXIT_FAILURE; }
>>
>> virSetErrorFunc(NULL, NULL);
>>
>>
>> virReportSystemError(EINVAL, "%s", _("Test"));
>>
>> And I get no output, I thought I would get error on stderr?
>
> You would, except that you just turned off printing to stderr by calling
> virSetErrorFunc in that way.
>
>
> Daniel
>
Am I misreading this?
* virSetErrorFunc:
* @userData: pointer to the user data provided in the handler callback
* @handler: the function to get called in case of error or NULL
*
* Set a library global error handling function, if @handler is NULL,
* it will reset to default printing on stderr. The error raised there
* are those for which no handler at the connection level could caught.
*/
Looks like setting handler to Null reset default printing on stderr?
But I am getting no output whether or not I set this.
I am attaching a hacked virt-login-shell.c which gives me no output.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlHyozwACgkQrlYvE4MpobMjAACePralBci9M6O0wshnO1+bXXVC
a4EAn1/cfC8ng8XlLTO9DpiFetmDr9wv
=+h5o
-----END PGP SIGNATURE-----
/*
* virt-login-shell.c: a shell to connect to a container
*
* Copyright (C) 2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Daniel Walsh <[email protected]>
*/
#include <stdio.h>
#include <stdlib.h>
#include "virerror.h"
#define VIR_FROM_THIS VIR_FROM_NONE
int
main(int argc, char **argv)
{
virReportSystemError(1, "%s %d %s", "Test1", argc, argv[0]);
if (virInitialize() < 0) {
fprintf(stderr, _("Failed to initialize libvirt Error Handling"));
return EXIT_FAILURE;
}
virReportSystemError(EINVAL, "%s", "Test2");
if (virErrorInitialize() < 0) {
fprintf(stderr, _("Failed to initialize libvirt Error Handling"));
return EXIT_FAILURE;
}
virReportSystemError(EINVAL, "%s", "Test3");
virSetErrorFunc(NULL, NULL);
virReportSystemError(EINVAL, "%s", "Test4");
virSetErrorLogPriorityFunc(NULL);
virReportSystemError(EINVAL, "%s", "Test5");
}
--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list