Hi Dan, You actually can attach your own log-callback to OpenSG, which then recieves what's written with SLOG/PLOG. That's what I've done to integrate opensg's log with my app's system.
For other libs, Boost had a log library for review a few months ago but it didn't pass. The best I could find was this comparison: http://log4cpp.hora-obscura.de/index.php/LoggingLibraryForCpp. I haven't looked at anyone of these too closely. Have exception throwing optional is probably the best solution. A user-callback for errors would solve this easily, as it would allow anyone to throw an exception back through OpenSG code and get a proper call-stack. (or just log it, or terminate the application, or send an e-maill, or make some toast, or ... :) So, in theory, we could detect whether OpenSG logs any errors/fatals and do something from the log-callback, but: - Some real (IMO) errors are reported only as warnings. - A log-ouput isn't as clear in the code as a 'onError()' call. - It could be hard to identify exactly where the error is (since the log is just a bunch of lines) - It's potentially unsafe to throw an exception from the log (resource leaks, unfinished log message, etc.) - The logging is just text-line based. (Just level & message, not very structured info.) The easiest way would probably be to fix the first thing, as it would solve the immediate problem. For the other two: - Add osgError() / osgFatalError() functions with user callbacks? - Add more info (__FUNC__, __LINE__, type?, node/core-ptr?, attachment-object-name?, ip?, action-node-stack?) Also, for exception safety, there are some manual new/delete's here and there that needs replacing with std::auto_ptr or boost::scoped_ptr, but that's a minor issue. Cheers, /Marcus Daniel Sperka wrote: > I'm an advocate for logging errors. In this respect a logging callback > is preferred (as opposed to the current PLOG/SLOG thingy) so logging > can be integrated with an application's logging. I would advocate a > commonly used logging system IF SUCH A SYSTEM EXISTED! I've been spoiled > by log4j in the past, and unfortunately there hasn't been a satisfactory > CXX port yet (although apache.org has a logging project it seems to have > been static for a while). > > Throwing exceptions is OK as long as its done well AND doesn't > compromise performance (or, if it does, at least let me compile it > away...). I can always catch them and log them. > > > I'm against using OpenSG's own logging solution (PLOG/SLOG) unless > a) it can be adapted to another system (e.g. if your app uses logging > you'd like it to be integrated with OpenSG's logging), or > b) PLOG/SLOG can be used by another app as well (perhaps it can?). Some > documentation would help, in this case. At a minimum it'd be useful to > have logging configuration (i.e. to file, IP address, hierarchical > nodes, etc). > > Dan > > > > > Marcus Lindblom wrote: > >> Hi, >> >> I've created a new web-page with some musings on error handling: >> http://opensg.vrsource.org/trac/wiki/Dev/ErrorHandling >> >> You'll notice that I disagree with the current >> keep-running-even-if-everything-is-wrong policy. I'd like to go beyond >> of that and have a plan for something more robust than spewing warnings >> in the log. Given that, I think could try to fix the error reporting in >> the classes that give me headache. >> >> Comments? >> >> Cheers, >> /Marcus >> >> >> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Opensg-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/opensg-users >> >> >> > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
