2 #include "StWsAppender.h"
6 #include "StWsLogger.h"
9 #include <log4cxx/helpers/loglog.h>
10 #include <log4cxx/helpers/optionconverter.h>
11 #include <log4cxx/patternlayout.h>
14 using namespace log4cxx;
15 using namespace log4cxx::helpers;
16 using namespace log4cxx::db;
17 using namespace log4cxx::spi;
28 StWsAppender::~StWsAppender()
34 void StWsAppender::setOption(
const String& option,
37 if (equalsIgnoreCase(option, _T(
"WS_TASK_ID")))
39 StWsLoggerS::Instance().setTaskID(value);
40 }
else if (equalsIgnoreCase(option, _T(
"WS_JOB_ID"))) {
41 StWsLoggerS::Instance().setJobID(value);
42 }
else if (equalsIgnoreCase(option, _T(
"WS_LOG_URL"))) {
43 StWsLoggerS::Instance().setServiceUrl(value);
47 AppenderSkeleton::setOption(name, value);
52 void StWsAppender::append(
const spi::LoggingEventPtr& event)
54 time_t time =
event->getTimeStamp();
55 const LevelPtr& lvl =
event->getLevel();
56 const String& msg =
event->getMessage();
58 StWsLogger::LEVEL log_level = StWsLogger::INFO;
60 if (lvl == LOG4CXX_LEVEL_FATAL) {
61 log_level = StWsLogger::FATAL;
62 }
else if (lvl == LOG4CXX_LEVEL_ERROR) {
63 log_level = StWsLogger::ERROR;
64 }
else if (lvl == LOG4CXX_LEVEL_WARN) {
65 log_level = StWsLogger::WARNING;
66 }
else if (lvl == LOG4CXX_LEVEL_DEBUG) {
67 log_level = StWsLogger::DEBUG;
76 StWsLoggerS::Instance().logEvent(log_level, evt, StWsLogger::STATUS);
80 String StWsAppender::getLogStatement(
const spi::LoggingEventPtr& event)
82 #if (STAR_LOG4CXX_VERSION == 9)
88 ((
StWsAppender*)
this)->getLayout()->format(sbuf, event,pool);
94 void StWsAppender::close()
100 #if (STAR_LOG4CXX_VERSION == 10)
102 void StWsAppender::append(
const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p)