[omniORB] omniORB::log and omniORB::logger and syslog

David Byron dbyron@coactive.com
Tue, 30 Oct 2001 10:08:07 -0800


That would be an improvement for me	since getting the info into another
program that calls syslog would be easier, but I was thinking about doing
this another way.

One way would be to subclass the logging classes and overload the necessary
functions to do the 'right thing', and then only compile that in on the
platforms that support syslog.  Unfortunately, these objects get constructed
all over the place, so I don't think that would work so well.

What I was thinking, which may seem unsavory to do in C++, is to add a
function pointer member variable that would default to doing the same thing
as is done now, with an accessor so people who want to change it, could.  No
existing code would have to change.  Only people who want to take advantage
of this would have to do anything.  This seems more flexible than just
changing the code to call syslog instead of fprintf where it's supported.

Thoughts?

-DB

> -----Original Message-----
> From: Robert E. Gruber [mailto:gruber@research.att.com]
> Sent: Tuesday, October 30, 2001 7:35 AM
> To: David Byron; omniorb-list@uk.research.att.com
> Cc: Robert E. Gruber
> Subject: RE: [omniORB] omniORB::log and omniORB::logger and syslog
> 
> 
> If you cannot redirect stderr externally, the easiest thing 
> to do would be
> to add a log file option (-ORBlogFile ??) and to open the 
> file during ORB
> init and clos it during ORB cleanup, and then direct the 
> logger fprintf
> calls to a FILE* which could either refer to stderr or the 
> file that got
> opened.
> 
> I suspect not all operating systems that omniORB builds on 
> have a unix-like
> syslog.
> 
> -- Bob
> 
> -----Original Message-----
> From: owner-omniorb-list@uk.research.att.com
> [mailto:owner-omniorb-list@uk.research.att.com]On Behalf Of 
> David Byron
> Sent: Monday, October 29, 2001 9:50 PM
> To: omniorb-list@uk.research.att.com
> Subject: [omniORB] omniORB::log and omniORB::logger and syslog
> 
> 
> I'm using omniORB 3.0.4 and I'd like to change omniORB::log and
> omniORB::logger to use syslog instead of doing an fprintf on 
> stderr.  I'm
> using a system without an MMU, so doing some redirection to a 
> program that
> will call syslog for me is going to be complicated and take 
> more memory than
> just changing the code to call syslog directory.
> 
> Has anyone thought about doing this?  It looks like the 
> changes are all
> happily local to src/lib/omniORB2/orbcore/logIOStream.cc.  Is 
> that what
> other folks think as well?
> 
> I'm also curious why both omniORB::log and omniORB::logger exist.
> omniORB::logger writes to a small memory buffer and then only calls
> fprintf(stderr) in its destructor.  omniORB::logger also doesn't
> fflush(stderr), but omniORB::log does.  This would make sense to me if
> omniORB::logger was used in places where time or swapping was a big
> consideration, perhaps because stderr was connected to a 9600 
> baud terminal.
> 
> If other people are interested in this functionality, and 
> implementing it in
> a certain way would help you, let me know and I'll take that into
> consideration.
> 
> Thanks for your input.  I've found some discussion of syslog in the
> archives, but it was mostly focused around removing it from 
> tcpwrappers, not
> adding it to omniORB.