Re: [osg-users] Enabling notifications from within program?
Hi You can set your own notify handler like this to check if you ever get messages from osg: class NH : public osg::NotifyHandler { public: NH() : m_out(osg_log.txt) { } ~NH() { m_out.close(); } void notify (osg::NotifySeverity severity, const char *message) { m_out message; } private: std::ofstream m_out; }; osg::setNotifyHandler(new NH); Cheers, Sergey. 31.05.2012, 22:25, Preet prismatic.proj...@gmail.com: Hi Robert, That's what I'm currently doing (ie using stack traces to try and figure stuff out), but I was wondering why osg doesn't give me *any* output at all. For instance, I'm apparently able to do a bunch of stuff: Load an *.osg model, setup an animation path, create nodes, etc, pretty much all of the scene setup goes fine up until I try to create the viewer. Doesn't doing any of those things before the viewer provide output when I've set the notify level to debug? I made sure I compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for that flag was) to allow notifications. On Thu, May 31, 2012 at 4:57 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Preet, The osg::notify system isn't related to handling of std exceptions except where some specific code might catch an exception and report the output to osg::notify. This means that upping the notify level won't effect how exceptions are handled. The best thing to do is run a debugger and the look at the stack trace where the application crashes. Robert. On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote: Hiya, I'm trying to debug a std::bad_alloc() exception from osg that doesn't product any other output. I can't set environment variables, so I tried: osg::setNotifyLevel(osg::DEBUG_INFO); This still doesn't give me any output. The system I'm on dumps stdout and stderr to a log file in a specific directory and since Notify.cpp dumps to both of those it seems like I should be seeing something, but I'm not. However, I do get statements like std::cout Hello std::endl outputted as expected when used in my application (just not from osg). Am I missing something obvious? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Enabling notifications from within program?
Thanks to all for the replies... I wasn't getting any output because of some unrelated linking errors. After fixing them, debugging is working as expected :) On Fri, Jun 1, 2012 at 2:46 AM, Sergey Polischuk pol...@yandex.ru wrote: Hi You can set your own notify handler like this to check if you ever get messages from osg: class NH : public osg::NotifyHandler { public: NH() : m_out(osg_log.txt) { } ~NH() { m_out.close(); } void notify (osg::NotifySeverity severity, const char *message) { m_out message; } private: std::ofstream m_out; }; osg::setNotifyHandler(new NH); Cheers, Sergey. 31.05.2012, 22:25, Preet prismatic.proj...@gmail.com: Hi Robert, That's what I'm currently doing (ie using stack traces to try and figure stuff out), but I was wondering why osg doesn't give me *any* output at all. For instance, I'm apparently able to do a bunch of stuff: Load an *.osg model, setup an animation path, create nodes, etc, pretty much all of the scene setup goes fine up until I try to create the viewer. Doesn't doing any of those things before the viewer provide output when I've set the notify level to debug? I made sure I compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for that flag was) to allow notifications. On Thu, May 31, 2012 at 4:57 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Preet, The osg::notify system isn't related to handling of std exceptions except where some specific code might catch an exception and report the output to osg::notify. This means that upping the notify level won't effect how exceptions are handled. The best thing to do is run a debugger and the look at the stack trace where the application crashes. Robert. On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote: Hiya, I'm trying to debug a std::bad_alloc() exception from osg that doesn't product any other output. I can't set environment variables, so I tried: osg::setNotifyLevel(osg::DEBUG_INFO); This still doesn't give me any output. The system I'm on dumps stdout and stderr to a log file in a specific directory and since Notify.cpp dumps to both of those it seems like I should be seeing something, but I'm not. However, I do get statements like std::cout Hello std::endl outputted as expected when used in my application (just not from osg). Am I missing something obvious? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Enabling notifications from within program?
Hiya, I'm trying to debug a std::bad_alloc() exception from osg that doesn't product any other output. I can't set environment variables, so I tried: osg::setNotifyLevel(osg::DEBUG_INFO); This still doesn't give me any output. The system I'm on dumps stdout and stderr to a log file in a specific directory and since Notify.cpp dumps to both of those it seems like I should be seeing something, but I'm not. However, I do get statements like std::cout Hello std::endl outputted as expected when used in my application (just not from osg). Am I missing something obvious? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Enabling notifications from within program?
Hi Preet, The osg::notify system isn't related to handling of std exceptions except where some specific code might catch an exception and report the output to osg::notify. This means that upping the notify level won't effect how exceptions are handled. The best thing to do is run a debugger and the look at the stack trace where the application crashes. Robert. On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote: Hiya, I'm trying to debug a std::bad_alloc() exception from osg that doesn't product any other output. I can't set environment variables, so I tried: osg::setNotifyLevel(osg::DEBUG_INFO); This still doesn't give me any output. The system I'm on dumps stdout and stderr to a log file in a specific directory and since Notify.cpp dumps to both of those it seems like I should be seeing something, but I'm not. However, I do get statements like std::cout Hello std::endl outputted as expected when used in my application (just not from osg). Am I missing something obvious? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Enabling notifications from within program?
Hi Robert, That's what I'm currently doing (ie using stack traces to try and figure stuff out), but I was wondering why osg doesn't give me *any* output at all. For instance, I'm apparently able to do a bunch of stuff: Load an *.osg model, setup an animation path, create nodes, etc, pretty much all of the scene setup goes fine up until I try to create the viewer. Doesn't doing any of those things before the viewer provide output when I've set the notify level to debug? I made sure I compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for that flag was) to allow notifications. On Thu, May 31, 2012 at 4:57 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Preet, The osg::notify system isn't related to handling of std exceptions except where some specific code might catch an exception and report the output to osg::notify. This means that upping the notify level won't effect how exceptions are handled. The best thing to do is run a debugger and the look at the stack trace where the application crashes. Robert. On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote: Hiya, I'm trying to debug a std::bad_alloc() exception from osg that doesn't product any other output. I can't set environment variables, so I tried: osg::setNotifyLevel(osg::DEBUG_INFO); This still doesn't give me any output. The system I'm on dumps stdout and stderr to a log file in a specific directory and since Notify.cpp dumps to both of those it seems like I should be seeing something, but I'm not. However, I do get statements like std::cout Hello std::endl outputted as expected when used in my application (just not from osg). Am I missing something obvious? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Enabling notifications from within program?
Hi Preet, On 1/06/12 4:25 , Preet wrote: That's what I'm currently doing (ie using stack traces to try and figure stuff out), but I was wondering why osg doesn't give me *any* output at all. For instance, I'm apparently able to do a bunch of stuff: Load an *.osg model, setup an animation path, create nodes, etc, pretty much all of the scene setup goes fine up until I try to create the viewer. Doesn't doing any of those things before the viewer provide output when I've set the notify level to debug? I made sure I compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for that flag was) to allow notifications. Loading a file will certainly produce output with the proper OSG_LOG_LEVEL. I'm wondering if whatever subsystem is redirecting output to a log file in your application is maybe run after OSG sets up its logging and so they're going to different file descriptors? Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org