You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a new server example, this time using the log function #14
Nope, but do we need to wait for this? It might take a long time before it's part of a formal release, and I think it could be a useful example because users of cpp-netlib might also use the boost logging library.
Furthermore, an example of the HTTP server with logging would be useful (even if it's only std::cerr).
I'm coming up to speed on the project and would like to take a stab at this one. I just took a look at Boost.log and it seem like it'd be pretty straightforward to implement.
That would be great! I agree that the implementation would be straightforward. Do you already have an implementation in mind? If you have any questions, comments, ideas etc. please bring it up on the mailing list where you'll find a small (but growing) community who can help.
My plan was to add the multithreaded version of boost::log::sources::basic_logger as an ivar to the http server handler. I could print a few statistics every time the handler functor is called. Possibly add a command line parameter to specify a logging sink (text file, stdout, etc).
When is the log member function in the handler called? I grep'd around and it's only called in http::sync_connection::start() when setting the socket options fails. Is this something that needs to be added in the library code as well?
Another thing to consider is that Boost 1.47 does not include Boost.Log in the release. I (wrongly) assumed it would be in. Let me know what you guys think.
Since Boost.Log is not yet in the official Boost release, I would think it should be alright if you just made an example that actually did something in the body of the log function. This could be as simple as counting the number of errors encountered in requests and showing that it actually reports the errors.
If you look closely enough at the code there's not a lot of information being provided to the log function. I'm thinking in 1.0 we should at least have better statistical hooks and extension points to the server implementation.
For the purpose of the example though having something simple should be a good first step. We can then look at the deficiencies of the current approach and formulate a plan to address the issues we uncover then.
Does that work? Thanks again for taking this one on!
Activity
glynos commentedon Apr 9, 2010
Nope, but do we need to wait for this? It might take a long time before it's part of a formal release, and I think it could be a useful example because users of cpp-netlib might also use the boost logging library.
Furthermore, an example of the HTTP server with logging would be useful (even if it's only
std::cerr).glynos commentedon Apr 9, 2010
OK, I've updated the issue header.
leisinmr commentedon Aug 8, 2011
I'm coming up to speed on the project and would like to take a stab at this one. I just took a look at Boost.log and it seem like it'd be pretty straightforward to implement.
glynos commentedon Aug 9, 2011
That would be great! I agree that the implementation would be straightforward. Do you already have an implementation in mind? If you have any questions, comments, ideas etc. please bring it up on the mailing list where you'll find a small (but growing) community who can help.
leisinmr commentedon Aug 11, 2011
My plan was to add the multithreaded version of
boost::log::sources::basic_loggeras an ivar to the http server handler. I could print a few statistics every time the handler functor is called. Possibly add a command line parameter to specify a logging sink (text file, stdout, etc).When is the log member function in the handler called? I grep'd around and it's only called in
http::sync_connection::start()when setting the socket options fails. Is this something that needs to be added in the library code as well?Another thing to consider is that Boost 1.47 does not include Boost.Log in the release. I (wrongly) assumed it would be in. Let me know what you guys think.
deanberris commentedon Aug 12, 2011
Since Boost.Log is not yet in the official Boost release, I would think it should be alright if you just made an example that actually did something in the body of the log function. This could be as simple as counting the number of errors encountered in requests and showing that it actually reports the errors.
If you look closely enough at the code there's not a lot of information being provided to the log function. I'm thinking in 1.0 we should at least have better statistical hooks and extension points to the server implementation.
For the purpose of the example though having something simple should be a good first step. We can then look at the deficiencies of the current approach and formulate a plan to address the issues we uncover then.
Does that work? Thanks again for taking this one on!
Added a Boost.Log example #14