Sign in to follow this  

C++ logging on Windows and UNIX

This topic is 2546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently merged a Linux and Windows program. To get it working I commented out some calls to syslog. I'm wanting now to add the logging back. The software needs to run on UNIX and Windows, but I don't anticipate it having to run on other operating systems. The merged program isn't using Boost at this point and I'm not wanting to use the Boost logging library on this. Any other lighter weight suggestions? Thanks in advance.

Brian Wood
Ebenezer Enterprises
http://webEbenezer.net

Share this post


Link to post
Share on other sites
Quote:
Original post by Katie
If you use one of the syslog implementations for Windows, it will have the advantage that in a heterogeneous environment, you can still use the upstream syslog tools...



I like this idea but what are the downsides of going that route?

Share this post


Link to post
Share on other sites

I downloaded something called Kiwi Syslog Server and installed it as a service. I then tried searching for *syslog*.h but didn't find any files like that. Backing up, perhaps someone could recommend a Windows syslog implementation that they like.

Share this post


Link to post
Share on other sites
"what are the downsides of going that route?"

UNIX style logging... It sort of depends what the existing infrastructure is like. Syslog also isn't the nicest system and it operates as datagrams so on congested networks it won't reliably report things. If it's what's already used, however, then the admins almost certainly have a ton of infrastructure set up to handle it.

As for actually implementing it, it's not a complex protocol.

You just send a packet to localhost port 154. The format of the packet is fairly simple -- http://www.ietf.org/rfc/rfc3164.txt

You can probably assemble it using just a sprintf and then send it as a datagram. And that's it. One of the points is that the application's complexity is minimal and all the work gets done inside the local daemon - Kiwi is one of the popular ones.

Share this post


Link to post
Share on other sites
Yeah, so that's pretty much all syslog does[1]. Sanity check the inputs, sprintf everything into a buffer (complicated by having to do a lot of the work just to handle a special %m sequence), possibly opens the daemon connection by trying a couple of different ways and then sends it to the log daemon, stderr and the console as appropriate and available.


[1] Love open source.

Share this post


Link to post
Share on other sites

This topic is 2546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this