10 #ifndef __PION_LOGSERVICE_HEADER__ 11 #define __PION_LOGSERVICE_HEADER__ 13 #include <boost/thread/mutex.hpp> 14 #include <boost/scoped_ptr.hpp> 15 #include <pion/logger.hpp> 16 #include <pion/http/plugin_service.hpp> 17 #include <pion/http/response_writer.hpp> 21 #if defined(PION_USE_LOG4CXX) 22 #include <log4cxx/appenderskeleton.h> 26 #ifndef _LOG4CXX_HELPERS_POOL_H 44 #ifdef PION_HAS_LOG_APPENDER
57 void addLogString(
const std::string& log_string);
60 void writeLogEvents(
const pion::http::response_writer_ptr& writer);
64 static const unsigned int DEFAULT_MAX_EVENTS;
67 unsigned int m_max_events;
70 unsigned int m_num_events;
73 std::list<std::string> m_log_events;
76 boost::mutex m_log_mutex;
78 #if defined(PION_USE_LOG4CXX) 81 virtual void close() {}
82 virtual bool requiresLayout()
const {
return false; }
85 virtual void append(
const log4cxx::spi::LoggingEventPtr& event);
87 virtual void append(
const log4cxx::spi::LoggingEventPtr& event,
88 log4cxx::helpers::Pool& pool)
92 #elif defined(PION_USE_LOG4CPLUS) 95 virtual void close() {}
97 virtual void append(
const log4cplus::spi::InternalLoggingEvent& event);
100 log4cplus::LogLevelManager m_log_level_manager;
101 #elif defined(PION_USE_LOG4CPP) 104 virtual void close() {}
105 virtual bool requiresLayout()
const {
return true; }
106 virtual void setLayout(log4cpp::Layout* layout) { m_layout_ptr.reset(layout); }
109 virtual void _append(
const log4cpp::LoggingEvent& event);
112 boost::scoped_ptr<log4cpp::Layout> m_layout_ptr;
130 virtual void operator()(
const pion::http::request_ptr& http_request_ptr,
131 const pion::tcp::connection_ptr& tcp_conn);
135 #ifdef PION_HAS_LOG_APPENDER 138 return *m_log_appender_ptr;
144 #ifdef PION_HAS_LOG_APPENDER 145 log_appender_ptr m_log_appender_ptr;
void setMaxEvents(unsigned int n)
sets the maximum number of log events cached in memory
LogServiceAppender & getLogAppender(void)
returns the log appender used by LogService