LOGCXX-502: I prefer tabs over spaces and somewhat strict indentation and the former settings lead to alignment without honoring the indentation settings. So if line 1 was not properly indented, all lines below weren't as well.
if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MININDEX"),
LOG4CXX_STR("minindex")))
vs.
if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MININDEX"),
LOG4CXX_STR("minindex")))
vs.
if (StringHelper::equalsIgnoreCase( option,
LOG4CXX_STR("MININDEX"),
LOG4CXX_STR("minindex")))
The latter is what I prefer, but can't seem to be configured at all and especially not using tabs.
diff --git a/.astylerc b/.astylerc
index face8a8..5459711 100644
--- a/.astylerc
+++ b/.astylerc
@@ -19,15 +19,15 @@
--break-one-line-headers
--convert-tabs
+--indent-after-parens
--indent-classes
--indent-col1-comments
---indent-continuation=1
--indent-preproc-block
--indent-preproc-define
--indent-switches
---indent=spaces=4
+--indent=force-tab=4
---lineend=windows
+--lineend=linux
--pad-comma
--pad-header
--pad-oper
diff --git a/src/main/cpp/action.cpp b/src/main/cpp/action.cpp
index 5f0f26f..ee347e4 100644
--- a/src/main/cpp/action.cpp
+++ b/src/main/cpp/action.cpp
@@ -25,10 +25,10 @@
IMPLEMENT_LOG4CXX_OBJECT(Action)
Action::Action() :
- complete(false),
- interrupted(false),
- pool(),
- mutex(pool)
+ complete(false),
+ interrupted(false),
+ pool(),
+ mutex(pool)
{
}
@@ -41,22 +41,22 @@
*/
void Action::run(log4cxx::helpers::Pool& pool1)
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- if (!interrupted)
- {
- try
- {
- execute(pool1);
- }
- catch (std::exception& ex)
- {
- reportException(ex);
- }
+ if (!interrupted)
+ {
+ try
+ {
+ execute(pool1);
+ }
+ catch (std::exception& ex)
+ {
+ reportException(ex);
+ }
- complete = true;
- interrupted = true;
- }
+ complete = true;
+ interrupted = true;
+ }
}
/**
@@ -64,8 +64,8 @@
*/
void Action::close()
{
- synchronized sync(mutex);
- interrupted = true;
+ synchronized sync(mutex);
+ interrupted = true;
}
/**
@@ -74,7 +74,7 @@
*/
bool Action::isComplete() const
{
- return complete;
+ return complete;
}
/**
diff --git a/src/main/cpp/andfilter.cpp b/src/main/cpp/andfilter.cpp
index a83e7b7..0bf16cd 100644
--- a/src/main/cpp/andfilter.cpp
+++ b/src/main/cpp/andfilter.cpp
@@ -29,51 +29,51 @@
AndFilter::AndFilter()
- : headFilter(), tailFilter(), acceptOnMatch(true)
+ : headFilter(), tailFilter(), acceptOnMatch(true)
{
}
void AndFilter::addFilter(const FilterPtr& filter)
{
- if (headFilter == NULL)
- {
- headFilter = filter;
- tailFilter = filter;
- }
- else
- {
- tailFilter->setNext(filter);
- }
+ if (headFilter == NULL)
+ {
+ headFilter = filter;
+ tailFilter = filter;
+ }
+ else
+ {
+ tailFilter->setNext(filter);
+ }
}
void AndFilter::setAcceptOnMatch(bool newValue)
{
- acceptOnMatch = newValue;
+ acceptOnMatch = newValue;
}
Filter::FilterDecision AndFilter::decide(
- const spi::LoggingEventPtr& event) const
+ const spi::LoggingEventPtr& event) const
{
- bool accepted = true;
- FilterPtr f(headFilter);
+ bool accepted = true;
+ FilterPtr f(headFilter);
- while (f != NULL)
- {
- accepted = accepted && (Filter::ACCEPT == f->decide(event));
- f = f->getNext();
- }
+ while (f != NULL)
+ {
+ accepted = accepted && (Filter::ACCEPT == f->decide(event));
+ f = f->getNext();
+ }
- if (accepted)
- {
- if (acceptOnMatch)
- {
- return Filter::ACCEPT;
- }
+ if (accepted)
+ {
+ if (acceptOnMatch)
+ {
+ return Filter::ACCEPT;
+ }
- return Filter::DENY;
- }
+ return Filter::DENY;
+ }
- return Filter::NEUTRAL;
+ return Filter::NEUTRAL;
}
diff --git a/src/main/cpp/appenderattachableimpl.cpp b/src/main/cpp/appenderattachableimpl.cpp
index 9d2f9e6..92c4fad 100644
--- a/src/main/cpp/appenderattachableimpl.cpp
+++ b/src/main/cpp/appenderattachableimpl.cpp
@@ -29,144 +29,144 @@
AppenderAttachableImpl::AppenderAttachableImpl(Pool& pool)
- : appenderList(),
- mutex(pool)
+ : appenderList(),
+ mutex(pool)
{
}
void AppenderAttachableImpl::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void AppenderAttachableImpl::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void AppenderAttachableImpl::addAppender(const AppenderPtr& newAppender)
{
- // Null values for newAppender parameter are strictly forbidden.
- if (newAppender == 0)
- {
- return;
- }
+ // Null values for newAppender parameter are strictly forbidden.
+ if (newAppender == 0)
+ {
+ return;
+ }
- AppenderList::iterator it = std::find(
- appenderList.begin(), appenderList.end(), newAppender);
+ AppenderList::iterator it = std::find(
+ appenderList.begin(), appenderList.end(), newAppender);
- if (it == appenderList.end())
- {
- appenderList.push_back(newAppender);
- }
+ if (it == appenderList.end())
+ {
+ appenderList.push_back(newAppender);
+ }
}
int AppenderAttachableImpl::appendLoopOnAppenders(
- const spi::LoggingEventPtr& event,
- Pool& p)
+ const spi::LoggingEventPtr& event,
+ Pool& p)
{
- for (AppenderList::iterator it = appenderList.begin();
- it != appenderList.end();
- it++)
- {
- (*it)->doAppend(event, p);
- }
+ for (AppenderList::iterator it = appenderList.begin();
+ it != appenderList.end();
+ it++)
+ {
+ (*it)->doAppend(event, p);
+ }
- return appenderList.size();
+ return appenderList.size();
}
AppenderList AppenderAttachableImpl::getAllAppenders() const
{
- return appenderList;
+ return appenderList;
}
AppenderPtr AppenderAttachableImpl::getAppender(const LogString& name) const
{
- if (name.empty())
- {
- return 0;
- }
+ if (name.empty())
+ {
+ return 0;
+ }
- AppenderList::const_iterator it, itEnd = appenderList.end();
- AppenderPtr appender;
+ AppenderList::const_iterator it, itEnd = appenderList.end();
+ AppenderPtr appender;
- for (it = appenderList.begin(); it != itEnd; it++)
- {
- appender = *it;
+ for (it = appenderList.begin(); it != itEnd; it++)
+ {
+ appender = *it;
- if (name == appender->getName())
- {
- return appender;
- }
- }
+ if (name == appender->getName())
+ {
+ return appender;
+ }
+ }
- return 0;
+ return 0;
}
bool AppenderAttachableImpl::isAttached(const AppenderPtr& appender) const
{
- if (appender == 0)
- {
- return false;
- }
+ if (appender == 0)
+ {
+ return false;
+ }
- AppenderList::const_iterator it = std::find(
- appenderList.begin(), appenderList.end(), appender);
+ AppenderList::const_iterator it = std::find(
+ appenderList.begin(), appenderList.end(), appender);
- return it != appenderList.end();
+ return it != appenderList.end();
}
void AppenderAttachableImpl::removeAllAppenders()
{
- AppenderList::iterator it, itEnd = appenderList.end();
- AppenderPtr a;
+ AppenderList::iterator it, itEnd = appenderList.end();
+ AppenderPtr a;
- for (it = appenderList.begin(); it != itEnd; it++)
- {
- a = *it;
- a->close();
- }
+ for (it = appenderList.begin(); it != itEnd; it++)
+ {
+ a = *it;
+ a->close();
+ }
- appenderList.clear();
+ appenderList.clear();
}
void AppenderAttachableImpl::removeAppender(const AppenderPtr& appender)
{
- if (appender == 0)
- {
- return;
- }
+ if (appender == 0)
+ {
+ return;
+ }
- AppenderList::iterator it = std::find(
- appenderList.begin(), appenderList.end(), appender);
+ AppenderList::iterator it = std::find(
+ appenderList.begin(), appenderList.end(), appender);
- if (it != appenderList.end())
- {
- appenderList.erase(it);
- }
+ if (it != appenderList.end())
+ {
+ appenderList.erase(it);
+ }
}
void AppenderAttachableImpl::removeAppender(const LogString& name)
{
- if (name.empty())
- {
- return;
- }
+ if (name.empty())
+ {
+ return;
+ }
- AppenderList::iterator it, itEnd = appenderList.end();
- AppenderPtr appender;
+ AppenderList::iterator it, itEnd = appenderList.end();
+ AppenderPtr appender;
- for (it = appenderList.begin(); it != itEnd; it++)
- {
- appender = *it;
+ for (it = appenderList.begin(); it != itEnd; it++)
+ {
+ appender = *it;
- if (name == appender->getName())
- {
- appenderList.erase(it);
- return;
- }
- }
+ if (name == appender->getName())
+ {
+ appenderList.erase(it);
+ return;
+ }
+ }
}
diff --git a/src/main/cpp/appenderskeleton.cpp b/src/main/cpp/appenderskeleton.cpp
index 0d68dcc..42c1999 100644
--- a/src/main/cpp/appenderskeleton.cpp
+++ b/src/main/cpp/appenderskeleton.cpp
@@ -33,154 +33,154 @@
AppenderSkeleton::AppenderSkeleton()
- : layout(),
- name(),
- threshold(Level::getAll()),
- errorHandler(new OnlyOnceErrorHandler()),
- headFilter(),
- tailFilter(),
- pool(),
- SHARED_MUTEX_INIT(mutex, pool)
+ : layout(),
+ name(),
+ threshold(Level::getAll()),
+ errorHandler(new OnlyOnceErrorHandler()),
+ headFilter(),
+ tailFilter(),
+ pool(),
+ SHARED_MUTEX_INIT(mutex, pool)
{
- LOCK_W sync(mutex);
- closed = false;
+ LOCK_W sync(mutex);
+ closed = false;
}
AppenderSkeleton::AppenderSkeleton(const LayoutPtr& layout1)
- : layout(layout1),
- name(),
- threshold(Level::getAll()),
- errorHandler(new OnlyOnceErrorHandler()),
- headFilter(),
- tailFilter(),
- pool(),
- SHARED_MUTEX_INIT(mutex, pool)
+ : layout(layout1),
+ name(),
+ threshold(Level::getAll()),
+ errorHandler(new OnlyOnceErrorHandler()),
+ headFilter(),
+ tailFilter(),
+ pool(),
+ SHARED_MUTEX_INIT(mutex, pool)
{
- LOCK_W sync(mutex);
- closed = false;
+ LOCK_W sync(mutex);
+ closed = false;
}
void AppenderSkeleton::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void AppenderSkeleton::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void AppenderSkeleton::finalize()
{
- // An appender might be closed then garbage collected. There is no
- // point in closing twice.
- if (closed)
- {
- return;
- }
+ // An appender might be closed then garbage collected. There is no
+ // point in closing twice.
+ if (closed)
+ {
+ return;
+ }
- close();
+ close();
}
void AppenderSkeleton::addFilter(const spi::FilterPtr& newFilter)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (headFilter == 0)
- {
- headFilter = tailFilter = newFilter;
- }
- else
- {
- tailFilter->setNext(newFilter);
- tailFilter = newFilter;
- }
+ if (headFilter == 0)
+ {
+ headFilter = tailFilter = newFilter;
+ }
+ else
+ {
+ tailFilter->setNext(newFilter);
+ tailFilter = newFilter;
+ }
}
void AppenderSkeleton::clearFilters()
{
- LOCK_W sync(mutex);
- headFilter = tailFilter = 0;
+ LOCK_W sync(mutex);
+ headFilter = tailFilter = 0;
}
bool AppenderSkeleton::isAsSevereAsThreshold(const LevelPtr& level) const
{
- return ((level == 0) || level->isGreaterOrEqual(threshold));
+ return ((level == 0) || level->isGreaterOrEqual(threshold));
}
void AppenderSkeleton::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- doAppendImpl(event, pool1);
+ doAppendImpl(event, pool1);
}
void AppenderSkeleton::doAppendImpl(const spi::LoggingEventPtr& event, Pool& pool1)
{
- if (closed)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Attempted to append to closed appender named ["))
- + name + LOG4CXX_STR("]."));
- return;
- }
+ if (closed)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Attempted to append to closed appender named ["))
+ + name + LOG4CXX_STR("]."));
+ return;
+ }
- if (!isAsSevereAsThreshold(event->getLevel()))
- {
- return;
- }
+ if (!isAsSevereAsThreshold(event->getLevel()))
+ {
+ return;
+ }
- FilterPtr f = headFilter;
+ FilterPtr f = headFilter;
- while (f != 0)
- {
- switch (f->decide(event))
- {
- case Filter::DENY:
- return;
+ while (f != 0)
+ {
+ switch (f->decide(event))
+ {
+ case Filter::DENY:
+ return;
- case Filter::ACCEPT:
- f = 0;
- break;
+ case Filter::ACCEPT:
+ f = 0;
+ break;
- case Filter::NEUTRAL:
- f = f->getNext();
- }
- }
+ case Filter::NEUTRAL:
+ f = f->getNext();
+ }
+ }
- append(event, pool1);
+ append(event, pool1);
}
void AppenderSkeleton::setErrorHandler(const spi::ErrorHandlerPtr& errorHandler1)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (errorHandler1 == 0)
- {
- // We do not throw exception here since the cause is probably a
- // bad config file.
- LogLog::warn(LOG4CXX_STR("You have tried to set a null error-handler."));
- }
- else
- {
- this->errorHandler = errorHandler1;
- }
+ if (errorHandler1 == 0)
+ {
+ // We do not throw exception here since the cause is probably a
+ // bad config file.
+ LogLog::warn(LOG4CXX_STR("You have tried to set a null error-handler."));
+ }
+ else
+ {
+ this->errorHandler = errorHandler1;
+ }
}
void AppenderSkeleton::setThreshold(const LevelPtr& threshold1)
{
- LOCK_W sync(mutex);
- this->threshold = threshold1;
+ LOCK_W sync(mutex);
+ this->threshold = threshold1;
}
void AppenderSkeleton::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("THRESHOLD"), LOG4CXX_STR("threshold")))
- {
- setThreshold(Level::toLevelLS(value));
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("THRESHOLD"), LOG4CXX_STR("threshold")))
+ {
+ setThreshold(Level::toLevelLS(value));
+ }
}
diff --git a/src/main/cpp/aprinitializer.cpp b/src/main/cpp/aprinitializer.cpp
index 151c056..ccb7241 100644
--- a/src/main/cpp/aprinitializer.cpp
+++ b/src/main/cpp/aprinitializer.cpp
@@ -16,7 +16,7 @@
*/
#include <log4cxx/logstring.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
#include <apr_pools.h>
@@ -38,94 +38,94 @@
{
extern "C" void tlsDestruct(void* ptr)
{
- delete ((ThreadSpecificData*) ptr);
+ delete ((ThreadSpecificData*) ptr);
}
}
APRInitializer::APRInitializer() : p(0), mutex(0), startTime(0), tlsKey(0)
{
- apr_initialize();
- apr_pool_create(&p, NULL);
- apr_atomic_init(p);
- startTime = apr_time_now();
+ apr_initialize();
+ apr_pool_create(&p, NULL);
+ apr_atomic_init(p);
+ startTime = apr_time_now();
#if APR_HAS_THREADS
- apr_status_t stat = apr_threadkey_private_create(&tlsKey, tlsDestruct, p);
- assert(stat == APR_SUCCESS);
- stat = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_NESTED, p);
- assert(stat == APR_SUCCESS);
+ apr_status_t stat = apr_threadkey_private_create(&tlsKey, tlsDestruct, p);
+ assert(stat == APR_SUCCESS);
+ stat = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_NESTED, p);
+ assert(stat == APR_SUCCESS);
#endif
}
APRInitializer::~APRInitializer()
{
- {
+ {
#if APR_HAS_THREADS
- synchronized sync(mutex);
- apr_threadkey_private_delete(tlsKey);
+ synchronized sync(mutex);
+ apr_threadkey_private_delete(tlsKey);
#endif
- for (std::list<FileWatchdog*>::iterator iter = watchdogs.begin();
- iter != watchdogs.end();
- iter++)
- {
- delete *iter;
- }
- }
+ for (std::list<FileWatchdog*>::iterator iter = watchdogs.begin();
+ iter != watchdogs.end();
+ iter++)
+ {
+ delete *iter;
+ }
+ }
- // TODO LOGCXX-322
+ // TODO LOGCXX-322
#ifndef APR_HAS_THREADS
- apr_terminate();
+ apr_terminate();
#endif
- isDestructed = true;
+ isDestructed = true;
}
APRInitializer& APRInitializer::getInstance()
{
- static APRInitializer init;
- return init;
+ static APRInitializer init;
+ return init;
}
log4cxx_time_t APRInitializer::initialize()
{
- return getInstance().startTime;
+ return getInstance().startTime;
}
apr_pool_t* APRInitializer::getRootPool()
{
- return getInstance().p;
+ return getInstance().p;
}
apr_threadkey_t* APRInitializer::getTlsKey()
{
- return getInstance().tlsKey;
+ return getInstance().tlsKey;
}
void APRInitializer::registerCleanup(FileWatchdog* watchdog)
{
- APRInitializer& instance(getInstance());
+ APRInitializer& instance(getInstance());
#if APR_HAS_THREADS
- synchronized sync(instance.mutex);
+ synchronized sync(instance.mutex);
#endif
- instance.watchdogs.push_back(watchdog);
+ instance.watchdogs.push_back(watchdog);
}
void APRInitializer::unregisterCleanup(FileWatchdog* watchdog)
{
- APRInitializer& instance(getInstance());
+ APRInitializer& instance(getInstance());
#if APR_HAS_THREADS
- synchronized sync(instance.mutex);
+ synchronized sync(instance.mutex);
#endif
- for (std::list<FileWatchdog*>::iterator iter = instance.watchdogs.begin();
- iter != instance.watchdogs.end();
- iter++)
- {
- if (*iter == watchdog)
- {
- instance.watchdogs.erase(iter);
- return;
- }
- }
+ for (std::list<FileWatchdog*>::iterator iter = instance.watchdogs.begin();
+ iter != instance.watchdogs.end();
+ iter++)
+ {
+ if (*iter == watchdog)
+ {
+ instance.watchdogs.erase(iter);
+ return;
+ }
+ }
}
diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 0a9930f..603b42c 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/asyncappender.h>
@@ -43,413 +43,413 @@
AsyncAppender::AsyncAppender()
- : AppenderSkeleton(),
- buffer(),
- bufferMutex(pool),
- bufferNotFull(pool),
- bufferNotEmpty(pool),
- discardMap(new DiscardMap()),
- bufferSize(DEFAULT_BUFFER_SIZE),
- appenders(new AppenderAttachableImpl(pool)),
- dispatcher(),
- locationInfo(false),
- blocking(true)
+ : AppenderSkeleton(),
+ buffer(),
+ bufferMutex(pool),
+ bufferNotFull(pool),
+ bufferNotEmpty(pool),
+ discardMap(new DiscardMap()),
+ bufferSize(DEFAULT_BUFFER_SIZE),
+ appenders(new AppenderAttachableImpl(pool)),
+ dispatcher(),
+ locationInfo(false),
+ blocking(true)
{
#if APR_HAS_THREADS
- dispatcher.run(dispatch, this);
+ dispatcher.run(dispatch, this);
#endif
}
AsyncAppender::~AsyncAppender()
{
- finalize();
- delete discardMap;
+ finalize();
+ delete discardMap;
}
void AsyncAppender::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void AsyncAppender::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void AsyncAppender::addAppender(const AppenderPtr& newAppender)
{
- synchronized sync(appenders->getMutex());
- appenders->addAppender(newAppender);
+ synchronized sync(appenders->getMutex());
+ appenders->addAppender(newAppender);
}
void AsyncAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, false));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, false));
+ }
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- setBufferSize(OptionConverter::toInt(value, DEFAULT_BUFFER_SIZE));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ setBufferSize(OptionConverter::toInt(value, DEFAULT_BUFFER_SIZE));
+ }
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BLOCKING"), LOG4CXX_STR("blocking")))
- {
- setBlocking(OptionConverter::toBoolean(value, true));
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BLOCKING"), LOG4CXX_STR("blocking")))
+ {
+ setBlocking(OptionConverter::toBoolean(value, true));
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void AsyncAppender::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
{
- LOCK_R sync(mutex);
+ LOCK_R sync(mutex);
- doAppendImpl(event, pool1);
+ doAppendImpl(event, pool1);
}
void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
#if APR_HAS_THREADS
- //
- // if dispatcher has died then
- // append subsequent events synchronously
- //
- if (!dispatcher.isAlive() || bufferSize <= 0)
- {
- synchronized sync(appenders->getMutex());
- appenders->appendLoopOnAppenders(event, p);
- return;
- }
+ //
+ // if dispatcher has died then
+ // append subsequent events synchronously
+ //
+ if (!dispatcher.isAlive() || bufferSize <= 0)
+ {
+ synchronized sync(appenders->getMutex());
+ appenders->appendLoopOnAppenders(event, p);
+ return;
+ }
- // Set the NDC and thread name for the calling thread as these
- // LoggingEvent fields were not set at event creation time.
- LogString ndcVal;
- event->getNDC(ndcVal);
- event->getThreadName();
- // Get a copy of this thread's MDC.
- event->getMDCCopy();
+ // Set the NDC and thread name for the calling thread as these
+ // LoggingEvent fields were not set at event creation time.
+ LogString ndcVal;
+ event->getNDC(ndcVal);
+ event->getThreadName();
+ // Get a copy of this thread's MDC.
+ event->getMDCCopy();
- {
- synchronized sync(bufferMutex);
+ {
+ synchronized sync(bufferMutex);
- while (true)
- {
- int previousSize = buffer.size();
+ while (true)
+ {
+ int previousSize = buffer.size();
- if (previousSize < bufferSize)
- {
- buffer.push_back(event);
+ if (previousSize < bufferSize)
+ {
+ buffer.push_back(event);
- if (previousSize == 0)
- {
- bufferNotEmpty.signalAll();
- }
+ if (previousSize == 0)
+ {
+ bufferNotEmpty.signalAll();
+ }
- break;
- }
+ break;
+ }
- //
- // Following code is only reachable if buffer is full
- //
- //
- // if blocking and thread is not already interrupted
- // and not the dispatcher then
- // wait for a buffer notification
- bool discard = true;
+ //
+ // Following code is only reachable if buffer is full
+ //
+ //
+ // if blocking and thread is not already interrupted
+ // and not the dispatcher then
+ // wait for a buffer notification
+ bool discard = true;
- if (blocking
- && !Thread::interrupted()
- && !dispatcher.isCurrentThread())
- {
- try
- {
- bufferNotFull.await(bufferMutex);
- discard = false;
- }
- catch (InterruptedException& e)
- {
- //
- // reset interrupt status so
- // calling code can see interrupt on
- // their next wait or sleep.
- Thread::currentThreadInterrupt();
- }
- }
+ if (blocking
+ && !Thread::interrupted()
+ && !dispatcher.isCurrentThread())
+ {
+ try
+ {
+ bufferNotFull.await(bufferMutex);
+ discard = false;
+ }
+ catch (InterruptedException& e)
+ {
+ //
+ // reset interrupt status so
+ // calling code can see interrupt on
+ // their next wait or sleep.
+ Thread::currentThreadInterrupt();
+ }
+ }
- //
- // if blocking is false or thread has been interrupted
- // add event to discard map.
- //
- if (discard)
- {
- LogString loggerName = event->getLoggerName();
- DiscardMap::iterator iter = discardMap->find(loggerName);
+ //
+ // if blocking is false or thread has been interrupted
+ // add event to discard map.
+ //
+ if (discard)
+ {
+ LogString loggerName = event->getLoggerName();
+ DiscardMap::iterator iter = discardMap->find(loggerName);
- if (iter == discardMap->end())
- {
- DiscardSummary summary(event);
- discardMap->insert(DiscardMap::value_type(loggerName, summary));
- }
- else
- {
- (*iter).second.add(event);
- }
+ if (iter == discardMap->end())
+ {
+ DiscardSummary summary(event);
+ discardMap->insert(DiscardMap::value_type(loggerName, summary));
+ }
+ else
+ {
+ (*iter).second.add(event);
+ }
- break;
- }
- }
- }
+ break;
+ }
+ }
+ }
#else
- synchronized sync(appenders->getMutex());
- appenders->appendLoopOnAppenders(event, p);
+ synchronized sync(appenders->getMutex());
+ appenders->appendLoopOnAppenders(event, p);
#endif
}
void AsyncAppender::close()
{
- {
- synchronized sync(bufferMutex);
- closed = true;
- bufferNotEmpty.signalAll();
- bufferNotFull.signalAll();
- }
+ {
+ synchronized sync(bufferMutex);
+ closed = true;
+ bufferNotEmpty.signalAll();
+ bufferNotFull.signalAll();
+ }
#if APR_HAS_THREADS
- try
- {
- dispatcher.join();
- }
- catch (InterruptedException& e)
- {
- Thread::currentThreadInterrupt();
- LogLog::error(LOG4CXX_STR("Got an InterruptedException while waiting for the dispatcher to finish,"), e);
- }
+ try
+ {
+ dispatcher.join();
+ }
+ catch (InterruptedException& e)
+ {
+ Thread::currentThreadInterrupt();
+ LogLog::error(LOG4CXX_STR("Got an InterruptedException while waiting for the dispatcher to finish,"), e);
+ }
#endif
- {
- synchronized sync(appenders->getMutex());
- AppenderList appenderList = appenders->getAllAppenders();
+ {
+ synchronized sync(appenders->getMutex());
+ AppenderList appenderList = appenders->getAllAppenders();
- for (AppenderList::iterator iter = appenderList.begin();
- iter != appenderList.end();
- iter++)
- {
- (*iter)->close();
- }
- }
+ for (AppenderList::iterator iter = appenderList.begin();
+ iter != appenderList.end();
+ iter++)
+ {
+ (*iter)->close();
+ }
+ }
}
AppenderList AsyncAppender::getAllAppenders() const
{
- synchronized sync(appenders->getMutex());
- return appenders->getAllAppenders();
+ synchronized sync(appenders->getMutex());
+ return appenders->getAllAppenders();
}
AppenderPtr AsyncAppender::getAppender(const LogString& n) const
{
- synchronized sync(appenders->getMutex());
- return appenders->getAppender(n);
+ synchronized sync(appenders->getMutex());
+ return appenders->getAppender(n);
}
bool AsyncAppender::isAttached(const AppenderPtr& appender) const
{
- synchronized sync(appenders->getMutex());
- return appenders->isAttached(appender);
+ synchronized sync(appenders->getMutex());
+ return appenders->isAttached(appender);
}
bool AsyncAppender::requiresLayout() const
{
- return false;
+ return false;
}
void AsyncAppender::removeAllAppenders()
{
- synchronized sync(appenders->getMutex());
- appenders->removeAllAppenders();
+ synchronized sync(appenders->getMutex());
+ appenders->removeAllAppenders();
}
void AsyncAppender::removeAppender(const AppenderPtr& appender)
{
- synchronized sync(appenders->getMutex());
- appenders->removeAppender(appender);
+ synchronized sync(appenders->getMutex());
+ appenders->removeAppender(appender);
}
void AsyncAppender::removeAppender(const LogString& n)
{
- synchronized sync(appenders->getMutex());
- appenders->removeAppender(n);
+ synchronized sync(appenders->getMutex());
+ appenders->removeAppender(n);
}
bool AsyncAppender::getLocationInfo() const
{
- return locationInfo;
+ return locationInfo;
}
void AsyncAppender::setLocationInfo(bool flag)
{
- locationInfo = flag;
+ locationInfo = flag;
}
void AsyncAppender::setBufferSize(int size)
{
- if (size < 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
- }
+ if (size < 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
+ }
- synchronized sync(bufferMutex);
- bufferSize = (size < 1) ? 1 : size;
- bufferNotFull.signalAll();
+ synchronized sync(bufferMutex);
+ bufferSize = (size < 1) ? 1 : size;
+ bufferNotFull.signalAll();
}
int AsyncAppender::getBufferSize() const
{
- return bufferSize;
+ return bufferSize;
}
void AsyncAppender::setBlocking(bool value)
{
- synchronized sync(bufferMutex);
- blocking = value;
- bufferNotFull.signalAll();
+ synchronized sync(bufferMutex);
+ blocking = value;
+ bufferNotFull.signalAll();
}
bool AsyncAppender::getBlocking() const
{
- return blocking;
+ return blocking;
}
AsyncAppender::DiscardSummary::DiscardSummary(const LoggingEventPtr& event) :
- maxEvent(event), count(1)
+ maxEvent(event), count(1)
{
}
AsyncAppender::DiscardSummary::DiscardSummary(const DiscardSummary& src) :
- maxEvent(src.maxEvent), count(src.count)
+ maxEvent(src.maxEvent), count(src.count)
{
}
AsyncAppender::DiscardSummary& AsyncAppender::DiscardSummary::operator=(const DiscardSummary& src)
{
- maxEvent = src.maxEvent;
- count = src.count;
- return *this;
+ maxEvent = src.maxEvent;
+ count = src.count;
+ return *this;
}
void AsyncAppender::DiscardSummary::add(const LoggingEventPtr& event)
{
- if (event->getLevel()->toInt() > maxEvent->getLevel()->toInt())
- {
- maxEvent = event;
- }
+ if (event->getLevel()->toInt() > maxEvent->getLevel()->toInt())
+ {
+ maxEvent = event;
+ }
- count++;
+ count++;
}
LoggingEventPtr AsyncAppender::DiscardSummary::createEvent(Pool& p)
{
- LogString msg(LOG4CXX_STR("Discarded "));
- StringHelper::toString(count, p, msg);
- msg.append(LOG4CXX_STR(" messages due to a full event buffer including: "));
- msg.append(maxEvent->getMessage());
- return new LoggingEvent(
- maxEvent->getLoggerName(),
- maxEvent->getLevel(),
- msg,
- LocationInfo::getLocationUnavailable());
+ LogString msg(LOG4CXX_STR("Discarded "));
+ StringHelper::toString(count, p, msg);
+ msg.append(LOG4CXX_STR(" messages due to a full event buffer including: "));
+ msg.append(maxEvent->getMessage());
+ return new LoggingEvent(
+ maxEvent->getLoggerName(),
+ maxEvent->getLevel(),
+ msg,
+ LocationInfo::getLocationUnavailable());
}
::log4cxx::spi::LoggingEventPtr
AsyncAppender::DiscardSummary::createEvent(::log4cxx::helpers::Pool& p,
- size_t discardedCount)
+ size_t discardedCount)
{
- LogString msg(LOG4CXX_STR("Discarded "));
- StringHelper::toString(discardedCount, p, msg);
- msg.append(LOG4CXX_STR(" messages due to a full event buffer"));
+ LogString msg(LOG4CXX_STR("Discarded "));
+ StringHelper::toString(discardedCount, p, msg);
+ msg.append(LOG4CXX_STR(" messages due to a full event buffer"));
- return new LoggingEvent(
- LOG4CXX_STR(""),
- log4cxx::Level::getError(),
- msg,
- LocationInfo::getLocationUnavailable());
+ return new LoggingEvent(
+ LOG4CXX_STR(""),
+ log4cxx::Level::getError(),
+ msg,
+ LocationInfo::getLocationUnavailable());
}
#if APR_HAS_THREADS
void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* /*thread*/, void* data)
{
- AsyncAppender* pThis = (AsyncAppender*) data;
- bool isActive = true;
+ AsyncAppender* pThis = (AsyncAppender*) data;
+ bool isActive = true;
- try
- {
- while (isActive)
- {
- //
- // process events after lock on buffer is released.
- //
- Pool p;
- LoggingEventList events;
- {
- synchronized sync(pThis->bufferMutex);
- size_t bufferSize = pThis->buffer.size();
- isActive = !pThis->closed;
+ try
+ {
+ while (isActive)
+ {
+ //
+ // process events after lock on buffer is released.
+ //
+ Pool p;
+ LoggingEventList events;
+ {
+ synchronized sync(pThis->bufferMutex);
+ size_t bufferSize = pThis->buffer.size();
+ isActive = !pThis->closed;
- while ((bufferSize == 0) && isActive)
- {
- pThis->bufferNotEmpty.await(pThis->bufferMutex);
- bufferSize = pThis->buffer.size();
- isActive = !pThis->closed;
- }
+ while ((bufferSize == 0) && isActive)
+ {
+ pThis->bufferNotEmpty.await(pThis->bufferMutex);
+ bufferSize = pThis->buffer.size();
+ isActive = !pThis->closed;
+ }
- for (LoggingEventList::iterator eventIter = pThis->buffer.begin();
- eventIter != pThis->buffer.end();
- eventIter++)
- {
- events.push_back(*eventIter);
- }
+ for (LoggingEventList::iterator eventIter = pThis->buffer.begin();
+ eventIter != pThis->buffer.end();
+ eventIter++)
+ {
+ events.push_back(*eventIter);
+ }
- for (DiscardMap::iterator discardIter = pThis->discardMap->begin();
- discardIter != pThis->discardMap->end();
- discardIter++)
- {
- events.push_back(discardIter->second.createEvent(p));
- }
+ for (DiscardMap::iterator discardIter = pThis->discardMap->begin();
+ discardIter != pThis->discardMap->end();
+ discardIter++)
+ {
+ events.push_back(discardIter->second.createEvent(p));
+ }
- pThis->buffer.clear();
- pThis->discardMap->clear();
- pThis->bufferNotFull.signalAll();
- }
+ pThis->buffer.clear();
+ pThis->discardMap->clear();
+ pThis->bufferNotFull.signalAll();
+ }
- for (LoggingEventList::iterator iter = events.begin();
- iter != events.end();
- iter++)
- {
- synchronized sync(pThis->appenders->getMutex());
- pThis->appenders->appendLoopOnAppenders(*iter, p);
- }
- }
- }
- catch (InterruptedException& ex)
- {
- Thread::currentThreadInterrupt();
- }
- catch (...)
- {
- }
+ for (LoggingEventList::iterator iter = events.begin();
+ iter != events.end();
+ iter++)
+ {
+ synchronized sync(pThis->appenders->getMutex());
+ pThis->appenders->appendLoopOnAppenders(*iter, p);
+ }
+ }
+ }
+ catch (InterruptedException& ex)
+ {
+ Thread::currentThreadInterrupt();
+ }
+ catch (...)
+ {
+ }
- return 0;
+ return 0;
}
#endif
diff --git a/src/main/cpp/asyncappender_nonblocking.cpp b/src/main/cpp/asyncappender_nonblocking.cpp
index fca89df..6c28756 100644
--- a/src/main/cpp/asyncappender_nonblocking.cpp
+++ b/src/main/cpp/asyncappender_nonblocking.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/asyncappender.h>
@@ -43,405 +43,405 @@
AsyncAppender::AsyncAppender()
- : AppenderSkeleton(),
- buffer(DEFAULT_BUFFER_SIZE),
- SHARED_MUTEX_INIT(bufferMutex, pool),
- bufferNotFull(pool),
- bufferNotEmpty(pool),
- discardMap(new DiscardMap()),
- bufferSize(DEFAULT_BUFFER_SIZE),
- appenders(new AppenderAttachableImpl(pool)),
- dispatcher(),
- locationInfo(false),
- blocking(true)
+ : AppenderSkeleton(),
+ buffer(DEFAULT_BUFFER_SIZE),
+ SHARED_MUTEX_INIT(bufferMutex, pool),
+ bufferNotFull(pool),
+ bufferNotEmpty(pool),
+ discardMap(new DiscardMap()),
+ bufferSize(DEFAULT_BUFFER_SIZE),
+ appenders(new AppenderAttachableImpl(pool)),
+ dispatcher(),
+ locationInfo(false),
+ blocking(true)
{
#if APR_HAS_THREADS
- dispatcher.run(dispatch, this);
+ dispatcher.run(dispatch, this);
#endif
}
AsyncAppender::~AsyncAppender()
{
- finalize();
- delete discardMap;
+ finalize();
+ delete discardMap;
}
void AsyncAppender::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void AsyncAppender::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void AsyncAppender::addAppender(const AppenderPtr& newAppender)
{
- synchronized sync(appenders->getMutex());
- appenders->addAppender(newAppender);
+ synchronized sync(appenders->getMutex());
+ appenders->addAppender(newAppender);
}
void AsyncAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, false));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, false));
+ }
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- setBufferSize(OptionConverter::toInt(value, DEFAULT_BUFFER_SIZE));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ setBufferSize(OptionConverter::toInt(value, DEFAULT_BUFFER_SIZE));
+ }
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BLOCKING"), LOG4CXX_STR("blocking")))
- {
- setBlocking(OptionConverter::toBoolean(value, true));
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BLOCKING"), LOG4CXX_STR("blocking")))
+ {
+ setBlocking(OptionConverter::toBoolean(value, true));
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void AsyncAppender::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
{
- LOCK_R sync(mutex);
+ LOCK_R sync(mutex);
- doAppendImpl(event, pool1);
+ doAppendImpl(event, pool1);
}
void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
#if APR_HAS_THREADS
- //
- // if dispatcher has died then
- // append subsequent events synchronously
- //
- if (!dispatcher.isAlive() || bufferSize <= 0)
- {
- synchronized sync(appenders->getMutex());
- appenders->appendLoopOnAppenders(event, p);
- return;
- }
+ //
+ // if dispatcher has died then
+ // append subsequent events synchronously
+ //
+ if (!dispatcher.isAlive() || bufferSize <= 0)
+ {
+ synchronized sync(appenders->getMutex());
+ appenders->appendLoopOnAppenders(event, p);
+ return;
+ }
- // Set the NDC and thread name for the calling thread as these
- // LoggingEvent fields were not set at event creation time.
- LogString ndcVal;
- event->getNDC(ndcVal);
- event->getThreadName();
- // Get a copy of this thread's MDC.
- event->getMDCCopy();
+ // Set the NDC and thread name for the calling thread as these
+ // LoggingEvent fields were not set at event creation time.
+ LogString ndcVal;
+ event->getNDC(ndcVal);
+ event->getThreadName();
+ // Get a copy of this thread's MDC.
+ event->getMDCCopy();
- {
- LOCK_R sync(bufferMutex);
+ {
+ LOCK_R sync(bufferMutex);
- while (true)
- {
+ while (true)
+ {
- event->addRef();
+ event->addRef();
- if (buffer.bounded_push(event))
- {
- bufferNotEmpty.signalAll();
- break;
- }
- else
- {
- event->releaseRef();
- }
+ if (buffer.bounded_push(event))
+ {
+ bufferNotEmpty.signalAll();
+ break;
+ }
+ else
+ {
+ event->releaseRef();
+ }
- //
- // Following code is only reachable if buffer is full
- //
- //
- // if blocking and thread is not already interrupted
- // and not the dispatcher then
- // wait for a buffer notification
- bool discard = true;
+ //
+ // Following code is only reachable if buffer is full
+ //
+ //
+ // if blocking and thread is not already interrupted
+ // and not the dispatcher then
+ // wait for a buffer notification
+ bool discard = true;
- if (blocking
- && !Thread::interrupted()
- && !dispatcher.isCurrentThread())
- {
- try
- {
- bufferNotFull.await();
- discard = false;
- }
- catch (InterruptedException& e)
- {
- //
- // reset interrupt status so
- // calling code can see interrupt on
- // their next wait or sleep.
- Thread::currentThreadInterrupt();
- }
- }
+ if (blocking
+ && !Thread::interrupted()
+ && !dispatcher.isCurrentThread())
+ {
+ try
+ {
+ bufferNotFull.await();
+ discard = false;
+ }
+ catch (InterruptedException& e)
+ {
+ //
+ // reset interrupt status so
+ // calling code can see interrupt on
+ // their next wait or sleep.
+ Thread::currentThreadInterrupt();
+ }
+ }
- //
- // if blocking is false or thread has been interrupted
- // add event to discard map.
- //
- if (discard)
- {
- discardedCount++;
- break;
- }
- }
- }
+ //
+ // if blocking is false or thread has been interrupted
+ // add event to discard map.
+ //
+ if (discard)
+ {
+ discardedCount++;
+ break;
+ }
+ }
+ }
#else
- synchronized sync(appenders->getMutex());
- appenders->appendLoopOnAppenders(event, p);
+ synchronized sync(appenders->getMutex());
+ appenders->appendLoopOnAppenders(event, p);
#endif
}
void AsyncAppender::close()
{
- {
- LOCK_W sync(bufferMutex);
- closed = true;
- }
+ {
+ LOCK_W sync(bufferMutex);
+ closed = true;
+ }
- bufferNotEmpty.signalAll();
- bufferNotFull.signalAll();
+ bufferNotEmpty.signalAll();
+ bufferNotFull.signalAll();
#if APR_HAS_THREADS
- try
- {
- dispatcher.join();
- }
- catch (InterruptedException& e)
- {
- Thread::currentThreadInterrupt();
- LogLog::error(LOG4CXX_STR("Got an InterruptedException while waiting for the dispatcher to finish,"), e);
- }
+ try
+ {
+ dispatcher.join();
+ }
+ catch (InterruptedException& e)
+ {
+ Thread::currentThreadInterrupt();
+ LogLog::error(LOG4CXX_STR("Got an InterruptedException while waiting for the dispatcher to finish,"), e);
+ }
#endif
- {
- synchronized sync(appenders->getMutex());
- AppenderList appenderList = appenders->getAllAppenders();
+ {
+ synchronized sync(appenders->getMutex());
+ AppenderList appenderList = appenders->getAllAppenders();
- for (AppenderList::iterator iter = appenderList.begin();
- iter != appenderList.end();
- iter++)
- {
- (*iter)->close();
- }
- }
+ for (AppenderList::iterator iter = appenderList.begin();
+ iter != appenderList.end();
+ iter++)
+ {
+ (*iter)->close();
+ }
+ }
}
AppenderList AsyncAppender::getAllAppenders() const
{
- synchronized sync(appenders->getMutex());
- return appenders->getAllAppenders();
+ synchronized sync(appenders->getMutex());
+ return appenders->getAllAppenders();
}
AppenderPtr AsyncAppender::getAppender(const LogString& n) const
{
- synchronized sync(appenders->getMutex());
- return appenders->getAppender(n);
+ synchronized sync(appenders->getMutex());
+ return appenders->getAppender(n);
}
bool AsyncAppender::isAttached(const AppenderPtr& appender) const
{
- synchronized sync(appenders->getMutex());
- return appenders->isAttached(appender);
+ synchronized sync(appenders->getMutex());
+ return appenders->isAttached(appender);
}
bool AsyncAppender::requiresLayout() const
{
- return false;
+ return false;
}
void AsyncAppender::removeAllAppenders()
{
- synchronized sync(appenders->getMutex());
- appenders->removeAllAppenders();
+ synchronized sync(appenders->getMutex());
+ appenders->removeAllAppenders();
}
void AsyncAppender::removeAppender(const AppenderPtr& appender)
{
- synchronized sync(appenders->getMutex());
- appenders->removeAppender(appender);
+ synchronized sync(appenders->getMutex());
+ appenders->removeAppender(appender);
}
void AsyncAppender::removeAppender(const LogString& n)
{
- synchronized sync(appenders->getMutex());
- appenders->removeAppender(n);
+ synchronized sync(appenders->getMutex());
+ appenders->removeAppender(n);
}
bool AsyncAppender::getLocationInfo() const
{
- return locationInfo;
+ return locationInfo;
}
void AsyncAppender::setLocationInfo(bool flag)
{
- locationInfo = flag;
+ locationInfo = flag;
}
void AsyncAppender::setBufferSize(int size)
{
- if (size < 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
- }
+ if (size < 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
+ }
- {
- LOCK_W sync(bufferMutex);
- bufferSize = (size < 1) ? 1 : size;
- buffer.reserve_unsafe(bufferSize);
- }
+ {
+ LOCK_W sync(bufferMutex);
+ bufferSize = (size < 1) ? 1 : size;
+ buffer.reserve_unsafe(bufferSize);
+ }
- bufferNotFull.signalAll();
+ bufferNotFull.signalAll();
}
int AsyncAppender::getBufferSize() const
{
- return bufferSize;
+ return bufferSize;
}
void AsyncAppender::setBlocking(bool value)
{
- {
- LOCK_W sync(bufferMutex);
- blocking = value;
- }
- bufferNotFull.signalAll();
+ {
+ LOCK_W sync(bufferMutex);
+ blocking = value;
+ }
+ bufferNotFull.signalAll();
}
bool AsyncAppender::getBlocking() const
{
- return blocking;
+ return blocking;
}
AsyncAppender::DiscardSummary::DiscardSummary(const LoggingEventPtr& event) :
- maxEvent(event), count(1)
+ maxEvent(event), count(1)
{
}
AsyncAppender::DiscardSummary::DiscardSummary(const DiscardSummary& src) :
- maxEvent(src.maxEvent), count(src.count)
+ maxEvent(src.maxEvent), count(src.count)
{
}
AsyncAppender::DiscardSummary& AsyncAppender::DiscardSummary::operator=(const DiscardSummary& src)
{
- maxEvent = src.maxEvent;
- count = src.count;
- return *this;
+ maxEvent = src.maxEvent;
+ count = src.count;
+ return *this;
}
void AsyncAppender::DiscardSummary::add(const LoggingEventPtr& event)
{
- if (event->getLevel()->toInt() > maxEvent->getLevel()->toInt())
- {
- maxEvent = event;
- }
+ if (event->getLevel()->toInt() > maxEvent->getLevel()->toInt())
+ {
+ maxEvent = event;
+ }
- count++;
+ count++;
}
LoggingEventPtr AsyncAppender::DiscardSummary::createEvent(Pool& p)
{
- LogString msg(LOG4CXX_STR("Discarded "));
- StringHelper::toString(count, p, msg);
- msg.append(LOG4CXX_STR(" messages due to a full event buffer including: "));
- msg.append(maxEvent->getMessage());
- return new LoggingEvent(
- maxEvent->getLoggerName(),
- maxEvent->getLevel(),
- msg,
- LocationInfo::getLocationUnavailable());
+ LogString msg(LOG4CXX_STR("Discarded "));
+ StringHelper::toString(count, p, msg);
+ msg.append(LOG4CXX_STR(" messages due to a full event buffer including: "));
+ msg.append(maxEvent->getMessage());
+ return new LoggingEvent(
+ maxEvent->getLoggerName(),
+ maxEvent->getLevel(),
+ msg,
+ LocationInfo::getLocationUnavailable());
}
::log4cxx::spi::LoggingEventPtr
AsyncAppender::DiscardSummary::createEvent(::log4cxx::helpers::Pool& p,
- size_t discardedCount)
+ size_t discardedCount)
{
- LogString msg(LOG4CXX_STR("Discarded "));
- StringHelper::toString(discardedCount, p, msg);
- msg.append(LOG4CXX_STR(" messages due to a full event buffer"));
+ LogString msg(LOG4CXX_STR("Discarded "));
+ StringHelper::toString(discardedCount, p, msg);
+ msg.append(LOG4CXX_STR(" messages due to a full event buffer"));
- return new LoggingEvent(
- LOG4CXX_STR(""),
- log4cxx::Level::getError(),
- msg,
- LocationInfo::getLocationUnavailable());
+ return new LoggingEvent(
+ LOG4CXX_STR(""),
+ log4cxx::Level::getError(),
+ msg,
+ LocationInfo::getLocationUnavailable());
}
#if APR_HAS_THREADS
void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* /*thread*/, void* data)
{
- AsyncAppender* pThis = (AsyncAppender*) data;
+ AsyncAppender* pThis = (AsyncAppender*) data;
- try
- {
- while (!pThis->closed || !pThis->buffer.empty())
- {
+ try
+ {
+ while (!pThis->closed || !pThis->buffer.empty())
+ {
- pThis->bufferNotEmpty.await();
+ pThis->bufferNotEmpty.await();
- //
- // process events after lock on buffer is released.
- //
- Pool p;
- LoggingEventList events;
- {
- LOCK_R sync(pThis->bufferMutex);
+ //
+ // process events after lock on buffer is released.
+ //
+ Pool p;
+ LoggingEventList events;
+ {
+ LOCK_R sync(pThis->bufferMutex);
- unsigned count = 0;
- log4cxx::spi::LoggingEvent* logPtr = nullptr;
+ unsigned count = 0;
+ log4cxx::spi::LoggingEvent* logPtr = nullptr;
- while (pThis->buffer.pop(logPtr))
- {
- log4cxx::spi::LoggingEventPtr ptr(logPtr);
- events.push_back(ptr);
- logPtr->releaseRef();
- count++;
- }
+ while (pThis->buffer.pop(logPtr))
+ {
+ log4cxx::spi::LoggingEventPtr ptr(logPtr);
+ events.push_back(ptr);
+ logPtr->releaseRef();
+ count++;
+ }
- if (pThis->blocking)
- {
- pThis->bufferNotFull.signalAll();
- }
+ if (pThis->blocking)
+ {
+ pThis->bufferNotFull.signalAll();
+ }
- size_t discarded = pThis->discardedCount.exchange(0);
+ size_t discarded = pThis->discardedCount.exchange(0);
- if (discarded != 0)
- {
- events.push_back(AsyncAppender::DiscardSummary::createEvent(p, discarded));
- }
- }
+ if (discarded != 0)
+ {
+ events.push_back(AsyncAppender::DiscardSummary::createEvent(p, discarded));
+ }
+ }
- for (LoggingEventList::iterator iter = events.begin();
- iter != events.end();
- iter++)
- {
- synchronized sync(pThis->appenders->getMutex());
- pThis->appenders->appendLoopOnAppenders(*iter, p);
- }
- }
- }
- catch (InterruptedException& ex)
- {
- Thread::currentThreadInterrupt();
- }
- catch (...)
- {
- }
+ for (LoggingEventList::iterator iter = events.begin();
+ iter != events.end();
+ iter++)
+ {
+ synchronized sync(pThis->appenders->getMutex());
+ pThis->appenders->appendLoopOnAppenders(*iter, p);
+ }
+ }
+ }
+ catch (InterruptedException& ex)
+ {
+ Thread::currentThreadInterrupt();
+ }
+ catch (...)
+ {
+ }
- return 0;
+ return 0;
}
#endif
diff --git a/src/main/cpp/basicconfigurator.cpp b/src/main/cpp/basicconfigurator.cpp
index 24a46d6..39db14b 100644
--- a/src/main/cpp/basicconfigurator.cpp
+++ b/src/main/cpp/basicconfigurator.cpp
@@ -25,21 +25,21 @@
void BasicConfigurator::configure()
{
- LogManager::getLoggerRepository()->setConfigured(true);
- LoggerPtr root = Logger::getRootLogger();
- static const LogString TTCC_CONVERSION_PATTERN(LOG4CXX_STR("%r [%t] %p %c %x - %m%n"));
- LayoutPtr layout(new PatternLayout(TTCC_CONVERSION_PATTERN));
- AppenderPtr appender(new ConsoleAppender(layout));
- root->addAppender(appender);
+ LogManager::getLoggerRepository()->setConfigured(true);
+ LoggerPtr root = Logger::getRootLogger();
+ static const LogString TTCC_CONVERSION_PATTERN(LOG4CXX_STR("%r [%t] %p %c %x - %m%n"));
+ LayoutPtr layout(new PatternLayout(TTCC_CONVERSION_PATTERN));
+ AppenderPtr appender(new ConsoleAppender(layout));
+ root->addAppender(appender);
}
void BasicConfigurator::configure(const AppenderPtr& appender)
{
- LoggerPtr root = Logger::getRootLogger();
- root->addAppender(appender);
+ LoggerPtr root = Logger::getRootLogger();
+ root->addAppender(appender);
}
void BasicConfigurator::resetConfiguration()
{
- LogManager::resetConfiguration();
+ LogManager::resetConfiguration();
}
diff --git a/src/main/cpp/bufferedwriter.cpp b/src/main/cpp/bufferedwriter.cpp
index 6898d09..5d21a9b 100644
--- a/src/main/cpp/bufferedwriter.cpp
+++ b/src/main/cpp/bufferedwriter.cpp
@@ -24,12 +24,12 @@
IMPLEMENT_LOG4CXX_OBJECT(BufferedWriter)
BufferedWriter::BufferedWriter(WriterPtr& out1)
- : out(out1), sz(1024)
+ : out(out1), sz(1024)
{
}
BufferedWriter::BufferedWriter(WriterPtr& out1, size_t sz1)
- : out(out1), sz(sz1)
+ : out(out1), sz(sz1)
{
}
@@ -39,34 +39,34 @@
void BufferedWriter::close(Pool& p)
{
- flush(p);
- out->close(p);
+ flush(p);
+ out->close(p);
}
void BufferedWriter::flush(Pool& p)
{
- if (buf.length() > 0)
- {
- out->write(buf, p);
- buf.erase(buf.begin(), buf.end());
- }
+ if (buf.length() > 0)
+ {
+ out->write(buf, p);
+ buf.erase(buf.begin(), buf.end());
+ }
}
void BufferedWriter::write(const LogString& str, Pool& p)
{
- if (buf.length() + str.length() > sz)
- {
- out->write(buf, p);
- buf.erase(buf.begin(), buf.end());
- }
+ if (buf.length() + str.length() > sz)
+ {
+ out->write(buf, p);
+ buf.erase(buf.begin(), buf.end());
+ }
- if (str.length() > sz)
- {
- out->write(str, p);
- }
- else
- {
- buf.append(str);
- }
+ if (str.length() > sz)
+ {
+ out->write(str, p);
+ }
+ else
+ {
+ buf.append(str);
+ }
}
diff --git a/src/main/cpp/bytearrayinputstream.cpp b/src/main/cpp/bytearrayinputstream.cpp
index 20f90f2..ee89744 100644
--- a/src/main/cpp/bytearrayinputstream.cpp
+++ b/src/main/cpp/bytearrayinputstream.cpp
@@ -29,7 +29,7 @@
IMPLEMENT_LOG4CXX_OBJECT(ByteArrayInputStream)
ByteArrayInputStream::ByteArrayInputStream(const std::vector<unsigned char>& bytes) :
- buf(bytes), pos(0)
+ buf(bytes), pos(0)
{
}
@@ -47,16 +47,16 @@
int ByteArrayInputStream::read(ByteBuffer& dst)
{
- if (pos >= buf.size())
- {
- return -1;
- }
- else
- {
- size_t bytesCopied = min(dst.remaining(), buf.size() - pos);
- memcpy(dst.current(), &buf[pos], bytesCopied);
- pos += bytesCopied;
- dst.position(dst.position() + bytesCopied);
- return bytesCopied;
- }
+ if (pos >= buf.size())
+ {
+ return -1;
+ }
+ else
+ {
+ size_t bytesCopied = min(dst.remaining(), buf.size() - pos);
+ memcpy(dst.current(), &buf[pos], bytesCopied);
+ pos += bytesCopied;
+ dst.position(dst.position() + bytesCopied);
+ return bytesCopied;
+ }
}
diff --git a/src/main/cpp/bytearrayoutputstream.cpp b/src/main/cpp/bytearrayoutputstream.cpp
index 52786c9..4918add 100644
--- a/src/main/cpp/bytearrayoutputstream.cpp
+++ b/src/main/cpp/bytearrayoutputstream.cpp
@@ -44,15 +44,15 @@
void ByteArrayOutputStream::write(ByteBuffer& buf, Pool& /* p */ )
{
- size_t sz = array.size();
- array.resize(sz + buf.remaining());
- memcpy(&array[sz], buf.current(), buf.remaining());
- buf.position(buf.limit());
+ size_t sz = array.size();
+ array.resize(sz + buf.remaining());
+ memcpy(&array[sz], buf.current(), buf.remaining());
+ buf.position(buf.limit());
}
std::vector<unsigned char> ByteArrayOutputStream::toByteArray() const
{
- return array;
+ return array;
}
diff --git a/src/main/cpp/bytebuffer.cpp b/src/main/cpp/bytebuffer.cpp
index e4f2e36..fce185f 100644
--- a/src/main/cpp/bytebuffer.cpp
+++ b/src/main/cpp/bytebuffer.cpp
@@ -24,7 +24,7 @@
using namespace log4cxx::helpers;
ByteBuffer::ByteBuffer(char* data1, size_t capacity)
- : base(data1), pos(0), lim(capacity), cap(capacity)
+ : base(data1), pos(0), lim(capacity), cap(capacity)
{
}
@@ -34,46 +34,46 @@
void ByteBuffer::clear()
{
- lim = cap;
- pos = 0;
+ lim = cap;
+ pos = 0;
}
void ByteBuffer::flip()
{
- lim = pos;
- pos = 0;
+ lim = pos;
+ pos = 0;
}
void ByteBuffer::position(size_t newPosition)
{
- if (newPosition < lim)
- {
- pos = newPosition;
- }
- else
- {
- pos = lim;
- }
+ if (newPosition < lim)
+ {
+ pos = newPosition;
+ }
+ else
+ {
+ pos = lim;
+ }
}
void ByteBuffer::limit(size_t newLimit)
{
- if (newLimit > cap)
- {
- throw IllegalArgumentException(LOG4CXX_STR("newLimit"));
- }
+ if (newLimit > cap)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("newLimit"));
+ }
- lim = newLimit;
+ lim = newLimit;
}
bool ByteBuffer::put(char byte)
{
- if (pos < lim)
- {
- base[pos++] = byte;
- return true;
- }
+ if (pos < lim)
+ {
+ base[pos++] = byte;
+ return true;
+ }
- return false;
+ return false;
}
diff --git a/src/main/cpp/cacheddateformat.cpp b/src/main/cpp/cacheddateformat.cpp
index 90672fe..b6084ee 100644
--- a/src/main/cpp/cacheddateformat.cpp
+++ b/src/main/cpp/cacheddateformat.cpp
@@ -67,23 +67,23 @@
* caching or 1 to only use cache for duplicate requests.
*/
CachedDateFormat::CachedDateFormat(const DateFormatPtr& dateFormat,
- int expiration1) :
- formatter(dateFormat),
- millisecondStart(0),
- slotBegin(std::numeric_limits<log4cxx_time_t>::min()),
- cache(50, 0x20),
- expiration(expiration1),
- previousTime(std::numeric_limits<log4cxx_time_t>::min())
+ int expiration1) :
+ formatter(dateFormat),
+ millisecondStart(0),
+ slotBegin(std::numeric_limits<log4cxx_time_t>::min()),
+ cache(50, 0x20),
+ expiration(expiration1),
+ previousTime(std::numeric_limits<log4cxx_time_t>::min())
{
- if (dateFormat == NULL)
- {
- throw IllegalArgumentException(LOG4CXX_STR("dateFormat cannot be null"));
- }
+ if (dateFormat == NULL)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("dateFormat cannot be null"));
+ }
- if (expiration1 < 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("expiration must be non-negative"));
- }
+ if (expiration1 < 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("expiration must be non-negative"));
+ }
}
@@ -97,86 +97,86 @@
* field (likely RelativeTimeDateFormat)
*/
int CachedDateFormat::findMillisecondStart(
- log4cxx_time_t time, const LogString& formatted,
- const DateFormatPtr& formatter,
- Pool& pool)
+ log4cxx_time_t time, const LogString& formatted,
+ const DateFormatPtr& formatter,
+ Pool& pool)
{
- apr_time_t slotBegin = (time / 1000000) * 1000000;
+ apr_time_t slotBegin = (time / 1000000) * 1000000;
- if (slotBegin > time)
- {
- slotBegin -= 1000000;
- }
+ if (slotBegin > time)
+ {
+ slotBegin -= 1000000;
+ }
- int millis = (int) (time - slotBegin) / 1000;
+ int millis = (int) (time - slotBegin) / 1000;
- int magic = magic1;
- LogString magicString(magicString1);
+ int magic = magic1;
+ LogString magicString(magicString1);
- if (millis == magic1)
- {
- magic = magic2;
- magicString = magicString2;
- }
+ if (millis == magic1)
+ {
+ magic = magic2;
+ magicString = magicString2;
+ }
- LogString plusMagic;
- formatter->format(plusMagic, slotBegin + magic, pool);
+ LogString plusMagic;
+ formatter->format(plusMagic, slotBegin + magic, pool);
- /**
- * If the string lengths differ then
- * we can't use the cache except for duplicate requests.
- */
- if (plusMagic.length() != formatted.length())
- {
- return UNRECOGNIZED_MILLISECONDS;
- }
- else
- {
- // find first difference between values
- for (LogString::size_type i = 0; i < formatted.length(); i++)
- {
- if (formatted[i] != plusMagic[i])
- {
- //
- // determine the expected digits for the base time
- const logchar abc[] = { 0x41, 0x42, 0x43, 0 };
- LogString formattedMillis(abc);
- millisecondFormat(millis, formattedMillis, 0);
+ /**
+ * If the string lengths differ then
+ * we can't use the cache except for duplicate requests.
+ */
+ if (plusMagic.length() != formatted.length())
+ {
+ return UNRECOGNIZED_MILLISECONDS;
+ }
+ else
+ {
+ // find first difference between values
+ for (LogString::size_type i = 0; i < formatted.length(); i++)
+ {
+ if (formatted[i] != plusMagic[i])
+ {
+ //
+ // determine the expected digits for the base time
+ const logchar abc[] = { 0x41, 0x42, 0x43, 0 };
+ LogString formattedMillis(abc);
+ millisecondFormat(millis, formattedMillis, 0);
- LogString plusZero;
- formatter->format(plusZero, slotBegin, pool);
+ LogString plusZero;
+ formatter->format(plusZero, slotBegin, pool);
- // Test if the next 1..3 characters match the magic string, main problem is that magic
- // available millis in formatted can overlap. Therefore the current i is not always the
- // index of the first millis char, but may be already within the millis. Besides that
- // the millis can occur everywhere in formatted. See LOGCXX-420 and following.
- size_t magicLength = magicString.length();
- size_t overlapping = magicString.find(plusMagic[i]);
- int possibleRetVal = i - overlapping;
+ // Test if the next 1..3 characters match the magic string, main problem is that magic
+ // available millis in formatted can overlap. Therefore the current i is not always the
+ // index of the first millis char, but may be already within the millis. Besides that
+ // the millis can occur everywhere in formatted. See LOGCXX-420 and following.
+ size_t magicLength = magicString.length();
+ size_t overlapping = magicString.find(plusMagic[i]);
+ int possibleRetVal = i - overlapping;
- if (plusZero.length() == formatted.length()
- && regionMatches(magicString, 0, plusMagic, possibleRetVal, magicLength)
- && regionMatches(formattedMillis, 0, formatted, possibleRetVal, magicLength)
- && regionMatches(zeroString, 0, plusZero, possibleRetVal, magicLength)
- // The following will and should fail for patterns with more than one SSS because
- // we only seem to be able to change one SSS in e.g. format and need to reformat the
- // whole string in other cases.
- && (formatted.length() == possibleRetVal + magicLength
- || plusZero.compare(possibleRetVal + magicLength,
- LogString::npos, plusMagic, possibleRetVal + magicLength, LogString::npos) == 0))
- {
- return possibleRetVal;
- }
- else
- {
- return UNRECOGNIZED_MILLISECONDS;
- }
- }
- }
- }
+ if (plusZero.length() == formatted.length()
+ && regionMatches(magicString, 0, plusMagic, possibleRetVal, magicLength)
+ && regionMatches(formattedMillis, 0, formatted, possibleRetVal, magicLength)
+ && regionMatches(zeroString, 0, plusZero, possibleRetVal, magicLength)
+ // The following will and should fail for patterns with more than one SSS because
+ // we only seem to be able to change one SSS in e.g. format and need to reformat the
+ // whole string in other cases.
+ && (formatted.length() == possibleRetVal + magicLength
+ || plusZero.compare(possibleRetVal + magicLength,
+ LogString::npos, plusMagic, possibleRetVal + magicLength, LogString::npos) == 0))
+ {
+ return possibleRetVal;
+ }
+ else
+ {
+ return UNRECOGNIZED_MILLISECONDS;
+ }
+ }
+ }
+ }
- return NO_MILLISECONDS;
+ return NO_MILLISECONDS;
}
@@ -189,69 +189,69 @@
void CachedDateFormat::format(LogString& buf, log4cxx_time_t now, Pool& p) const
{
- //
- // If the current requested time is identical to the previously
- // requested time, then append the cache contents.
- //
- if (now == previousTime)
- {
- buf.append(cache);
- return;
- }
+ //
+ // If the current requested time is identical to the previously
+ // requested time, then append the cache contents.
+ //
+ if (now == previousTime)
+ {
+ buf.append(cache);
+ return;
+ }
- //
- // If millisecond pattern was not unrecognized
- // (that is if it was found or milliseconds did not appear)
- //
- if (millisecondStart != UNRECOGNIZED_MILLISECONDS)
- {
- // Check if the cache is still valid.
- // If the requested time is within the same integral second
- // as the last request and a shorter expiration was not requested.
- if (now < slotBegin + expiration
- && now >= slotBegin
- && now < slotBegin + 1000000L)
- {
- //
- // if there was a millisecond field then update it
- //
- if (millisecondStart >= 0)
- {
- millisecondFormat((int) ((now - slotBegin) / 1000), cache, millisecondStart);
- }
+ //
+ // If millisecond pattern was not unrecognized
+ // (that is if it was found or milliseconds did not appear)
+ //
+ if (millisecondStart != UNRECOGNIZED_MILLISECONDS)
+ {
+ // Check if the cache is still valid.
+ // If the requested time is within the same integral second
+ // as the last request and a shorter expiration was not requested.
+ if (now < slotBegin + expiration
+ && now >= slotBegin
+ && now < slotBegin + 1000000L)
+ {
+ //
+ // if there was a millisecond field then update it
+ //
+ if (millisecondStart >= 0)
+ {
+ millisecondFormat((int) ((now - slotBegin) / 1000), cache, millisecondStart);
+ }
- //
- // update the previously requested time
- // (the slot begin should be unchanged)
- previousTime = now;
- buf.append(cache);
+ //
+ // update the previously requested time
+ // (the slot begin should be unchanged)
+ previousTime = now;
+ buf.append(cache);
- return;
- }
- }
+ return;
+ }
+ }
- //
- // could not use previous value.
- // Call underlying formatter to format date.
- cache.erase(cache.begin(), cache.end());
- formatter->format(cache, now, p);
- buf.append(cache);
- previousTime = now;
- slotBegin = (previousTime / 1000000) * 1000000;
+ //
+ // could not use previous value.
+ // Call underlying formatter to format date.
+ cache.erase(cache.begin(), cache.end());
+ formatter->format(cache, now, p);
+ buf.append(cache);
+ previousTime = now;
+ slotBegin = (previousTime / 1000000) * 1000000;
- if (slotBegin > previousTime)
- {
- slotBegin -= 1000000;
- }
+ if (slotBegin > previousTime)
+ {
+ slotBegin -= 1000000;
+ }
- //
- // if the milliseconds field was previous found
- // then reevaluate in case it moved.
- //
- if (millisecondStart >= 0)
- {
- millisecondStart = findMillisecondStart(now, cache, formatter, p);
- }
+ //
+ // if the milliseconds field was previous found
+ // then reevaluate in case it moved.
+ //
+ if (millisecondStart >= 0)
+ {
+ millisecondStart = findMillisecondStart(now, cache, formatter, p);
+ }
}
/**
@@ -262,12 +262,12 @@
* buffer must be at least offset + 3.
*/
void CachedDateFormat::millisecondFormat(int millis,
- LogString& buf,
- int offset)
+ LogString& buf,
+ int offset)
{
- buf[offset] = digits[millis / 100];
- buf[offset + 1] = digits[(millis / 10) % 10];
- buf[offset + 2] = digits[millis % 10];
+ buf[offset] = digits[millis / 100];
+ buf[offset + 1] = digits[(millis / 10) % 10];
+ buf[offset + 2] = digits[millis % 10];
}
/**
@@ -279,16 +279,16 @@
*/
void CachedDateFormat::setTimeZone(const TimeZonePtr& timeZone)
{
- formatter->setTimeZone(timeZone);
- previousTime = std::numeric_limits<log4cxx_time_t>::min();
- slotBegin = std::numeric_limits<log4cxx_time_t>::min();
+ formatter->setTimeZone(timeZone);
+ previousTime = std::numeric_limits<log4cxx_time_t>::min();
+ slotBegin = std::numeric_limits<log4cxx_time_t>::min();
}
void CachedDateFormat::numberFormat(LogString& s, int n, Pool& p) const
{
- formatter->numberFormat(s, n, p);
+ formatter->numberFormat(s, n, p);
}
@@ -301,29 +301,29 @@
*/
int CachedDateFormat::getMaximumCacheValidity(const LogString& pattern)
{
- //
- // If there are more "S" in the pattern than just one "SSS" then
- // (for example, "HH:mm:ss,SSS SSS"), then set the expiration to
- // one millisecond which should only perform duplicate request caching.
- //
- const logchar S = 0x53;
- const logchar SSS[] = { 0x53, 0x53, 0x53, 0 };
- size_t firstS = pattern.find(S);
- size_t len = pattern.length();
+ //
+ // If there are more "S" in the pattern than just one "SSS" then
+ // (for example, "HH:mm:ss,SSS SSS"), then set the expiration to
+ // one millisecond which should only perform duplicate request caching.
+ //
+ const logchar S = 0x53;
+ const logchar SSS[] = { 0x53, 0x53, 0x53, 0 };
+ size_t firstS = pattern.find(S);
+ size_t len = pattern.length();
- //
- // if there are no S's or
- // three that start with the first S and no fourth S in the string
- //
- if (firstS == LogString::npos ||
- (len >= firstS + 3 && pattern.compare(firstS, 3, SSS) == 0
- && (len == firstS + 3 ||
- pattern.find(S, firstS + 3) == LogString::npos)))
- {
- return 1000000;
- }
+ //
+ // if there are no S's or
+ // three that start with the first S and no fourth S in the string
+ //
+ if (firstS == LogString::npos ||
+ (len >= firstS + 3 && pattern.compare(firstS, 3, SSS) == 0
+ && (len == firstS + 3 ||
+ pattern.find(S, firstS + 3) == LogString::npos)))
+ {
+ return 1000000;
+ }
- return 1000;
+ return 1000;
}
@@ -337,12 +337,12 @@
* @return true if regions are equal.
*/
bool CachedDateFormat::regionMatches(
- const LogString& target,
- size_t toffset,
- const LogString& other,
- size_t ooffset,
- size_t len)
+ const LogString& target,
+ size_t toffset,
+ const LogString& other,
+ size_t ooffset,
+ size_t len)
{
- return target.compare(toffset, len, other, ooffset, len) == 0;
+ return target.compare(toffset, len, other, ooffset, len) == 0;
}
diff --git a/src/main/cpp/charsetdecoder.cpp b/src/main/cpp/charsetdecoder.cpp
index 4598c03..1736414 100644
--- a/src/main/cpp/charsetdecoder.cpp
+++ b/src/main/cpp/charsetdecoder.cpp
@@ -23,7 +23,7 @@
#include <log4cxx/helpers/pool.h>
#include <apr_xlate.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <locale.h>
@@ -50,89 +50,89 @@
*/
class APRCharsetDecoder : public CharsetDecoder
{
- public:
- /**
- * Creates a new instance.
- * @param frompage name of source encoding.
- */
- APRCharsetDecoder(const LogString& frompage) : pool(), mutex(pool)
- {
+ public:
+ /**
+ * Creates a new instance.
+ * @param frompage name of source encoding.
+ */
+ APRCharsetDecoder(const LogString& frompage) : pool(), mutex(pool)
+ {
#if LOG4CXX_LOGCHAR_IS_WCHAR
- const char* topage = "WCHAR_T";
+ const char* topage = "WCHAR_T";
#endif
#if LOG4CXX_LOGCHAR_IS_UTF8
- const char* topage = "UTF-8";
+ const char* topage = "UTF-8";
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- const char* topage = "UTF-16";
+ const char* topage = "UTF-16";
#endif
- std::string fpage(Transcoder::encodeCharsetName(frompage));
- apr_status_t stat = apr_xlate_open(&convset,
- topage,
- fpage.c_str(),
- pool.getAPRPool());
+ std::string fpage(Transcoder::encodeCharsetName(frompage));
+ apr_status_t stat = apr_xlate_open(&convset,
+ topage,
+ fpage.c_str(),
+ pool.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw IllegalArgumentException(frompage);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IllegalArgumentException(frompage);
+ }
+ }
- /**
- * Destructor.
- */
- virtual ~APRCharsetDecoder()
- {
- }
+ /**
+ * Destructor.
+ */
+ virtual ~APRCharsetDecoder()
+ {
+ }
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- enum { BUFSIZE = 256 };
- logchar buf[BUFSIZE];
- const apr_size_t initial_outbytes_left = BUFSIZE * sizeof(logchar);
- apr_status_t stat = APR_SUCCESS;
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ enum { BUFSIZE = 256 };
+ logchar buf[BUFSIZE];
+ const apr_size_t initial_outbytes_left = BUFSIZE * sizeof(logchar);
+ apr_status_t stat = APR_SUCCESS;
- if (in.remaining() == 0)
- {
- size_t outbytes_left = initial_outbytes_left;
- {
- synchronized sync(mutex);
- stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
- NULL, NULL, (char*) buf, &outbytes_left);
- }
- out.append(buf, (initial_outbytes_left - outbytes_left) / sizeof(logchar));
- }
- else
- {
- while (in.remaining() > 0 && stat == APR_SUCCESS)
- {
- size_t inbytes_left = in.remaining();
- size_t initial_inbytes_left = inbytes_left;
- size_t pos = in.position();
- apr_size_t outbytes_left = initial_outbytes_left;
- {
- synchronized sync(mutex);
- stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
- in.data() + pos,
- &inbytes_left,
- (char*) buf,
- &outbytes_left);
- }
- out.append(buf, (initial_outbytes_left - outbytes_left) / sizeof(logchar));
- in.position(pos + (initial_inbytes_left - inbytes_left));
- }
- }
+ if (in.remaining() == 0)
+ {
+ size_t outbytes_left = initial_outbytes_left;
+ {
+ synchronized sync(mutex);
+ stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
+ NULL, NULL, (char*) buf, &outbytes_left);
+ }
+ out.append(buf, (initial_outbytes_left - outbytes_left) / sizeof(logchar));
+ }
+ else
+ {
+ while (in.remaining() > 0 && stat == APR_SUCCESS)
+ {
+ size_t inbytes_left = in.remaining();
+ size_t initial_inbytes_left = inbytes_left;
+ size_t pos = in.position();
+ apr_size_t outbytes_left = initial_outbytes_left;
+ {
+ synchronized sync(mutex);
+ stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
+ in.data() + pos,
+ &inbytes_left,
+ (char*) buf,
+ &outbytes_left);
+ }
+ out.append(buf, (initial_outbytes_left - outbytes_left) / sizeof(logchar));
+ in.position(pos + (initial_inbytes_left - inbytes_left));
+ }
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- APRCharsetDecoder(const APRCharsetDecoder&);
- APRCharsetDecoder& operator=(const APRCharsetDecoder&);
- log4cxx::helpers::Pool pool;
- Mutex mutex;
- apr_xlate_t* convset;
+ private:
+ APRCharsetDecoder(const APRCharsetDecoder&);
+ APRCharsetDecoder& operator=(const APRCharsetDecoder&);
+ log4cxx::helpers::Pool pool;
+ Mutex mutex;
+ apr_xlate_t* convset;
};
#endif
@@ -145,78 +145,78 @@
*/
class MbstowcsCharsetDecoder : public CharsetDecoder
{
- public:
- MbstowcsCharsetDecoder()
- {
- }
+ public:
+ MbstowcsCharsetDecoder()
+ {
+ }
- virtual ~MbstowcsCharsetDecoder()
- {
- }
+ virtual ~MbstowcsCharsetDecoder()
+ {
+ }
- private:
- inline log4cxx_status_t append(LogString& out, const wchar_t* buf)
- {
- out.append(buf);
- return APR_SUCCESS;
- }
+ private:
+ inline log4cxx_status_t append(LogString& out, const wchar_t* buf)
+ {
+ out.append(buf);
+ return APR_SUCCESS;
+ }
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- log4cxx_status_t stat = APR_SUCCESS;
- enum { BUFSIZE = 256 };
- wchar_t buf[BUFSIZE];
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ log4cxx_status_t stat = APR_SUCCESS;
+ enum { BUFSIZE = 256 };
+ wchar_t buf[BUFSIZE];
- mbstate_t mbstate;
- memset(&mbstate, 0, sizeof(mbstate));
+ mbstate_t mbstate;
+ memset(&mbstate, 0, sizeof(mbstate));
- while (in.remaining() > 0)
- {
- size_t requested = in.remaining();
+ while (in.remaining() > 0)
+ {
+ size_t requested = in.remaining();
- if (requested > BUFSIZE - 1)
- {
- requested = BUFSIZE - 1;
- }
+ if (requested > BUFSIZE - 1)
+ {
+ requested = BUFSIZE - 1;
+ }
- memset(buf, 0, BUFSIZE * sizeof(wchar_t));
- const char* src = in.current();
+ memset(buf, 0, BUFSIZE * sizeof(wchar_t));
+ const char* src = in.current();
- if (*src == 0)
- {
- out.append(1, (logchar) 0);
- in.position(in.position() + 1);
- }
- else
- {
- size_t converted = mbsrtowcs(buf,
- &src,
- requested,
- &mbstate);
+ if (*src == 0)
+ {
+ out.append(1, (logchar) 0);
+ in.position(in.position() + 1);
+ }
+ else
+ {
+ size_t converted = mbsrtowcs(buf,
+ &src,
+ requested,
+ &mbstate);
- if (converted == (size_t) -1)
- {
- stat = APR_BADARG;
- in.position(src - in.data());
- break;
- }
- else
- {
- stat = append(out, buf);
- in.position(in.position() + requested);
- }
- }
- }
+ if (converted == (size_t) -1)
+ {
+ stat = APR_BADARG;
+ in.position(src - in.data());
+ break;
+ }
+ else
+ {
+ stat = append(out, buf);
+ in.position(in.position() + requested);
+ }
+ }
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- MbstowcsCharsetDecoder(const MbstowcsCharsetDecoder&);
- MbstowcsCharsetDecoder& operator=(const MbstowcsCharsetDecoder&);
+ private:
+ MbstowcsCharsetDecoder(const MbstowcsCharsetDecoder&);
+ MbstowcsCharsetDecoder& operator=(const MbstowcsCharsetDecoder&);
};
#endif
@@ -228,36 +228,36 @@
*/
class TrivialCharsetDecoder : public CharsetDecoder
{
- public:
- TrivialCharsetDecoder()
- {
- }
+ public:
+ TrivialCharsetDecoder()
+ {
+ }
- virtual ~TrivialCharsetDecoder()
- {
- }
+ virtual ~TrivialCharsetDecoder()
+ {
+ }
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- size_t remaining = in.remaining();
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ size_t remaining = in.remaining();
- if ( remaining > 0)
- {
- const logchar* src = (const logchar*) (in.data() + in.position());
- size_t count = remaining / sizeof(logchar);
- out.append(src, count);
- in.position(in.position() + remaining);
- }
+ if ( remaining > 0)
+ {
+ const logchar* src = (const logchar*) (in.data() + in.position());
+ size_t count = remaining / sizeof(logchar);
+ out.append(src, count);
+ in.position(in.position() + remaining);
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- TrivialCharsetDecoder(const TrivialCharsetDecoder&);
- TrivialCharsetDecoder& operator=(const TrivialCharsetDecoder&);
+ private:
+ TrivialCharsetDecoder(const TrivialCharsetDecoder&);
+ TrivialCharsetDecoder& operator=(const TrivialCharsetDecoder&);
};
@@ -270,49 +270,49 @@
*/
class UTF8CharsetDecoder : public CharsetDecoder
{
- public:
- UTF8CharsetDecoder()
- {
- }
+ public:
+ UTF8CharsetDecoder()
+ {
+ }
- virtual ~UTF8CharsetDecoder()
- {
- }
+ virtual ~UTF8CharsetDecoder()
+ {
+ }
- private:
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- if (in.remaining() > 0)
- {
- std::string tmp(in.current(), in.remaining());
- std::string::const_iterator iter = tmp.begin();
+ private:
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ if (in.remaining() > 0)
+ {
+ std::string tmp(in.current(), in.remaining());
+ std::string::const_iterator iter = tmp.begin();
- while (iter != tmp.end())
- {
- unsigned int sv = Transcoder::decode(tmp, iter);
+ while (iter != tmp.end())
+ {
+ unsigned int sv = Transcoder::decode(tmp, iter);
- if (sv == 0xFFFF)
- {
- size_t offset = iter - tmp.begin();
- in.position(in.position() + offset);
- return APR_BADARG;
- }
- else
- {
- Transcoder::encode(sv, out);
- }
- }
+ if (sv == 0xFFFF)
+ {
+ size_t offset = iter - tmp.begin();
+ in.position(in.position() + offset);
+ return APR_BADARG;
+ }
+ else
+ {
+ Transcoder::encode(sv, out);
+ }
+ }
- in.position(in.limit());
- }
+ in.position(in.limit());
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- UTF8CharsetDecoder(const UTF8CharsetDecoder&);
- UTF8CharsetDecoder& operator=(const UTF8CharsetDecoder&);
+ private:
+ UTF8CharsetDecoder(const UTF8CharsetDecoder&);
+ UTF8CharsetDecoder& operator=(const UTF8CharsetDecoder&);
};
#endif
@@ -322,42 +322,42 @@
*/
class ISOLatinCharsetDecoder : public CharsetDecoder
{
- public:
- ISOLatinCharsetDecoder()
- {
- }
+ public:
+ ISOLatinCharsetDecoder()
+ {
+ }
- virtual ~ISOLatinCharsetDecoder()
- {
- }
+ virtual ~ISOLatinCharsetDecoder()
+ {
+ }
- private:
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- if (in.remaining() > 0)
- {
+ private:
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ if (in.remaining() > 0)
+ {
- const unsigned char* src = (unsigned char*) in.current();
- const unsigned char* srcEnd = src + in.remaining();
+ const unsigned char* src = (unsigned char*) in.current();
+ const unsigned char* srcEnd = src + in.remaining();
- while (src < srcEnd)
- {
- unsigned int sv = *(src++);
- Transcoder::encode(sv, out);
- }
+ while (src < srcEnd)
+ {
+ unsigned int sv = *(src++);
+ Transcoder::encode(sv, out);
+ }
- in.position(in.limit());
- }
+ in.position(in.limit());
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- ISOLatinCharsetDecoder(const ISOLatinCharsetDecoder&);
- ISOLatinCharsetDecoder& operator=(const ISOLatinCharsetDecoder&);
+ private:
+ ISOLatinCharsetDecoder(const ISOLatinCharsetDecoder&);
+ ISOLatinCharsetDecoder& operator=(const ISOLatinCharsetDecoder&);
};
@@ -367,55 +367,55 @@
*/
class USASCIICharsetDecoder : public CharsetDecoder
{
- public:
- USASCIICharsetDecoder()
- {
- }
+ public:
+ USASCIICharsetDecoder()
+ {
+ }
- virtual ~USASCIICharsetDecoder()
- {
- }
+ virtual ~USASCIICharsetDecoder()
+ {
+ }
- private:
+ private:
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- log4cxx_status_t stat = APR_SUCCESS;
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ log4cxx_status_t stat = APR_SUCCESS;
- if (in.remaining() > 0)
- {
+ if (in.remaining() > 0)
+ {
- const unsigned char* src = (unsigned char*) in.current();
- const unsigned char* srcEnd = src + in.remaining();
+ const unsigned char* src = (unsigned char*) in.current();
+ const unsigned char* srcEnd = src + in.remaining();
- while (src < srcEnd)
- {
- unsigned char sv = *src;
+ while (src < srcEnd)
+ {
+ unsigned char sv = *src;
- if (sv < 0x80)
- {
- src++;
- Transcoder::encode(sv, out);
- }
- else
- {
- stat = APR_BADARG;
- break;
- }
- }
+ if (sv < 0x80)
+ {
+ src++;
+ Transcoder::encode(sv, out);
+ }
+ else
+ {
+ stat = APR_BADARG;
+ break;
+ }
+ }
- in.position(src - (const unsigned char*) in.data());
- }
+ in.position(src - (const unsigned char*) in.data());
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- USASCIICharsetDecoder(const USASCIICharsetDecoder&);
- USASCIICharsetDecoder& operator=(const USASCIICharsetDecoder&);
+ private:
+ USASCIICharsetDecoder(const USASCIICharsetDecoder&);
+ USASCIICharsetDecoder& operator=(const USASCIICharsetDecoder&);
};
/**
@@ -424,69 +424,69 @@
*/
class LocaleCharsetDecoder : public CharsetDecoder
{
- public:
- LocaleCharsetDecoder() : pool(), mutex(pool), decoder(), encoding()
- {
- }
- virtual ~LocaleCharsetDecoder()
- {
- }
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out)
- {
- const char* p = in.current();
- size_t i = in.position();
+ public:
+ LocaleCharsetDecoder() : pool(), mutex(pool), decoder(), encoding()
+ {
+ }
+ virtual ~LocaleCharsetDecoder()
+ {
+ }
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out)
+ {
+ const char* p = in.current();
+ size_t i = in.position();
#if !LOG4CXX_CHARSET_EBCDIC
- for (; i < in.limit() && ((unsigned int) *p) < 0x80; i++, p++)
- {
- out.append(1, *p);
- }
+ for (; i < in.limit() && ((unsigned int) *p) < 0x80; i++, p++)
+ {
+ out.append(1, *p);
+ }
- in.position(i);
+ in.position(i);
#endif
- if (i < in.limit())
- {
- Pool subpool;
- const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
- {
- synchronized sync(mutex);
+ if (i < in.limit())
+ {
+ Pool subpool;
+ const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
+ {
+ synchronized sync(mutex);
- if (enc == 0)
- {
- if (decoder == 0)
- {
- encoding = "C";
- decoder = new USASCIICharsetDecoder();
- }
- }
- else if (encoding != enc)
- {
- encoding = enc;
+ if (enc == 0)
+ {
+ if (decoder == 0)
+ {
+ encoding = "C";
+ decoder = new USASCIICharsetDecoder();
+ }
+ }
+ else if (encoding != enc)
+ {
+ encoding = enc;
- try
- {
- LogString e;
- Transcoder::decode(encoding, e);
- decoder = getDecoder(e);
- }
- catch (IllegalArgumentException& ex)
- {
- decoder = new USASCIICharsetDecoder();
- }
- }
- }
- return decoder->decode(in, out);
- }
+ try
+ {
+ LogString e;
+ Transcoder::decode(encoding, e);
+ decoder = getDecoder(e);
+ }
+ catch (IllegalArgumentException& ex)
+ {
+ decoder = new USASCIICharsetDecoder();
+ }
+ }
+ }
+ return decoder->decode(in, out);
+ }
- return APR_SUCCESS;
- }
- private:
- Pool pool;
- Mutex mutex;
- CharsetDecoderPtr decoder;
- std::string encoding;
+ return APR_SUCCESS;
+ }
+ private:
+ Pool pool;
+ Mutex mutex;
+ CharsetDecoderPtr decoder;
+ std::string encoding;
};
@@ -508,83 +508,83 @@
CharsetDecoder* CharsetDecoder::createDefaultDecoder()
{
#if LOG4CXX_CHARSET_UTF8
- return new UTF8CharsetDecoder();
+ return new UTF8CharsetDecoder();
#elif LOG4CXX_CHARSET_ISO88591 || defined(_WIN32_WCE)
- return new ISOLatinCharsetDecoder();
+ return new ISOLatinCharsetDecoder();
#elif LOG4CXX_CHARSET_USASCII
- return new USASCIICharsetDecoder();
+ return new USASCIICharsetDecoder();
#elif LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_MBSRTOWCS
- return new MbstowcsCharsetDecoder();
+ return new MbstowcsCharsetDecoder();
#else
- return new LocaleCharsetDecoder();
+ return new LocaleCharsetDecoder();
#endif
}
CharsetDecoderPtr CharsetDecoder::getDefaultDecoder()
{
- static CharsetDecoderPtr decoder(createDefaultDecoder());
+ static CharsetDecoderPtr decoder(createDefaultDecoder());
- //
- // if invoked after static variable destruction
- // (if logging is called in the destructor of a static object)
- // then create a new decoder.
- //
- if (decoder == 0)
- {
- return createDefaultDecoder();
- }
+ //
+ // if invoked after static variable destruction
+ // (if logging is called in the destructor of a static object)
+ // then create a new decoder.
+ //
+ if (decoder == 0)
+ {
+ return createDefaultDecoder();
+ }
- return decoder;
+ return decoder;
}
CharsetDecoderPtr CharsetDecoder::getUTF8Decoder()
{
- static CharsetDecoderPtr decoder(new UTF8CharsetDecoder());
+ static CharsetDecoderPtr decoder(new UTF8CharsetDecoder());
- //
- // if invoked after static variable destruction
- // (if logging is called in the destructor of a static object)
- // then create a new decoder.
- //
- if (decoder == 0)
- {
- return new UTF8CharsetDecoder();
- }
+ //
+ // if invoked after static variable destruction
+ // (if logging is called in the destructor of a static object)
+ // then create a new decoder.
+ //
+ if (decoder == 0)
+ {
+ return new UTF8CharsetDecoder();
+ }
- return decoder;
+ return decoder;
}
CharsetDecoderPtr CharsetDecoder::getISOLatinDecoder()
{
- return new ISOLatinCharsetDecoder();
+ return new ISOLatinCharsetDecoder();
}
CharsetDecoderPtr CharsetDecoder::getDecoder(const LogString& charset)
{
- if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF8"), LOG4CXX_STR("utf8")))
- {
- return new UTF8CharsetDecoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
- charset == LOG4CXX_STR("646") ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968")))
- {
- return new USASCIICharsetDecoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1")))
- {
- return new ISOLatinCharsetDecoder();
- }
+ if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF8"), LOG4CXX_STR("utf8")))
+ {
+ return new UTF8CharsetDecoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
+ charset == LOG4CXX_STR("646") ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968")))
+ {
+ return new USASCIICharsetDecoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1")))
+ {
+ return new ISOLatinCharsetDecoder();
+ }
#if APR_HAS_XLATE
- return new APRCharsetDecoder(charset);
+ return new APRCharsetDecoder(charset);
#else
- throw IllegalArgumentException(charset);
+ throw IllegalArgumentException(charset);
#endif
}
diff --git a/src/main/cpp/charsetencoder.cpp b/src/main/cpp/charsetencoder.cpp
index 6fb7ab9..6d6e309 100644
--- a/src/main/cpp/charsetencoder.cpp
+++ b/src/main/cpp/charsetencoder.cpp
@@ -23,7 +23,7 @@
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -32,7 +32,7 @@
#include <log4cxx/helpers/synchronized.h>
#ifdef LOG4CXX_HAS_WCSTOMBS
- #include <stdlib.h>
+ #include <stdlib.h>
#endif
using namespace log4cxx;
@@ -52,76 +52,76 @@
*/
class APRCharsetEncoder : public CharsetEncoder
{
- public:
- APRCharsetEncoder(const LogString& topage) : pool(), mutex(pool)
- {
+ public:
+ APRCharsetEncoder(const LogString& topage) : pool(), mutex(pool)
+ {
#if LOG4CXX_LOGCHAR_IS_WCHAR
- const char* frompage = "WCHAR_T";
+ const char* frompage = "WCHAR_T";
#endif
#if LOG4CXX_LOGCHAR_IS_UTF8
- const char* frompage = "UTF-8";
+ const char* frompage = "UTF-8";
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- const char* frompage = "UTF-16";
+ const char* frompage = "UTF-16";
#endif
- std::string tpage(Transcoder::encodeCharsetName(topage));
- apr_status_t stat = apr_xlate_open(&convset,
- tpage.c_str(),
- frompage,
- pool.getAPRPool());
+ std::string tpage(Transcoder::encodeCharsetName(topage));
+ apr_status_t stat = apr_xlate_open(&convset,
+ tpage.c_str(),
+ frompage,
+ pool.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw IllegalArgumentException(topage);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IllegalArgumentException(topage);
+ }
+ }
- virtual ~APRCharsetEncoder()
- {
- }
+ virtual ~APRCharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- apr_status_t stat;
- size_t outbytes_left = out.remaining();
- size_t initial_outbytes_left = outbytes_left;
- size_t position = out.position();
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ apr_status_t stat;
+ size_t outbytes_left = out.remaining();
+ size_t initial_outbytes_left = outbytes_left;
+ size_t position = out.position();
- if (iter == in.end())
- {
- synchronized sync(mutex);
- stat = apr_xlate_conv_buffer(convset, NULL, NULL,
- out.data() + position, &outbytes_left);
- }
- else
- {
- LogString::size_type inOffset = (iter - in.begin());
- apr_size_t inbytes_left =
- (in.size() - inOffset) * sizeof(LogString::value_type);
- apr_size_t initial_inbytes_left = inbytes_left;
- {
- synchronized sync(mutex);
- stat = apr_xlate_conv_buffer(convset,
- (const char*) (in.data() + inOffset),
- &inbytes_left,
- out.data() + position,
- &outbytes_left);
- }
- iter += ((initial_inbytes_left - inbytes_left) / sizeof(LogString::value_type));
- }
+ if (iter == in.end())
+ {
+ synchronized sync(mutex);
+ stat = apr_xlate_conv_buffer(convset, NULL, NULL,
+ out.data() + position, &outbytes_left);
+ }
+ else
+ {
+ LogString::size_type inOffset = (iter - in.begin());
+ apr_size_t inbytes_left =
+ (in.size() - inOffset) * sizeof(LogString::value_type);
+ apr_size_t initial_inbytes_left = inbytes_left;
+ {
+ synchronized sync(mutex);
+ stat = apr_xlate_conv_buffer(convset,
+ (const char*) (in.data() + inOffset),
+ &inbytes_left,
+ out.data() + position,
+ &outbytes_left);
+ }
+ iter += ((initial_inbytes_left - inbytes_left) / sizeof(LogString::value_type));
+ }
- out.position(out.position() + (initial_outbytes_left - outbytes_left));
- return stat;
- }
+ out.position(out.position() + (initial_outbytes_left - outbytes_left));
+ return stat;
+ }
- private:
- APRCharsetEncoder(const APRCharsetEncoder&);
- APRCharsetEncoder& operator=(const APRCharsetEncoder&);
- Pool pool;
- Mutex mutex;
- apr_xlate_t* convset;
+ private:
+ APRCharsetEncoder(const APRCharsetEncoder&);
+ APRCharsetEncoder& operator=(const APRCharsetEncoder&);
+ Pool pool;
+ Mutex mutex;
+ apr_xlate_t* convset;
};
#endif
@@ -131,83 +131,83 @@
*/
class WcstombsCharsetEncoder : public CharsetEncoder
{
- public:
- WcstombsCharsetEncoder()
- {
- }
+ public:
+ WcstombsCharsetEncoder()
+ {
+ }
- /**
- * Converts a wchar_t to the default external multibyte encoding.
- */
- log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- log4cxx_status_t stat = APR_SUCCESS;
+ /**
+ * Converts a wchar_t to the default external multibyte encoding.
+ */
+ log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ log4cxx_status_t stat = APR_SUCCESS;
- if (iter != in.end())
- {
- size_t outbytes_left = out.remaining();
- size_t position = out.position();
- std::wstring::size_type inOffset = (iter - in.begin());
- enum { BUFSIZE = 256 };
- wchar_t buf[BUFSIZE];
- size_t chunkSize = BUFSIZE - 1;
+ if (iter != in.end())
+ {
+ size_t outbytes_left = out.remaining();
+ size_t position = out.position();
+ std::wstring::size_type inOffset = (iter - in.begin());
+ enum { BUFSIZE = 256 };
+ wchar_t buf[BUFSIZE];
+ size_t chunkSize = BUFSIZE - 1;
- if (chunkSize * MB_LEN_MAX > outbytes_left)
- {
- chunkSize = outbytes_left / MB_LEN_MAX;
- }
+ if (chunkSize * MB_LEN_MAX > outbytes_left)
+ {
+ chunkSize = outbytes_left / MB_LEN_MAX;
+ }
- if (chunkSize > in.length() - inOffset)
- {
- chunkSize = in.length() - inOffset;
- }
+ if (chunkSize > in.length() - inOffset)
+ {
+ chunkSize = in.length() - inOffset;
+ }
- memset(buf, 0, BUFSIZE * sizeof(wchar_t));
- memcpy(buf,
- in.data() + inOffset,
- chunkSize * sizeof(wchar_t));
- size_t converted = wcstombs(out.data() + position, buf, outbytes_left);
+ memset(buf, 0, BUFSIZE * sizeof(wchar_t));
+ memcpy(buf,
+ in.data() + inOffset,
+ chunkSize * sizeof(wchar_t));
+ size_t converted = wcstombs(out.data() + position, buf, outbytes_left);
- if (converted == (size_t) -1)
- {
- stat = APR_BADARG;
+ if (converted == (size_t) -1)
+ {
+ stat = APR_BADARG;
- //
- // if unconvertable character was encountered
- // repeatedly halve source to get fragment that
- // can be converted
- for (chunkSize /= 2;
- chunkSize > 0;
- chunkSize /= 2)
- {
- buf[chunkSize] = 0;
- converted = wcstombs(out.data() + position, buf, outbytes_left);
+ //
+ // if unconvertable character was encountered
+ // repeatedly halve source to get fragment that
+ // can be converted
+ for (chunkSize /= 2;
+ chunkSize > 0;
+ chunkSize /= 2)
+ {
+ buf[chunkSize] = 0;
+ converted = wcstombs(out.data() + position, buf, outbytes_left);
- if (converted != (size_t) -1)
- {
- iter += chunkSize;
- out.position(out.position() + converted);
- break;
- }
- }
- }
- else
- {
- iter += chunkSize;
- out.position(out.position() + converted);
- }
- }
+ if (converted != (size_t) -1)
+ {
+ iter += chunkSize;
+ out.position(out.position() + converted);
+ break;
+ }
+ }
+ }
+ else
+ {
+ iter += chunkSize;
+ out.position(out.position() + converted);
+ }
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- WcstombsCharsetEncoder(const WcstombsCharsetEncoder&);
- WcstombsCharsetEncoder& operator=(const WcstombsCharsetEncoder&);
+ private:
+ WcstombsCharsetEncoder(const WcstombsCharsetEncoder&);
+ WcstombsCharsetEncoder& operator=(const WcstombsCharsetEncoder&);
};
#endif
@@ -217,43 +217,43 @@
*/
class USASCIICharsetEncoder : public CharsetEncoder
{
- public:
- USASCIICharsetEncoder()
- {
- }
+ public:
+ USASCIICharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- log4cxx_status_t stat = APR_SUCCESS;
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ log4cxx_status_t stat = APR_SUCCESS;
- if (iter != in.end())
- {
- while (out.remaining() > 0 && iter != in.end())
- {
- LogString::const_iterator prev(iter);
- unsigned int sv = Transcoder::decode(in, iter);
+ if (iter != in.end())
+ {
+ while (out.remaining() > 0 && iter != in.end())
+ {
+ LogString::const_iterator prev(iter);
+ unsigned int sv = Transcoder::decode(in, iter);
- if (sv <= 0x7F)
- {
- out.put((char) sv);
- }
- else
- {
- iter = prev;
- stat = APR_BADARG;
- break;
- }
- }
- }
+ if (sv <= 0x7F)
+ {
+ out.put((char) sv);
+ }
+ else
+ {
+ iter = prev;
+ stat = APR_BADARG;
+ break;
+ }
+ }
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- USASCIICharsetEncoder(const USASCIICharsetEncoder&);
- USASCIICharsetEncoder& operator=(const USASCIICharsetEncoder&);
+ private:
+ USASCIICharsetEncoder(const USASCIICharsetEncoder&);
+ USASCIICharsetEncoder& operator=(const USASCIICharsetEncoder&);
};
/**
@@ -261,43 +261,43 @@
*/
class ISOLatinCharsetEncoder : public CharsetEncoder
{
- public:
- ISOLatinCharsetEncoder()
- {
- }
+ public:
+ ISOLatinCharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- log4cxx_status_t stat = APR_SUCCESS;
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ log4cxx_status_t stat = APR_SUCCESS;
- if (iter != in.end())
- {
- while (out.remaining() > 0 && iter != in.end())
- {
- LogString::const_iterator prev(iter);
- unsigned int sv = Transcoder::decode(in, iter);
+ if (iter != in.end())
+ {
+ while (out.remaining() > 0 && iter != in.end())
+ {
+ LogString::const_iterator prev(iter);
+ unsigned int sv = Transcoder::decode(in, iter);
- if (sv <= 0xFF)
- {
- out.put((char) sv);
- }
- else
- {
- iter = prev;
- stat = APR_BADARG;
- break;
- }
- }
- }
+ if (sv <= 0xFF)
+ {
+ out.put((char) sv);
+ }
+ else
+ {
+ iter = prev;
+ stat = APR_BADARG;
+ break;
+ }
+ }
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- ISOLatinCharsetEncoder(const ISOLatinCharsetEncoder&);
- ISOLatinCharsetEncoder& operator=(const ISOLatinCharsetEncoder&);
+ private:
+ ISOLatinCharsetEncoder(const ISOLatinCharsetEncoder&);
+ ISOLatinCharsetEncoder& operator=(const ISOLatinCharsetEncoder&);
};
/**
@@ -305,38 +305,38 @@
*/
class TrivialCharsetEncoder : public CharsetEncoder
{
- public:
- TrivialCharsetEncoder()
- {
- }
+ public:
+ TrivialCharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- if (iter != in.end())
- {
- size_t requested = in.length() - (iter - in.begin());
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ if (iter != in.end())
+ {
+ size_t requested = in.length() - (iter - in.begin());
- if (requested > out.remaining() / sizeof(logchar))
- {
- requested = out.remaining() / sizeof(logchar);
- }
+ if (requested > out.remaining() / sizeof(logchar))
+ {
+ requested = out.remaining() / sizeof(logchar);
+ }
- memcpy(out.current(),
- (const char*) in.data() + (iter - in.begin()),
- requested * sizeof(logchar));
- iter += requested;
- out.position(out.position() + requested * sizeof(logchar));
- }
+ memcpy(out.current(),
+ (const char*) in.data() + (iter - in.begin()),
+ requested * sizeof(logchar));
+ iter += requested;
+ out.position(out.position() + requested * sizeof(logchar));
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- TrivialCharsetEncoder(const TrivialCharsetEncoder&);
- TrivialCharsetEncoder& operator=(const TrivialCharsetEncoder&);
+ private:
+ TrivialCharsetEncoder(const TrivialCharsetEncoder&);
+ TrivialCharsetEncoder& operator=(const TrivialCharsetEncoder&);
};
#if LOG4CXX_LOGCHAR_IS_UTF8
@@ -347,33 +347,33 @@
*/
class UTF8CharsetEncoder : public CharsetEncoder
{
- public:
- UTF8CharsetEncoder()
- {
- }
+ public:
+ UTF8CharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- while (iter != in.end() && out.remaining() >= 8)
- {
- unsigned int sv = Transcoder::decode(in, iter);
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ while (iter != in.end() && out.remaining() >= 8)
+ {
+ unsigned int sv = Transcoder::decode(in, iter);
- if (sv == 0xFFFF)
- {
- return APR_BADARG;
- }
+ if (sv == 0xFFFF)
+ {
+ return APR_BADARG;
+ }
- Transcoder::encodeUTF8(sv, out);
- }
+ Transcoder::encodeUTF8(sv, out);
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- UTF8CharsetEncoder(const UTF8CharsetEncoder&);
- UTF8CharsetEncoder& operator=(const UTF8CharsetEncoder&);
+ private:
+ UTF8CharsetEncoder(const UTF8CharsetEncoder&);
+ UTF8CharsetEncoder& operator=(const UTF8CharsetEncoder&);
};
#endif
@@ -382,33 +382,33 @@
*/
class UTF16BECharsetEncoder : public CharsetEncoder
{
- public:
- UTF16BECharsetEncoder()
- {
- }
+ public:
+ UTF16BECharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- while (iter != in.end() && out.remaining() >= 4)
- {
- unsigned int sv = Transcoder::decode(in, iter);
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ while (iter != in.end() && out.remaining() >= 4)
+ {
+ unsigned int sv = Transcoder::decode(in, iter);
- if (sv == 0xFFFF)
- {
- return APR_BADARG;
- }
+ if (sv == 0xFFFF)
+ {
+ return APR_BADARG;
+ }
- Transcoder::encodeUTF16BE(sv, out);
- }
+ Transcoder::encodeUTF16BE(sv, out);
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- UTF16BECharsetEncoder(const UTF16BECharsetEncoder&);
- UTF16BECharsetEncoder& operator=(const UTF16BECharsetEncoder&);
+ private:
+ UTF16BECharsetEncoder(const UTF16BECharsetEncoder&);
+ UTF16BECharsetEncoder& operator=(const UTF16BECharsetEncoder&);
};
/**
@@ -416,33 +416,33 @@
*/
class UTF16LECharsetEncoder : public CharsetEncoder
{
- public:
- UTF16LECharsetEncoder()
- {
- }
+ public:
+ UTF16LECharsetEncoder()
+ {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
- while (iter != in.end() && out.remaining() >= 4)
- {
- unsigned int sv = Transcoder::decode(in, iter);
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
+ while (iter != in.end() && out.remaining() >= 4)
+ {
+ unsigned int sv = Transcoder::decode(in, iter);
- if (sv == 0xFFFF)
- {
- return APR_BADARG;
- }
+ if (sv == 0xFFFF)
+ {
+ return APR_BADARG;
+ }
- Transcoder::encodeUTF16LE(sv, out);
- }
+ Transcoder::encodeUTF16LE(sv, out);
+ }
- return APR_SUCCESS;
- }
- private:
- UTF16LECharsetEncoder(const UTF16LECharsetEncoder&);
- UTF16LECharsetEncoder& operator=(const UTF16LECharsetEncoder&);
+ return APR_SUCCESS;
+ }
+ private:
+ UTF16LECharsetEncoder(const UTF16LECharsetEncoder&);
+ UTF16LECharsetEncoder& operator=(const UTF16LECharsetEncoder&);
};
/**
@@ -451,75 +451,75 @@
*/
class LocaleCharsetEncoder : public CharsetEncoder
{
- public:
- LocaleCharsetEncoder() : pool(), mutex(pool), encoder(), encoding()
- {
- }
- virtual ~LocaleCharsetEncoder()
- {
- }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out)
- {
+ public:
+ LocaleCharsetEncoder() : pool(), mutex(pool), encoder(), encoding()
+ {
+ }
+ virtual ~LocaleCharsetEncoder()
+ {
+ }
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out)
+ {
#if !LOG4CXX_CHARSET_EBCDIC
- char* current = out.current();
- size_t remain = out.remaining();
+ char* current = out.current();
+ size_t remain = out.remaining();
- for (;
- iter != in.end() && ((unsigned int) *iter) < 0x80 && remain > 0;
- iter++, remain--, current++)
- {
- *current = *iter;
- }
+ for (;
+ iter != in.end() && ((unsigned int) *iter) < 0x80 && remain > 0;
+ iter++, remain--, current++)
+ {
+ *current = *iter;
+ }
- out.position(current - out.data());
+ out.position(current - out.data());
#endif
- if (iter != in.end() && out.remaining() > 0)
- {
- Pool subpool;
- const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
- {
- synchronized sync(mutex);
+ if (iter != in.end() && out.remaining() > 0)
+ {
+ Pool subpool;
+ const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
+ {
+ synchronized sync(mutex);
- if (enc == 0)
- {
- if (encoder == 0)
- {
- encoding = "C";
- encoder = new USASCIICharsetEncoder();
- }
- }
- else if (encoding != enc)
- {
- encoding = enc;
- LogString ename;
- Transcoder::decode(encoding, ename);
+ if (enc == 0)
+ {
+ if (encoder == 0)
+ {
+ encoding = "C";
+ encoder = new USASCIICharsetEncoder();
+ }
+ }
+ else if (encoding != enc)
+ {
+ encoding = enc;
+ LogString ename;
+ Transcoder::decode(encoding, ename);
- try
- {
- encoder = CharsetEncoder::getEncoder(ename);
- }
- catch (IllegalArgumentException& ex)
- {
- encoder = new USASCIICharsetEncoder();
- }
- }
- }
- return encoder->encode(in, iter, out);
- }
+ try
+ {
+ encoder = CharsetEncoder::getEncoder(ename);
+ }
+ catch (IllegalArgumentException& ex)
+ {
+ encoder = new USASCIICharsetEncoder();
+ }
+ }
+ }
+ return encoder->encode(in, iter, out);
+ }
- return APR_SUCCESS;
- }
+ return APR_SUCCESS;
+ }
- private:
- LocaleCharsetEncoder(const LocaleCharsetEncoder&);
- LocaleCharsetEncoder& operator=(const LocaleCharsetEncoder&);
- Pool pool;
- Mutex mutex;
- CharsetEncoderPtr encoder;
- std::string encoding;
+ private:
+ LocaleCharsetEncoder(const LocaleCharsetEncoder&);
+ LocaleCharsetEncoder& operator=(const LocaleCharsetEncoder&);
+ Pool pool;
+ Mutex mutex;
+ CharsetEncoderPtr encoder;
+ std::string encoding;
};
@@ -539,77 +539,77 @@
CharsetEncoderPtr CharsetEncoder::getDefaultEncoder()
{
- static CharsetEncoderPtr encoder(createDefaultEncoder());
+ static CharsetEncoderPtr encoder(createDefaultEncoder());
- //
- // if invoked after static variable destruction
- // (if logging is called in the destructor of a static object)
- // then create a new decoder.
- //
- if (encoder == 0)
- {
- return createDefaultEncoder();
- }
+ //
+ // if invoked after static variable destruction
+ // (if logging is called in the destructor of a static object)
+ // then create a new decoder.
+ //
+ if (encoder == 0)
+ {
+ return createDefaultEncoder();
+ }
- return encoder;
+ return encoder;
}
CharsetEncoder* CharsetEncoder::createDefaultEncoder()
{
#if LOG4CXX_CHARSET_UTF8
- return new UTF8CharsetEncoder();
+ return new UTF8CharsetEncoder();
#elif LOG4CXX_CHARSET_ISO88591
- return new ISOLatinCharsetEncoder();
+ return new ISOLatinCharsetEncoder();
#elif LOG4CXX_CHARSET_USASCII
- return new USASCIICharsetEncoder();
+ return new USASCIICharsetEncoder();
#elif LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_WCSTOMBS
- return new WcstombsCharsetEncoder();
+ return new WcstombsCharsetEncoder();
#else
- return new LocaleCharsetEncoder();
+ return new LocaleCharsetEncoder();
#endif
}
CharsetEncoderPtr CharsetEncoder::getUTF8Encoder()
{
- return new UTF8CharsetEncoder();
+ return new UTF8CharsetEncoder();
}
CharsetEncoderPtr CharsetEncoder::getEncoder(const LogString& charset)
{
- if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8")))
- {
- return new UTF8CharsetEncoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
- charset == LOG4CXX_STR("646") ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968")))
- {
- return new USASCIICharsetEncoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
- StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1")))
- {
- return new ISOLatinCharsetEncoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16BE"), LOG4CXX_STR("utf-16be"))
- || StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16"), LOG4CXX_STR("utf-16")))
- {
- return new UTF16BECharsetEncoder();
- }
- else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16LE"), LOG4CXX_STR("utf-16le")))
- {
- return new UTF16LECharsetEncoder();
- }
+ if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8")))
+ {
+ return new UTF8CharsetEncoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
+ charset == LOG4CXX_STR("646") ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968")))
+ {
+ return new USASCIICharsetEncoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1")))
+ {
+ return new ISOLatinCharsetEncoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16BE"), LOG4CXX_STR("utf-16be"))
+ || StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16"), LOG4CXX_STR("utf-16")))
+ {
+ return new UTF16BECharsetEncoder();
+ }
+ else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16LE"), LOG4CXX_STR("utf-16le")))
+ {
+ return new UTF16LECharsetEncoder();
+ }
#if APR_HAS_XLATE
- return new APRCharsetEncoder(charset);
+ return new APRCharsetEncoder(charset);
#else
- throw IllegalArgumentException(charset);
+ throw IllegalArgumentException(charset);
#endif
}
@@ -624,24 +624,24 @@
void CharsetEncoder::encode(CharsetEncoderPtr& enc,
- const LogString& src,
- LogString::const_iterator& iter,
- ByteBuffer& dst)
+ const LogString& src,
+ LogString::const_iterator& iter,
+ ByteBuffer& dst)
{
- log4cxx_status_t stat = enc->encode(src, iter, dst);
+ log4cxx_status_t stat = enc->encode(src, iter, dst);
- if (stat != APR_SUCCESS && iter != src.end())
- {
+ if (stat != APR_SUCCESS && iter != src.end())
+ {
#if LOG4CXX_LOGCHAR_IS_WCHAR || LOG4CXX_LOGCHAR_IS_UNICHAR
- iter++;
+ iter++;
#elif LOG4CXX_LOGCHAR_IS_UTF8
- // advance past this character and all continuation characters
- while ((*(++iter) & 0xC0) == 0x80);
+ // advance past this character and all continuation characters
+ while ((*(++iter) & 0xC0) == 0x80);
#else
#error logchar is unrecognized
#endif
- dst.put(Transcoder::LOSSCHAR);
- }
+ dst.put(Transcoder::LOSSCHAR);
+ }
}
diff --git a/src/main/cpp/class.cpp b/src/main/cpp/class.cpp
index 149c150..860ae50 100644
--- a/src/main/cpp/class.cpp
+++ b/src/main/cpp/class.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -27,7 +27,7 @@
#include <log4cxx/helpers/stringhelper.h>
#include <log4cxx/log4cxx.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <log4cxx/rollingfileappender.h>
@@ -39,10 +39,10 @@
#include <log4cxx/fileappender.h>
#include <log4cxx/db/odbcappender.h>
#if defined(WIN32) || defined(_WIN32)
- #if !defined(_WIN32_WCE)
- #include <log4cxx/nt/nteventlogappender.h>
- #endif
- #include <log4cxx/nt/outputdebugstringappender.h>
+ #if !defined(_WIN32_WCE)
+ #include <log4cxx/nt/nteventlogappender.h>
+ #endif
+ #include <log4cxx/nt/outputdebugstringappender.h>
#endif
#include <log4cxx/net/smtpappender.h>
#include <log4cxx/net/socketappender.h>
@@ -91,14 +91,14 @@
LogString Class::toString() const
{
- return getName();
+ return getName();
}
ObjectPtr Class::newInstance() const
{
- throw InstantiationException(LOG4CXX_STR("Cannot create new instances of Class."));
+ throw InstantiationException(LOG4CXX_STR("Cannot create new instances of Class."));
#if LOG4CXX_RETURN_AFTER_THROW
- return 0;
+ return 0;
#endif
}
@@ -106,102 +106,102 @@
Class::ClassMap& Class::getRegistry()
{
- static ClassMap registry;
- return registry;
+ static ClassMap registry;
+ return registry;
}
const Class& Class::forName(const LogString& className)
{
- LogString lowerName(StringHelper::toLowerCase(className));
- //
- // check registry using full class name
- //
- const Class* clazz = getRegistry()[lowerName];
+ LogString lowerName(StringHelper::toLowerCase(className));
+ //
+ // check registry using full class name
+ //
+ const Class* clazz = getRegistry()[lowerName];
- if (clazz == 0)
- {
- LogString::size_type pos = className.find_last_of(LOG4CXX_STR(".$"));
+ if (clazz == 0)
+ {
+ LogString::size_type pos = className.find_last_of(LOG4CXX_STR(".$"));
- if (pos != LogString::npos)
- {
- LogString terminalName(lowerName, pos + 1, LogString::npos);
- clazz = getRegistry()[terminalName];
+ if (pos != LogString::npos)
+ {
+ LogString terminalName(lowerName, pos + 1, LogString::npos);
+ clazz = getRegistry()[terminalName];
- if (clazz == 0)
- {
- registerClasses();
- clazz = getRegistry()[lowerName];
+ if (clazz == 0)
+ {
+ registerClasses();
+ clazz = getRegistry()[lowerName];
- if (clazz == 0)
- {
- clazz = getRegistry()[terminalName];
- }
- }
- }
- else
- {
- registerClasses();
- clazz = getRegistry()[lowerName];
- }
- }
+ if (clazz == 0)
+ {
+ clazz = getRegistry()[terminalName];
+ }
+ }
+ }
+ else
+ {
+ registerClasses();
+ clazz = getRegistry()[lowerName];
+ }
+ }
- if (clazz == 0)
- {
- throw ClassNotFoundException(className);
- }
+ if (clazz == 0)
+ {
+ throw ClassNotFoundException(className);
+ }
- return *clazz;
+ return *clazz;
}
bool Class::registerClass(const Class& newClass)
{
- getRegistry()[StringHelper::toLowerCase(newClass.getName())] = &newClass;
- return true;
+ getRegistry()[StringHelper::toLowerCase(newClass.getName())] = &newClass;
+ return true;
}
void Class::registerClasses()
{
#if APR_HAS_THREADS
- AsyncAppender::registerClass();
+ AsyncAppender::registerClass();
#endif
- ConsoleAppender::registerClass();
- FileAppender::registerClass();
- log4cxx::db::ODBCAppender::registerClass();
+ ConsoleAppender::registerClass();
+ FileAppender::registerClass();
+ log4cxx::db::ODBCAppender::registerClass();
#if (defined(WIN32) || defined(_WIN32))
#if !defined(_WIN32_WCE)
- log4cxx::nt::NTEventLogAppender::registerClass();
+ log4cxx::nt::NTEventLogAppender::registerClass();
#endif
- log4cxx::nt::OutputDebugStringAppender::registerClass();
+ log4cxx::nt::OutputDebugStringAppender::registerClass();
#endif
- log4cxx::RollingFileAppender::registerClass();
- SMTPAppender::registerClass();
- SocketAppender::registerClass();
+ log4cxx::RollingFileAppender::registerClass();
+ SMTPAppender::registerClass();
+ SocketAppender::registerClass();
#if APR_HAS_THREADS
- SocketHubAppender::registerClass();
+ SocketHubAppender::registerClass();
#endif
- SyslogAppender::registerClass();
+ SyslogAppender::registerClass();
#if APR_HAS_THREADS
- TelnetAppender::registerClass();
+ TelnetAppender::registerClass();
#endif
- XMLSocketAppender::registerClass();
- DateLayout::registerClass();
- HTMLLayout::registerClass();
- PatternLayout::registerClass();
- SimpleLayout::registerClass();
- TTCCLayout::registerClass();
- XMLLayout::registerClass();
- LevelMatchFilter::registerClass();
- LevelRangeFilter::registerClass();
- StringMatchFilter::registerClass();
- log4cxx::RollingFileAppender::registerClass();
- log4cxx::rolling::RollingFileAppender::registerClass();
- DailyRollingFileAppender::registerClass();
- log4cxx::rolling::SizeBasedTriggeringPolicy::registerClass();
- log4cxx::rolling::TimeBasedRollingPolicy::registerClass();
- log4cxx::rolling::ManualTriggeringPolicy::registerClass();
- log4cxx::rolling::FixedWindowRollingPolicy::registerClass();
- log4cxx::rolling::FilterBasedTriggeringPolicy::registerClass();
- log4cxx::xml::DOMConfigurator::registerClass();
- log4cxx::PropertyConfigurator::registerClass();
+ XMLSocketAppender::registerClass();
+ DateLayout::registerClass();
+ HTMLLayout::registerClass();
+ PatternLayout::registerClass();
+ SimpleLayout::registerClass();
+ TTCCLayout::registerClass();
+ XMLLayout::registerClass();
+ LevelMatchFilter::registerClass();
+ LevelRangeFilter::registerClass();
+ StringMatchFilter::registerClass();
+ log4cxx::RollingFileAppender::registerClass();
+ log4cxx::rolling::RollingFileAppender::registerClass();
+ DailyRollingFileAppender::registerClass();
+ log4cxx::rolling::SizeBasedTriggeringPolicy::registerClass();
+ log4cxx::rolling::TimeBasedRollingPolicy::registerClass();
+ log4cxx::rolling::ManualTriggeringPolicy::registerClass();
+ log4cxx::rolling::FixedWindowRollingPolicy::registerClass();
+ log4cxx::rolling::FilterBasedTriggeringPolicy::registerClass();
+ log4cxx::xml::DOMConfigurator::registerClass();
+ log4cxx::PropertyConfigurator::registerClass();
}
diff --git a/src/main/cpp/classnamepatternconverter.cpp b/src/main/cpp/classnamepatternconverter.cpp
index 75a1730..7d9c72e 100644
--- a/src/main/cpp/classnamepatternconverter.cpp
+++ b/src/main/cpp/classnamepatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -32,30 +32,30 @@
IMPLEMENT_LOG4CXX_OBJECT(ClassNamePatternConverter)
ClassNamePatternConverter::ClassNamePatternConverter(
- const std::vector<LogString>& options) :
- NamePatternConverter(LOG4CXX_STR("Class Name"),
- LOG4CXX_STR("class name"), options)
+ const std::vector<LogString>& options) :
+ NamePatternConverter(LOG4CXX_STR("Class Name"),
+ LOG4CXX_STR("class name"), options)
{
}
PatternConverterPtr ClassNamePatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() == 0)
- {
- static PatternConverterPtr def(new ClassNamePatternConverter(options));
- return def;
- }
+ if (options.size() == 0)
+ {
+ static PatternConverterPtr def(new ClassNamePatternConverter(options));
+ return def;
+ }
- return new ClassNamePatternConverter(options);
+ return new ClassNamePatternConverter(options);
}
void ClassNamePatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- int initialLength = toAppendTo.length();
- append(toAppendTo, event->getLocationInformation().getClassName());
- abbreviate(initialLength, toAppendTo);
+ int initialLength = toAppendTo.length();
+ append(toAppendTo, event->getLocationInformation().getClassName());
+ abbreviate(initialLength, toAppendTo);
}
diff --git a/src/main/cpp/classregistration.cpp b/src/main/cpp/classregistration.cpp
index b5678d9..975474e 100644
--- a/src/main/cpp/classregistration.cpp
+++ b/src/main/cpp/classregistration.cpp
@@ -23,7 +23,7 @@
ClassRegistration::ClassRegistration(ClassAccessor accessor)
{
- Class::registerClass((*accessor)());
+ Class::registerClass((*accessor)());
}
diff --git a/src/main/cpp/condition.cpp b/src/main/cpp/condition.cpp
index b8b5ec1..9970f27 100644
--- a/src/main/cpp/condition.cpp
+++ b/src/main/cpp/condition.cpp
@@ -30,12 +30,12 @@
Condition::Condition(Pool& p)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_cond_create(&condition, p.getAPRPool());
+ apr_status_t stat = apr_thread_cond_create(&condition, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw RuntimeException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw RuntimeException(stat);
+ }
#endif
}
@@ -43,16 +43,16 @@
Condition::~Condition()
{
#if APR_HAS_THREADS
- apr_thread_cond_destroy(condition);
+ apr_thread_cond_destroy(condition);
#endif
}
log4cxx_status_t Condition::signalAll()
{
#if APR_HAS_THREADS
- return apr_thread_cond_broadcast(condition);
+ return apr_thread_cond_broadcast(condition);
#else
- return APR_SUCCESS;
+ return APR_SUCCESS;
#endif
}
@@ -60,19 +60,19 @@
{
#if APR_HAS_THREADS
- if (Thread::interrupted())
- {
- throw InterruptedException();
- }
+ if (Thread::interrupted())
+ {
+ throw InterruptedException();
+ }
- apr_status_t stat = apr_thread_cond_wait(
- condition,
- mutex.getAPRMutex());
+ apr_status_t stat = apr_thread_cond_wait(
+ condition,
+ mutex.getAPRMutex());
- if (stat != APR_SUCCESS)
- {
- throw InterruptedException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw InterruptedException(stat);
+ }
#endif
}
diff --git a/src/main/cpp/consoleappender.cpp b/src/main/cpp/consoleappender.cpp
index 3fdc79e..c81661d 100644
--- a/src/main/cpp/consoleappender.cpp
+++ b/src/main/cpp/consoleappender.cpp
@@ -28,106 +28,106 @@
IMPLEMENT_LOG4CXX_OBJECT(ConsoleAppender)
ConsoleAppender::ConsoleAppender()
- : target(getSystemOut())
+ : target(getSystemOut())
{
}
ConsoleAppender::ConsoleAppender(const LayoutPtr& layout1)
- : target(getSystemOut())
+ : target(getSystemOut())
{
- setLayout(layout1);
- Pool p;
- WriterPtr writer1(new SystemOutWriter());
- setWriter(writer1);
- WriterAppender::activateOptions(p);
+ setLayout(layout1);
+ Pool p;
+ WriterPtr writer1(new SystemOutWriter());
+ setWriter(writer1);
+ WriterAppender::activateOptions(p);
}
ConsoleAppender::ConsoleAppender(const LayoutPtr& layout1, const LogString& target1)
- : target(target1)
+ : target(target1)
{
- setLayout(layout1);
- Pool p;
- ConsoleAppender::activateOptions(p);
+ setLayout(layout1);
+ Pool p;
+ ConsoleAppender::activateOptions(p);
}
ConsoleAppender::~ConsoleAppender()
{
- finalize();
+ finalize();
}
const LogString& ConsoleAppender::getSystemOut()
{
- static const LogString name(LOG4CXX_STR("System.out"));
- return name;
+ static const LogString name(LOG4CXX_STR("System.out"));
+ return name;
}
const LogString& ConsoleAppender::getSystemErr()
{
- static const LogString name(LOG4CXX_STR("System.err"));
- return name;
+ static const LogString name(LOG4CXX_STR("System.err"));
+ return name;
}
void ConsoleAppender::setTarget(const LogString& value)
{
- LogString v = StringHelper::trim(value);
+ LogString v = StringHelper::trim(value);
- if (StringHelper::equalsIgnoreCase(v,
- LOG4CXX_STR("SYSTEM.OUT"), LOG4CXX_STR("system.out")))
- {
- target = getSystemOut();
- }
- else if (StringHelper::equalsIgnoreCase(v,
- LOG4CXX_STR("SYSTEM.ERR"), LOG4CXX_STR("system.err")))
- {
- target = getSystemErr();
- }
- else
- {
- targetWarn(value);
- }
+ if (StringHelper::equalsIgnoreCase(v,
+ LOG4CXX_STR("SYSTEM.OUT"), LOG4CXX_STR("system.out")))
+ {
+ target = getSystemOut();
+ }
+ else if (StringHelper::equalsIgnoreCase(v,
+ LOG4CXX_STR("SYSTEM.ERR"), LOG4CXX_STR("system.err")))
+ {
+ target = getSystemErr();
+ }
+ else
+ {
+ targetWarn(value);
+ }
}
LogString ConsoleAppender::getTarget() const
{
- return target;
+ return target;
}
void ConsoleAppender::targetWarn(const LogString& val)
{
- LogLog::warn(((LogString) LOG4CXX_STR("["))
- + val + LOG4CXX_STR("] should be system.out or system.err."));
- LogLog::warn(LOG4CXX_STR("Using previously set target, System.out by default."));
+ LogLog::warn(((LogString) LOG4CXX_STR("["))
+ + val + LOG4CXX_STR("] should be system.out or system.err."));
+ LogLog::warn(LOG4CXX_STR("Using previously set target, System.out by default."));
}
void ConsoleAppender::activateOptions(Pool& p)
{
- if (StringHelper::equalsIgnoreCase(target,
- LOG4CXX_STR("SYSTEM.OUT"), LOG4CXX_STR("system.out")))
- {
- WriterPtr writer1(new SystemOutWriter());
- setWriter(writer1);
- }
- else if (StringHelper::equalsIgnoreCase(target,
- LOG4CXX_STR("SYSTEM.ERR"), LOG4CXX_STR("system.err")))
- {
- WriterPtr writer1(new SystemErrWriter());
- setWriter(writer1);
- }
+ if (StringHelper::equalsIgnoreCase(target,
+ LOG4CXX_STR("SYSTEM.OUT"), LOG4CXX_STR("system.out")))
+ {
+ WriterPtr writer1(new SystemOutWriter());
+ setWriter(writer1);
+ }
+ else if (StringHelper::equalsIgnoreCase(target,
+ LOG4CXX_STR("SYSTEM.ERR"), LOG4CXX_STR("system.err")))
+ {
+ WriterPtr writer1(new SystemErrWriter());
+ setWriter(writer1);
+ }
- WriterAppender::activateOptions(p);
+ WriterAppender::activateOptions(p);
}
void ConsoleAppender::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("TARGET"), LOG4CXX_STR("target")))
- {
- setTarget(value);
- }
- else
- {
- WriterAppender::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("TARGET"), LOG4CXX_STR("target")))
+ {
+ setTarget(value);
+ }
+ else
+ {
+ WriterAppender::setOption(option, value);
+ }
}
diff --git a/src/main/cpp/cyclicbuffer.cpp b/src/main/cpp/cyclicbuffer.cpp
index 0be9cdd..9f4a9a0 100644
--- a/src/main/cpp/cyclicbuffer.cpp
+++ b/src/main/cpp/cyclicbuffer.cpp
@@ -32,16 +32,16 @@
@param maxSize The maximum number of elements in the buffer.
*/
CyclicBuffer::CyclicBuffer(int maxSize1)
- : ea(maxSize1), first(0), last(0), numElems(0), maxSize(maxSize1)
+ : ea(maxSize1), first(0), last(0), numElems(0), maxSize(maxSize1)
{
- if (maxSize1 < 1)
- {
- LogString msg(LOG4CXX_STR("The maxSize argument ("));
- Pool p;
- StringHelper::toString(maxSize1, p, msg);
- msg.append(LOG4CXX_STR(") is not a positive integer."));
- throw IllegalArgumentException(msg);
- }
+ if (maxSize1 < 1)
+ {
+ LogString msg(LOG4CXX_STR("The maxSize argument ("));
+ Pool p;
+ StringHelper::toString(maxSize1, p, msg);
+ msg.append(LOG4CXX_STR(") is not a positive integer."));
+ throw IllegalArgumentException(msg);
+ }
}
CyclicBuffer::~CyclicBuffer()
@@ -53,21 +53,21 @@
*/
void CyclicBuffer::add(const spi::LoggingEventPtr& event)
{
- ea[last] = event;
+ ea[last] = event;
- if (++last == maxSize)
- {
- last = 0;
- }
+ if (++last == maxSize)
+ {
+ last = 0;
+ }
- if (numElems < maxSize)
- {
- numElems++;
- }
- else if (++first == maxSize)
- {
- first = 0;
- }
+ if (numElems < maxSize)
+ {
+ numElems++;
+ }
+ else if (++first == maxSize)
+ {
+ first = 0;
+ }
}
@@ -78,12 +78,12 @@
*/
spi::LoggingEventPtr CyclicBuffer::get(int i)
{
- if (i < 0 || i >= numElems)
- {
- return 0;
- }
+ if (i < 0 || i >= numElems)
+ {
+ return 0;
+ }
- return ea[(first + i) % maxSize];
+ return ea[(first + i) % maxSize];
}
/**
@@ -92,21 +92,21 @@
*/
spi::LoggingEventPtr CyclicBuffer::get()
{
- LoggingEventPtr r;
+ LoggingEventPtr r;
- if (numElems > 0)
- {
- numElems--;
- r = ea[first];
- ea[first] = 0;
+ if (numElems > 0)
+ {
+ numElems--;
+ r = ea[first];
+ ea[first] = 0;
- if (++first == maxSize)
- {
- first = 0;
- }
- }
+ if (++first == maxSize)
+ {
+ first = 0;
+ }
+ }
- return r;
+ return r;
}
/**
@@ -115,47 +115,47 @@
*/
void CyclicBuffer::resize(int newSize)
{
- if (newSize < 0)
- {
- LogString msg(LOG4CXX_STR("Negative array size ["));
- Pool p;
- StringHelper::toString(newSize, p, msg);
- msg.append(LOG4CXX_STR("] not allowed."));
- throw IllegalArgumentException(msg);
- }
+ if (newSize < 0)
+ {
+ LogString msg(LOG4CXX_STR("Negative array size ["));
+ Pool p;
+ StringHelper::toString(newSize, p, msg);
+ msg.append(LOG4CXX_STR("] not allowed."));
+ throw IllegalArgumentException(msg);
+ }
- if (newSize == numElems)
- {
- return; // nothing to do
- }
+ if (newSize == numElems)
+ {
+ return; // nothing to do
+ }
- LoggingEventList temp(newSize);
+ LoggingEventList temp(newSize);
- int loopLen = newSize < numElems ? newSize : numElems;
- int i;
+ int loopLen = newSize < numElems ? newSize : numElems;
+ int i;
- for (i = 0; i < loopLen; i++)
- {
- temp[i] = ea[first];
- ea[first] = 0;
+ for (i = 0; i < loopLen; i++)
+ {
+ temp[i] = ea[first];
+ ea[first] = 0;
- if (++first == numElems)
- {
- first = 0;
- }
- }
+ if (++first == numElems)
+ {
+ first = 0;
+ }
+ }
- ea = temp;
- first = 0;
- numElems = loopLen;
- maxSize = newSize;
+ ea = temp;
+ first = 0;
+ numElems = loopLen;
+ maxSize = newSize;
- if (loopLen == newSize)
- {
- last = 0;
- }
- else
- {
- last = loopLen;
- }
+ if (loopLen == newSize)
+ {
+ last = 0;
+ }
+ else
+ {
+ last = loopLen;
+ }
}
diff --git a/src/main/cpp/dailyrollingfileappender.cpp b/src/main/cpp/dailyrollingfileappender.cpp
index 390271c..6f57cc3 100644
--- a/src/main/cpp/dailyrollingfileappender.cpp
+++ b/src/main/cpp/dailyrollingfileappender.cpp
@@ -37,85 +37,85 @@
DailyRollingFileAppender::DailyRollingFileAppender(
- const LayoutPtr& l,
- const LogString& filename,
- const LogString& datePattern1)
- : datePattern(datePattern1)
+ const LayoutPtr& l,
+ const LogString& filename,
+ const LogString& datePattern1)
+ : datePattern(datePattern1)
{
- setLayout(l);
- setFile(filename);
- Pool p;
- activateOptions(p);
+ setLayout(l);
+ setFile(filename);
+ Pool p;
+ activateOptions(p);
}
void DailyRollingFileAppender::setDatePattern(const LogString& newPattern)
{
- datePattern = newPattern;
+ datePattern = newPattern;
}
LogString DailyRollingFileAppender::getDatePattern()
{
- return datePattern;
+ return datePattern;
}
void DailyRollingFileAppender::activateOptions(log4cxx::helpers::Pool& p)
{
- TimeBasedRollingPolicyPtr policy = new TimeBasedRollingPolicy();
- LogString pattern(getFile());
- bool inLiteral = false;
- bool inPattern = false;
+ TimeBasedRollingPolicyPtr policy = new TimeBasedRollingPolicy();
+ LogString pattern(getFile());
+ bool inLiteral = false;
+ bool inPattern = false;
- for (size_t i = 0; i < datePattern.length(); i++)
- {
- if (datePattern[i] == 0x27 /* '\'' */)
- {
- inLiteral = !inLiteral;
+ for (size_t i = 0; i < datePattern.length(); i++)
+ {
+ if (datePattern[i] == 0x27 /* '\'' */)
+ {
+ inLiteral = !inLiteral;
- if (inLiteral && inPattern)
- {
- pattern.append(1, (logchar) 0x7D /* '}' */);
- inPattern = false;
- }
- }
- else
- {
- if (!inLiteral && !inPattern)
- {
- const logchar dbrace[] = { 0x25, 0x64, 0x7B, 0 }; // "%d{"
- pattern.append(dbrace);
- inPattern = true;
- }
+ if (inLiteral && inPattern)
+ {
+ pattern.append(1, (logchar) 0x7D /* '}' */);
+ inPattern = false;
+ }
+ }
+ else
+ {
+ if (!inLiteral && !inPattern)
+ {
+ const logchar dbrace[] = { 0x25, 0x64, 0x7B, 0 }; // "%d{"
+ pattern.append(dbrace);
+ inPattern = true;
+ }
- pattern.append(1, datePattern[i]);
- }
- }
+ pattern.append(1, datePattern[i]);
+ }
+ }
- if (inPattern)
- {
- pattern.append(1, (logchar) 0x7D /* '}' */);
- }
+ if (inPattern)
+ {
+ pattern.append(1, (logchar) 0x7D /* '}' */);
+ }
- policy->setFileNamePattern(pattern);
- policy->activateOptions(p);
- setTriggeringPolicy(policy);
- setRollingPolicy(policy);
+ policy->setFileNamePattern(pattern);
+ policy->activateOptions(p);
+ setTriggeringPolicy(policy);
+ setRollingPolicy(policy);
- RollingFileAppenderSkeleton::activateOptions(p);
+ RollingFileAppenderSkeleton::activateOptions(p);
}
void DailyRollingFileAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("DATEPATTERN"), LOG4CXX_STR("datepattern")))
- {
- setDatePattern(value);
- }
- else
- {
- RollingFileAppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("DATEPATTERN"), LOG4CXX_STR("datepattern")))
+ {
+ setDatePattern(value);
+ }
+ else
+ {
+ RollingFileAppenderSkeleton::setOption(option, value);
+ }
}
diff --git a/src/main/cpp/datagrampacket.cpp b/src/main/cpp/datagrampacket.cpp
index 0b6710b..a9577ec 100644
--- a/src/main/cpp/datagrampacket.cpp
+++ b/src/main/cpp/datagrampacket.cpp
@@ -25,7 +25,7 @@
/** Constructs a DatagramPacket for receiving packets of length
<code>length</code>. */
DatagramPacket::DatagramPacket(void* buf1, int length1)
- : buf(buf1), offset(0), length(length1), address(), port(0)
+ : buf(buf1), offset(0), length(length1), address(), port(0)
{
}
@@ -33,23 +33,23 @@
<code>length/<code> to the specified port number on the specified
host. */
DatagramPacket::DatagramPacket(void* buf1, int length1, InetAddressPtr address1,
- int port1)
- : buf(buf1), offset(0), length(length1), address(address1), port(port1)
+ int port1)
+ : buf(buf1), offset(0), length(length1), address(address1), port(port1)
{
}
/** Constructs a DatagramPacket for receiving packets of length
<code>length</code>, specifying an offset into the buffer. */
DatagramPacket::DatagramPacket(void* buf1, int offset1, int length1)
- : buf(buf1), offset(offset1), length(length1), address(), port(0)
+ : buf(buf1), offset(offset1), length(length1), address(), port(0)
{
}
/** Constructs a datagram packet for sending packets of length
<code>length</code> with offset <code>offset</code> to the
specified port number on the specified host. */
DatagramPacket::DatagramPacket(void* buf1, int offset1, int length1,
- InetAddressPtr address1, int port1)
- : buf(buf1), offset(offset1), length(length1), address(address1), port(port1)
+ InetAddressPtr address1, int port1)
+ : buf(buf1), offset(offset1), length(length1), address(address1), port(port1)
{
}
diff --git a/src/main/cpp/datagramsocket.cpp b/src/main/cpp/datagramsocket.cpp
index 14636fe..4b2a1f8 100644
--- a/src/main/cpp/datagramsocket.cpp
+++ b/src/main/cpp/datagramsocket.cpp
@@ -28,180 +28,180 @@
IMPLEMENT_LOG4CXX_OBJECT(DatagramSocket)
DatagramSocket::DatagramSocket()
- : socket(0), address(), localAddress(), port(0), localPort(0)
+ : socket(0), address(), localAddress(), port(0), localPort(0)
{
- create();
+ create();
}
DatagramSocket::DatagramSocket(int localPort1)
- : socket(0), address(), localAddress(), port(0), localPort(0)
+ : socket(0), address(), localAddress(), port(0), localPort(0)
{
- InetAddressPtr bindAddr = InetAddress::anyAddress();
+ InetAddressPtr bindAddr = InetAddress::anyAddress();
- create();
- bind(localPort1, bindAddr);
+ create();
+ bind(localPort1, bindAddr);
}
DatagramSocket::DatagramSocket(int localPort1, InetAddressPtr localAddress1)
- : socket(0), address(), localAddress(), port(0), localPort(0)
+ : socket(0), address(), localAddress(), port(0), localPort(0)
{
- create();
- bind(localPort1, localAddress1);
+ create();
+ bind(localPort1, localAddress1);
}
DatagramSocket::~DatagramSocket()
{
- try
- {
- close();
- }
- catch (SocketException&)
- {
- }
+ try
+ {
+ close();
+ }
+ catch (SocketException&)
+ {
+ }
}
/** Binds a datagram socket to a local port and address.*/
void DatagramSocket::bind(int localPort1, InetAddressPtr localAddress1)
{
- Pool addrPool;
+ Pool addrPool;
- // Create server socket address (including port number)
- LOG4CXX_ENCODE_CHAR(hostAddr, localAddress1->getHostAddress());
- apr_sockaddr_t* server_addr;
- apr_status_t status =
- apr_sockaddr_info_get(&server_addr, hostAddr.c_str(), APR_INET,
- localPort1, 0, addrPool.getAPRPool());
+ // Create server socket address (including port number)
+ LOG4CXX_ENCODE_CHAR(hostAddr, localAddress1->getHostAddress());
+ apr_sockaddr_t* server_addr;
+ apr_status_t status =
+ apr_sockaddr_info_get(&server_addr, hostAddr.c_str(), APR_INET,
+ localPort1, 0, addrPool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw BindException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw BindException(status);
+ }
- // bind the socket to the address
- status = apr_socket_bind(socket, server_addr);
+ // bind the socket to the address
+ status = apr_socket_bind(socket, server_addr);
- if (status != APR_SUCCESS)
- {
- throw BindException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw BindException(status);
+ }
- this->localPort = localPort1;
- this->localAddress = localAddress1;
+ this->localPort = localPort1;
+ this->localAddress = localAddress1;
}
/** Close the socket.*/
void DatagramSocket::close()
{
- if (socket != 0)
- {
- apr_status_t status = apr_socket_close(socket);
+ if (socket != 0)
+ {
+ apr_status_t status = apr_socket_close(socket);
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- socket = 0;
- localPort = 0;
- }
+ socket = 0;
+ localPort = 0;
+ }
}
void DatagramSocket::connect(InetAddressPtr address1, int port1)
{
- this->address = address1;
- this->port = port1;
+ this->address = address1;
+ this->port = port1;
- Pool addrPool;
+ Pool addrPool;
- // create socket address
- LOG4CXX_ENCODE_CHAR(hostAddr, address1->getHostAddress());
- apr_sockaddr_t* client_addr;
- apr_status_t status =
- apr_sockaddr_info_get(&client_addr, hostAddr.c_str(), APR_INET,
- port, 0, addrPool.getAPRPool());
+ // create socket address
+ LOG4CXX_ENCODE_CHAR(hostAddr, address1->getHostAddress());
+ apr_sockaddr_t* client_addr;
+ apr_status_t status =
+ apr_sockaddr_info_get(&client_addr, hostAddr.c_str(), APR_INET,
+ port, 0, addrPool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw ConnectException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw ConnectException(status);
+ }
- // connect the socket
- status = apr_socket_connect(socket, client_addr);
+ // connect the socket
+ status = apr_socket_connect(socket, client_addr);
- if (status != APR_SUCCESS)
- {
- throw ConnectException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw ConnectException(status);
+ }
}
/** Creates a datagram socket.*/
void DatagramSocket::create()
{
- apr_socket_t* newSocket;
- apr_status_t status =
- apr_socket_create(&newSocket, APR_INET, SOCK_DGRAM,
- APR_PROTO_UDP, socketPool.getAPRPool());
- socket = newSocket;
+ apr_socket_t* newSocket;
+ apr_status_t status =
+ apr_socket_create(&newSocket, APR_INET, SOCK_DGRAM,
+ APR_PROTO_UDP, socketPool.getAPRPool());
+ socket = newSocket;
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
}
/** Receive the datagram packet.*/
void DatagramSocket::receive(DatagramPacketPtr& p)
{
- Pool addrPool;
+ Pool addrPool;
- // Create the address from which to receive the datagram packet
- LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress());
- apr_sockaddr_t* addr;
- apr_status_t status =
- apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET,
- p->getPort(), 0, addrPool.getAPRPool());
+ // Create the address from which to receive the datagram packet
+ LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress());
+ apr_sockaddr_t* addr;
+ apr_status_t status =
+ apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET,
+ p->getPort(), 0, addrPool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- // receive the datagram packet
- apr_size_t len = p->getLength();
- status = apr_socket_recvfrom(addr, socket, 0,
- (char*)p->getData(), &len);
+ // receive the datagram packet
+ apr_size_t len = p->getLength();
+ status = apr_socket_recvfrom(addr, socket, 0,
+ (char*)p->getData(), &len);
- if (status != APR_SUCCESS)
- {
- throw IOException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw IOException(status);
+ }
}
/** Sends a datagram packet.*/
void DatagramSocket::send(DatagramPacketPtr& p)
{
- Pool addrPool;
+ Pool addrPool;
- // create the adress to which to send the datagram packet
- LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress());
- apr_sockaddr_t* addr;
- apr_status_t status =
- apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET, p->getPort(),
- 0, addrPool.getAPRPool());
+ // create the adress to which to send the datagram packet
+ LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress());
+ apr_sockaddr_t* addr;
+ apr_status_t status =
+ apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET, p->getPort(),
+ 0, addrPool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- // send the datagram packet
- apr_size_t len = p->getLength();
- status = apr_socket_sendto(socket, addr, 0,
- (char*)p->getData(), &len);
+ // send the datagram packet
+ apr_size_t len = p->getLength();
+ status = apr_socket_sendto(socket, addr, 0,
+ (char*)p->getData(), &len);
- if (status != APR_SUCCESS)
- {
- throw IOException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw IOException(status);
+ }
}
diff --git a/src/main/cpp/date.cpp b/src/main/cpp/date.cpp
index 1beddc2..a1ea7ce 100644
--- a/src/main/cpp/date.cpp
+++ b/src/main/cpp/date.cpp
@@ -19,7 +19,7 @@
#include <apr_time.h>
#ifndef INT64_C
- #define INT64_C(x) x ## LL
+ #define INT64_C(x) x ## LL
#endif
using namespace log4cxx;
@@ -41,16 +41,16 @@
log4cxx_time_t Date::getMicrosecondsPerDay()
{
- return APR_INT64_C(86400000000);
+ return APR_INT64_C(86400000000);
}
log4cxx_time_t Date::getMicrosecondsPerSecond()
{
- return APR_USEC_PER_SEC;
+ return APR_USEC_PER_SEC;
}
log4cxx_time_t Date::getNextSecond() const
{
- return ((time / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
+ return ((time / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
}
diff --git a/src/main/cpp/dateformat.cpp b/src/main/cpp/dateformat.cpp
index ac1f338..83b3624 100644
--- a/src/main/cpp/dateformat.cpp
+++ b/src/main/cpp/dateformat.cpp
@@ -31,7 +31,7 @@
void DateFormat::numberFormat(LogString& s, int n, Pool& p) const
{
- StringHelper::toString(n, p, s);
+ StringHelper::toString(n, p, s);
}
DateFormat::DateFormat() {}
diff --git a/src/main/cpp/datelayout.cpp b/src/main/cpp/datelayout.cpp
index 5e3fc4c..e8366bb 100644
--- a/src/main/cpp/datelayout.cpp
+++ b/src/main/cpp/datelayout.cpp
@@ -30,7 +30,7 @@
using namespace log4cxx::spi;
DateLayout::DateLayout(const LogString& dateFormatOption1) :
- timeZoneID(), dateFormatOption(dateFormatOption1), dateFormat(0)
+ timeZoneID(), dateFormatOption(dateFormatOption1), dateFormat(0)
{
}
@@ -42,86 +42,86 @@
void DateLayout::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("DATEFORMAT"), LOG4CXX_STR("dateformat")))
- {
- dateFormatOption = value;
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("TIMEZONE"), LOG4CXX_STR("timezone")))
- {
- timeZoneID = value;
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("DATEFORMAT"), LOG4CXX_STR("dateformat")))
+ {
+ dateFormatOption = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("TIMEZONE"), LOG4CXX_STR("timezone")))
+ {
+ timeZoneID = value;
+ }
}
void DateLayout::activateOptions(Pool&)
{
- if (!dateFormatOption.empty())
- {
+ if (!dateFormatOption.empty())
+ {
- if (dateFormatOption.empty())
- {
- dateFormat = 0;
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
- {
- dateFormat = 0;
- dateFormatOption = LOG4CXX_STR("NULL");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("RELATIVE"), LOG4CXX_STR("relative")))
- {
- dateFormat = new RelativeTimeDateFormat();
- dateFormatOption = LOG4CXX_STR("RELATIVE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute")))
- {
- dateFormat = new AbsoluteTimeDateFormat();
- dateFormatOption = LOG4CXX_STR("ABSOLUTE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("DATE"), LOG4CXX_STR("date")))
- {
- dateFormat = new DateTimeDateFormat();
- dateFormatOption = LOG4CXX_STR("DATE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601")))
- {
- dateFormat = new ISO8601DateFormat();
- dateFormatOption = LOG4CXX_STR("iso8601");
- }
- else
- {
- dateFormat = new SimpleDateFormat(dateFormatOption);
- }
- }
+ if (dateFormatOption.empty())
+ {
+ dateFormat = 0;
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatOption,
+ LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
+ {
+ dateFormat = 0;
+ dateFormatOption = LOG4CXX_STR("NULL");
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatOption,
+ LOG4CXX_STR("RELATIVE"), LOG4CXX_STR("relative")))
+ {
+ dateFormat = new RelativeTimeDateFormat();
+ dateFormatOption = LOG4CXX_STR("RELATIVE");
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatOption,
+ LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute")))
+ {
+ dateFormat = new AbsoluteTimeDateFormat();
+ dateFormatOption = LOG4CXX_STR("ABSOLUTE");
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatOption,
+ LOG4CXX_STR("DATE"), LOG4CXX_STR("date")))
+ {
+ dateFormat = new DateTimeDateFormat();
+ dateFormatOption = LOG4CXX_STR("DATE");
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatOption,
+ LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601")))
+ {
+ dateFormat = new ISO8601DateFormat();
+ dateFormatOption = LOG4CXX_STR("iso8601");
+ }
+ else
+ {
+ dateFormat = new SimpleDateFormat(dateFormatOption);
+ }
+ }
- if (dateFormat != NULL)
- {
- if (timeZoneID.empty())
- {
- dateFormat->setTimeZone(TimeZone::getDefault());
- }
- else
- {
- dateFormat->setTimeZone(TimeZone::getTimeZone(timeZoneID));
- }
- }
+ if (dateFormat != NULL)
+ {
+ if (timeZoneID.empty())
+ {
+ dateFormat->setTimeZone(TimeZone::getDefault());
+ }
+ else
+ {
+ dateFormat->setTimeZone(TimeZone::getTimeZone(timeZoneID));
+ }
+ }
}
void DateLayout::formatDate(LogString& s,
- const spi::LoggingEventPtr& event,
- Pool& p) const
+ const spi::LoggingEventPtr& event,
+ Pool& p) const
{
- if (dateFormat != 0)
- {
- dateFormat->format(s, event->getTimeStamp(), p);
- s.append(1, (logchar) 0x20 /* ' ' */);
- }
+ if (dateFormat != 0)
+ {
+ dateFormat->format(s, event->getTimeStamp(), p);
+ s.append(1, (logchar) 0x20 /* ' ' */);
+ }
}
diff --git a/src/main/cpp/datepatternconverter.cpp b/src/main/cpp/datepatternconverter.cpp
index 80db01c..25b51ea 100644
--- a/src/main/cpp/datepatternconverter.cpp
+++ b/src/main/cpp/datepatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -40,121 +40,121 @@
IMPLEMENT_LOG4CXX_OBJECT(DatePatternConverter)
DatePatternConverter::DatePatternConverter(
- const std::vector<LogString>& options) :
- LoggingEventPatternConverter(LOG4CXX_STR("Class Name"),
- LOG4CXX_STR("class name")), df(getDateFormat(options))
+ const std::vector<LogString>& options) :
+ LoggingEventPatternConverter(LOG4CXX_STR("Class Name"),
+ LOG4CXX_STR("class name")), df(getDateFormat(options))
{
}
DateFormatPtr DatePatternConverter::getDateFormat(const OptionsList& options)
{
- DateFormatPtr df;
- int maximumCacheValidity = 1000000;
+ DateFormatPtr df;
+ int maximumCacheValidity = 1000000;
- if (options.size() == 0)
- {
- df = new ISO8601DateFormat();
- }
- else
- {
- LogString dateFormatStr(options[0]);
+ if (options.size() == 0)
+ {
+ df = new ISO8601DateFormat();
+ }
+ else
+ {
+ LogString dateFormatStr(options[0]);
- if (dateFormatStr.empty() ||
- StringHelper::equalsIgnoreCase(dateFormatStr,
- LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601")))
- {
- df = new ISO8601DateFormat();
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatStr,
- LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute")))
- {
- df = new AbsoluteTimeDateFormat();
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatStr,
- LOG4CXX_STR("DATE"), LOG4CXX_STR("date")))
- {
- df = new DateTimeDateFormat();
- }
- else
- {
- if (dateFormatStr.find(0x25 /*'%'*/) == std::string::npos)
- {
- try
- {
- df = new SimpleDateFormat(dateFormatStr);
- maximumCacheValidity =
- CachedDateFormat::getMaximumCacheValidity(dateFormatStr);
- }
- catch (IllegalArgumentException& e)
- {
- df = new ISO8601DateFormat();
- LogLog::warn(((LogString)
- LOG4CXX_STR("Could not instantiate SimpleDateFormat with pattern "))
- + dateFormatStr, e);
- }
- }
- else
- {
- df = new StrftimeDateFormat(dateFormatStr);
- }
- }
+ if (dateFormatStr.empty() ||
+ StringHelper::equalsIgnoreCase(dateFormatStr,
+ LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601")))
+ {
+ df = new ISO8601DateFormat();
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatStr,
+ LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute")))
+ {
+ df = new AbsoluteTimeDateFormat();
+ }
+ else if (StringHelper::equalsIgnoreCase(dateFormatStr,
+ LOG4CXX_STR("DATE"), LOG4CXX_STR("date")))
+ {
+ df = new DateTimeDateFormat();
+ }
+ else
+ {
+ if (dateFormatStr.find(0x25 /*'%'*/) == std::string::npos)
+ {
+ try
+ {
+ df = new SimpleDateFormat(dateFormatStr);
+ maximumCacheValidity =
+ CachedDateFormat::getMaximumCacheValidity(dateFormatStr);
+ }
+ catch (IllegalArgumentException& e)
+ {
+ df = new ISO8601DateFormat();
+ LogLog::warn(((LogString)
+ LOG4CXX_STR("Could not instantiate SimpleDateFormat with pattern "))
+ + dateFormatStr, e);
+ }
+ }
+ else
+ {
+ df = new StrftimeDateFormat(dateFormatStr);
+ }
+ }
- if (options.size() >= 2)
- {
- TimeZonePtr tz(TimeZone::getTimeZone(options[1]));
+ if (options.size() >= 2)
+ {
+ TimeZonePtr tz(TimeZone::getTimeZone(options[1]));
- if (tz != NULL)
- {
- df->setTimeZone(tz);
- }
- }
- }
+ if (tz != NULL)
+ {
+ df->setTimeZone(tz);
+ }
+ }
+ }
- if (maximumCacheValidity > 0)
- {
- df = new CachedDateFormat(df, maximumCacheValidity);
- }
+ if (maximumCacheValidity > 0)
+ {
+ df = new CachedDateFormat(df, maximumCacheValidity);
+ }
- return df;
+ return df;
}
PatternConverterPtr DatePatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- return new DatePatternConverter(options);
+ return new DatePatternConverter(options);
}
void DatePatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& p) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& p) const
{
- df->format(toAppendTo, event->getTimeStamp(), p);
+ df->format(toAppendTo, event->getTimeStamp(), p);
}
/**
* {@inheritDoc}
*/
void DatePatternConverter::format(
- const ObjectPtr& obj,
- LogString& toAppendTo,
- Pool& p) const
+ const ObjectPtr& obj,
+ LogString& toAppendTo,
+ Pool& p) const
{
- DatePtr date(obj);
+ DatePtr date(obj);
- if (date != NULL)
- {
- format(date, toAppendTo, p);
- }
- else
- {
- LoggingEventPtr event(obj);
+ if (date != NULL)
+ {
+ format(date, toAppendTo, p);
+ }
+ else
+ {
+ LoggingEventPtr event(obj);
- if (event != NULL)
- {
- format(event, toAppendTo, p);
- }
- }
+ if (event != NULL)
+ {
+ format(event, toAppendTo, p);
+ }
+ }
}
/**
@@ -163,9 +163,9 @@
* @param toAppendTo buffer to which formatted date is appended.
*/
void DatePatternConverter::format(
- const DatePtr& date,
- LogString& toAppendTo,
- Pool& p) const
+ const DatePtr& date,
+ LogString& toAppendTo,
+ Pool& p) const
{
- df->format(toAppendTo, date->getTime(), p);
+ df->format(toAppendTo, date->getTime(), p);
}
diff --git a/src/main/cpp/defaultconfigurator.cpp b/src/main/cpp/defaultconfigurator.cpp
index b592242..b304084 100644
--- a/src/main/cpp/defaultconfigurator.cpp
+++ b/src/main/cpp/defaultconfigurator.cpp
@@ -29,60 +29,60 @@
void DefaultConfigurator::configure(LoggerRepository* repository)
{
- repository->setConfigured(true);
- const LogString configuratorClassName(getConfiguratorClass());
+ repository->setConfigured(true);
+ const LogString configuratorClassName(getConfiguratorClass());
- LogString configurationOptionStr(getConfigurationFileName());
- Pool pool;
- File configuration;
+ LogString configurationOptionStr(getConfigurationFileName());
+ Pool pool;
+ File configuration;
- if (configurationOptionStr.empty())
- {
- const char* names[] = { "log4cxx.xml", "log4cxx.properties", "log4j.xml", "log4j.properties", 0 };
+ if (configurationOptionStr.empty())
+ {
+ const char* names[] = { "log4cxx.xml", "log4cxx.properties", "log4j.xml", "log4j.properties", 0 };
- for (int i = 0; names[i] != 0; i++)
- {
- File candidate(names[i]);
+ for (int i = 0; names[i] != 0; i++)
+ {
+ File candidate(names[i]);
- if (candidate.exists(pool))
- {
- configuration = candidate;
- break;
- }
- }
- }
- else
- {
- configuration.setPath(configurationOptionStr);
- }
+ if (candidate.exists(pool))
+ {
+ configuration = candidate;
+ break;
+ }
+ }
+ }
+ else
+ {
+ configuration.setPath(configurationOptionStr);
+ }
- if (configuration.exists(pool))
- {
- LogString msg(LOG4CXX_STR("Using configuration file ["));
- msg += configuration.getPath();
- msg += LOG4CXX_STR("] for automatic log4cxx configuration");
- LogLog::debug(msg);
+ if (configuration.exists(pool))
+ {
+ LogString msg(LOG4CXX_STR("Using configuration file ["));
+ msg += configuration.getPath();
+ msg += LOG4CXX_STR("] for automatic log4cxx configuration");
+ LogLog::debug(msg);
- LoggerRepositoryPtr repo(repository);
- OptionConverter::selectAndConfigure(
- configuration,
- configuratorClassName,
- repo);
- }
- else
- {
- if (configurationOptionStr.empty())
- {
- LogLog::debug(LOG4CXX_STR("Could not find default configuration file."));
- }
- else
- {
- LogString msg(LOG4CXX_STR("Could not find configuration file: ["));
- msg += configurationOptionStr;
- msg += LOG4CXX_STR("].");
- LogLog::debug(msg);
- }
- }
+ LoggerRepositoryPtr repo(repository);
+ OptionConverter::selectAndConfigure(
+ configuration,
+ configuratorClassName,
+ repo);
+ }
+ else
+ {
+ if (configurationOptionStr.empty())
+ {
+ LogLog::debug(LOG4CXX_STR("Could not find default configuration file."));
+ }
+ else
+ {
+ LogString msg(LOG4CXX_STR("Could not find configuration file: ["));
+ msg += configurationOptionStr;
+ msg += LOG4CXX_STR("].");
+ LogLog::debug(msg);
+ }
+ }
}
@@ -90,26 +90,26 @@
const LogString DefaultConfigurator::getConfiguratorClass()
{
- // Use automatic configration to configure the default hierarchy
- const LogString log4jConfiguratorClassName(
- OptionConverter::getSystemProperty(LOG4CXX_STR("log4j.configuratorClass"), LOG4CXX_STR("")));
- const LogString configuratorClassName(
- OptionConverter::getSystemProperty(LOG4CXX_STR("LOG4CXX_CONFIGURATOR_CLASS"),
- log4jConfiguratorClassName));
- return configuratorClassName;
+ // Use automatic configration to configure the default hierarchy
+ const LogString log4jConfiguratorClassName(
+ OptionConverter::getSystemProperty(LOG4CXX_STR("log4j.configuratorClass"), LOG4CXX_STR("")));
+ const LogString configuratorClassName(
+ OptionConverter::getSystemProperty(LOG4CXX_STR("LOG4CXX_CONFIGURATOR_CLASS"),
+ log4jConfiguratorClassName));
+ return configuratorClassName;
}
const LogString DefaultConfigurator::getConfigurationFileName()
{
- static const LogString LOG4CXX_DEFAULT_CONFIGURATION_KEY(LOG4CXX_STR("LOG4CXX_CONFIGURATION"));
- static const LogString LOG4J_DEFAULT_CONFIGURATION_KEY(LOG4CXX_STR("log4j.configuration"));
- const LogString log4jConfigurationOptionStr(
- OptionConverter::getSystemProperty(LOG4J_DEFAULT_CONFIGURATION_KEY, LOG4CXX_STR("")));
- const LogString configurationOptionStr(
- OptionConverter::getSystemProperty(LOG4CXX_DEFAULT_CONFIGURATION_KEY,
- log4jConfigurationOptionStr));
- return configurationOptionStr;
+ static const LogString LOG4CXX_DEFAULT_CONFIGURATION_KEY(LOG4CXX_STR("LOG4CXX_CONFIGURATION"));
+ static const LogString LOG4J_DEFAULT_CONFIGURATION_KEY(LOG4CXX_STR("log4j.configuration"));
+ const LogString log4jConfigurationOptionStr(
+ OptionConverter::getSystemProperty(LOG4J_DEFAULT_CONFIGURATION_KEY, LOG4CXX_STR("")));
+ const LogString configurationOptionStr(
+ OptionConverter::getSystemProperty(LOG4CXX_DEFAULT_CONFIGURATION_KEY,
+ log4jConfigurationOptionStr));
+ return configurationOptionStr;
}
diff --git a/src/main/cpp/defaultloggerfactory.cpp b/src/main/cpp/defaultloggerfactory.cpp
index 64c1124..8f81a77 100644
--- a/src/main/cpp/defaultloggerfactory.cpp
+++ b/src/main/cpp/defaultloggerfactory.cpp
@@ -23,8 +23,8 @@
IMPLEMENT_LOG4CXX_OBJECT(DefaultLoggerFactory)
LoggerPtr DefaultLoggerFactory::makeNewLoggerInstance(
- log4cxx::helpers::Pool& pool,
- const LogString& name) const
+ log4cxx::helpers::Pool& pool,
+ const LogString& name) const
{
- return new Logger(pool, name);
+ return new Logger(pool, name);
}
diff --git a/src/main/cpp/defaultrepositoryselector.cpp b/src/main/cpp/defaultrepositoryselector.cpp
index 0afb650..6313f29 100644
--- a/src/main/cpp/defaultrepositoryselector.cpp
+++ b/src/main/cpp/defaultrepositoryselector.cpp
@@ -23,22 +23,22 @@
DefaultRepositorySelector::DefaultRepositorySelector(const LoggerRepositoryPtr& repository1)
- : repository(repository1)
+ : repository(repository1)
{
}
void DefaultRepositorySelector::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void DefaultRepositorySelector::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
LoggerRepositoryPtr& DefaultRepositorySelector::getLoggerRepository()
{
- return repository;
+ return repository;
}
diff --git a/src/main/cpp/domconfigurator.cpp b/src/main/cpp/domconfigurator.cpp
index bf997b8..c5770bf 100644
--- a/src/main/cpp/domconfigurator.cpp
+++ b/src/main/cpp/domconfigurator.cpp
@@ -64,20 +64,20 @@
{
class XMLWatchdog : public FileWatchdog
{
- public:
- XMLWatchdog(const File& filename) : FileWatchdog(filename)
- {
- }
+ public:
+ XMLWatchdog(const File& filename) : FileWatchdog(filename)
+ {
+ }
- /**
- Call DOMConfigurator#doConfigure with the
- <code>filename</code> to reconfigure log4cxx.
- */
- void doOnChange()
- {
- DOMConfigurator().doConfigure(file,
- LogManager::getLoggerRepository());
- }
+ /**
+ Call DOMConfigurator#doConfigure with the
+ <code>filename</code> to reconfigure log4cxx.
+ */
+ void doOnChange()
+ {
+ DOMConfigurator().doConfigure(file,
+ LogManager::getLoggerRepository());
+ }
};
}
}
@@ -116,579 +116,579 @@
#define INTERNAL_DEBUG_ATTR "debug"
DOMConfigurator::DOMConfigurator()
- : props(), repository()
+ : props(), repository()
{
}
void DOMConfigurator::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void DOMConfigurator::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
/**
Used internally to parse appenders by IDREF name.
*/
AppenderPtr DOMConfigurator::findAppenderByName(log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- apr_xml_doc* doc,
- const LogString& appenderName,
- AppenderMap& appenders)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ apr_xml_doc* doc,
+ const LogString& appenderName,
+ AppenderMap& appenders)
{
- AppenderPtr appender;
- std::string tagName(element->name);
+ AppenderPtr appender;
+ std::string tagName(element->name);
- if (tagName == APPENDER_TAG)
- {
- if (appenderName == getAttribute(utf8Decoder, element, NAME_ATTR))
- {
- appender = parseAppender(p, utf8Decoder, element, doc, appenders);
- }
- }
+ if (tagName == APPENDER_TAG)
+ {
+ if (appenderName == getAttribute(utf8Decoder, element, NAME_ATTR))
+ {
+ appender = parseAppender(p, utf8Decoder, element, doc, appenders);
+ }
+ }
- if (element->first_child && !appender)
- {
- appender = findAppenderByName(p, utf8Decoder, element->first_child, doc, appenderName, appenders);
- }
+ if (element->first_child && !appender)
+ {
+ appender = findAppenderByName(p, utf8Decoder, element->first_child, doc, appenderName, appenders);
+ }
- if (element->next && !appender)
- {
- appender = findAppenderByName(p, utf8Decoder, element->next, doc, appenderName, appenders);
- }
+ if (element->next && !appender)
+ {
+ appender = findAppenderByName(p, utf8Decoder, element->next, doc, appenderName, appenders);
+ }
- return appender;
+ return appender;
}
/**
Used internally to parse appenders by IDREF element.
*/
AppenderPtr DOMConfigurator::findAppenderByReference(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* appenderRef,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* appenderRef,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- LogString appenderName(subst(getAttribute(utf8Decoder, appenderRef, REF_ATTR)));
- AppenderMap::const_iterator match = appenders.find(appenderName);
- AppenderPtr appender;
+ LogString appenderName(subst(getAttribute(utf8Decoder, appenderRef, REF_ATTR)));
+ AppenderMap::const_iterator match = appenders.find(appenderName);
+ AppenderPtr appender;
- if (match != appenders.end())
- {
- appender = match->second;
- }
- else if (doc)
- {
- appender = findAppenderByName(p, utf8Decoder, doc->root, doc, appenderName, appenders);
+ if (match != appenders.end())
+ {
+ appender = match->second;
+ }
+ else if (doc)
+ {
+ appender = findAppenderByName(p, utf8Decoder, doc->root, doc, appenderName, appenders);
- if (appender)
- {
- appenders.insert(AppenderMap::value_type(appenderName, appender));
- }
- }
+ if (appender)
+ {
+ appenders.insert(AppenderMap::value_type(appenderName, appender));
+ }
+ }
- if (!appender)
- {
- LogLog::error(LOG4CXX_STR("No appender named [") +
- appenderName + LOG4CXX_STR("] could be found."));
- }
+ if (!appender)
+ {
+ LogLog::error(LOG4CXX_STR("No appender named [") +
+ appenderName + LOG4CXX_STR("] could be found."));
+ }
- return appender;
+ return appender;
}
/**
Used internally to parse an appender element.
*/
AppenderPtr DOMConfigurator::parseAppender(Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* appenderElement,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* appenderElement,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- LogString className(subst(getAttribute(utf8Decoder, appenderElement, CLASS_ATTR)));
- LogLog::debug(LOG4CXX_STR("Class name: [") + className + LOG4CXX_STR("]"));
+ LogString className(subst(getAttribute(utf8Decoder, appenderElement, CLASS_ATTR)));
+ LogLog::debug(LOG4CXX_STR("Class name: [") + className + LOG4CXX_STR("]"));
- try
- {
- ObjectPtr instance = Loader::loadClass(className).newInstance();
- AppenderPtr appender = instance;
- PropertySetter propSetter(appender);
+ try
+ {
+ ObjectPtr instance = Loader::loadClass(className).newInstance();
+ AppenderPtr appender = instance;
+ PropertySetter propSetter(appender);
- appender->setName(subst(getAttribute(utf8Decoder, appenderElement, NAME_ATTR)));
+ appender->setName(subst(getAttribute(utf8Decoder, appenderElement, NAME_ATTR)));
- for (apr_xml_elem* currentElement = appenderElement->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
+ for (apr_xml_elem* currentElement = appenderElement->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
- std::string tagName(currentElement->name);
+ std::string tagName(currentElement->name);
- // Parse appender parameters
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- // Set appender layout
- else if (tagName == LAYOUT_TAG)
- {
- appender->setLayout(parseLayout(p, utf8Decoder, currentElement));
- }
- // Add filters
- else if (tagName == FILTER_TAG)
- {
- std::vector<log4cxx::spi::FilterPtr> filters;
- parseFilters(p, utf8Decoder, currentElement, filters);
+ // Parse appender parameters
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ // Set appender layout
+ else if (tagName == LAYOUT_TAG)
+ {
+ appender->setLayout(parseLayout(p, utf8Decoder, currentElement));
+ }
+ // Add filters
+ else if (tagName == FILTER_TAG)
+ {
+ std::vector<log4cxx::spi::FilterPtr> filters;
+ parseFilters(p, utf8Decoder, currentElement, filters);
- for (std::vector<log4cxx::spi::FilterPtr>::iterator iter = filters.begin();
- iter != filters.end();
- iter++)
- {
- appender->addFilter(*iter);
- }
- }
- else if (tagName == ERROR_HANDLER_TAG)
- {
- parseErrorHandler(p, utf8Decoder, currentElement, appender, doc, appenders);
- }
- else if (tagName == ROLLING_POLICY_TAG)
- {
- RollingPolicyPtr rollPolicy(parseRollingPolicy(p, utf8Decoder, currentElement));
- RollingFileAppenderPtr rfa(appender);
+ for (std::vector<log4cxx::spi::FilterPtr>::iterator iter = filters.begin();
+ iter != filters.end();
+ iter++)
+ {
+ appender->addFilter(*iter);
+ }
+ }
+ else if (tagName == ERROR_HANDLER_TAG)
+ {
+ parseErrorHandler(p, utf8Decoder, currentElement, appender, doc, appenders);
+ }
+ else if (tagName == ROLLING_POLICY_TAG)
+ {
+ RollingPolicyPtr rollPolicy(parseRollingPolicy(p, utf8Decoder, currentElement));
+ RollingFileAppenderPtr rfa(appender);
- if (rfa != NULL)
- {
- rfa->setRollingPolicy(rollPolicy);
- }
- }
- else if (tagName == TRIGGERING_POLICY_TAG)
- {
- ObjectPtr policy(parseTriggeringPolicy(p, utf8Decoder, currentElement));
- RollingFileAppenderPtr rfa(appender);
+ if (rfa != NULL)
+ {
+ rfa->setRollingPolicy(rollPolicy);
+ }
+ }
+ else if (tagName == TRIGGERING_POLICY_TAG)
+ {
+ ObjectPtr policy(parseTriggeringPolicy(p, utf8Decoder, currentElement));
+ RollingFileAppenderPtr rfa(appender);
- if (rfa != NULL)
- {
- rfa->setTriggeringPolicy(policy);
- }
- else
- {
- log4cxx::net::SMTPAppenderPtr smtpa(appender);
+ if (rfa != NULL)
+ {
+ rfa->setTriggeringPolicy(policy);
+ }
+ else
+ {
+ log4cxx::net::SMTPAppenderPtr smtpa(appender);
- if (smtpa != NULL)
- {
- log4cxx::spi::TriggeringEventEvaluatorPtr evaluator(policy);
- smtpa->setEvaluator(evaluator);
- }
- }
- }
- else if (tagName == APPENDER_REF_TAG)
- {
- LogString refName = subst(getAttribute(utf8Decoder, currentElement, REF_ATTR));
+ if (smtpa != NULL)
+ {
+ log4cxx::spi::TriggeringEventEvaluatorPtr evaluator(policy);
+ smtpa->setEvaluator(evaluator);
+ }
+ }
+ }
+ else if (tagName == APPENDER_REF_TAG)
+ {
+ LogString refName = subst(getAttribute(utf8Decoder, currentElement, REF_ATTR));
- if (appender->instanceof(AppenderAttachable::getStaticClass()))
- {
- AppenderAttachablePtr aa(appender);
- LogLog::debug(LOG4CXX_STR("Attaching appender named [") +
- refName + LOG4CXX_STR("] to appender named [") +
- appender->getName() + LOG4CXX_STR("]."));
- aa->addAppender(findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders));
- }
- else
- {
- LogLog::error(LOG4CXX_STR("Requesting attachment of appender named [") +
- refName + LOG4CXX_STR("] to appender named [") + appender->getName() +
- LOG4CXX_STR("] which does not implement AppenderAttachable."));
- }
- }
- }
+ if (appender->instanceof(AppenderAttachable::getStaticClass()))
+ {
+ AppenderAttachablePtr aa(appender);
+ LogLog::debug(LOG4CXX_STR("Attaching appender named [") +
+ refName + LOG4CXX_STR("] to appender named [") +
+ appender->getName() + LOG4CXX_STR("]."));
+ aa->addAppender(findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders));
+ }
+ else
+ {
+ LogLog::error(LOG4CXX_STR("Requesting attachment of appender named [") +
+ refName + LOG4CXX_STR("] to appender named [") + appender->getName() +
+ LOG4CXX_STR("] which does not implement AppenderAttachable."));
+ }
+ }
+ }
- propSetter.activate(p);
- return appender;
- }
- /* Yes, it's ugly. But all of these exceptions point to the same
- problem: we can't create an Appender */
- catch (Exception& oops)
- {
- LogLog::error(LOG4CXX_STR("Could not create an Appender. Reported error follows."),
- oops);
- return 0;
- }
+ propSetter.activate(p);
+ return appender;
+ }
+ /* Yes, it's ugly. But all of these exceptions point to the same
+ problem: we can't create an Appender */
+ catch (Exception& oops)
+ {
+ LogLog::error(LOG4CXX_STR("Could not create an Appender. Reported error follows."),
+ oops);
+ return 0;
+ }
}
/**
Used internally to parse an {@link ErrorHandler} element.
*/
void DOMConfigurator::parseErrorHandler(Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- AppenderPtr& appender,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ AppenderPtr& appender,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- ErrorHandlerPtr eh = OptionConverter::instantiateByClassName(
- subst(getAttribute(utf8Decoder, element, CLASS_ATTR)),
- ErrorHandler::getStaticClass(),
- 0);
+ ErrorHandlerPtr eh = OptionConverter::instantiateByClassName(
+ subst(getAttribute(utf8Decoder, element, CLASS_ATTR)),
+ ErrorHandler::getStaticClass(),
+ 0);
- if (eh != 0)
- {
- eh->setAppender(appender);
+ if (eh != 0)
+ {
+ eh->setAppender(appender);
- PropertySetter propSetter(eh);
+ PropertySetter propSetter(eh);
- for (apr_xml_elem* currentElement = element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- else if (tagName == APPENDER_REF_TAG)
- {
- eh->setBackupAppender(findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders));
- }
- else if (tagName == LOGGER_REF)
- {
- LogString loggerName(getAttribute(utf8Decoder, currentElement, REF_ATTR));
- LoggerPtr logger = repository->getLogger(loggerName, loggerFactory);
- eh->setLogger(logger);
- }
- else if (tagName == ROOT_REF)
- {
- LoggerPtr root = repository->getRootLogger();
- eh->setLogger(root);
- }
- }
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ else if (tagName == APPENDER_REF_TAG)
+ {
+ eh->setBackupAppender(findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders));
+ }
+ else if (tagName == LOGGER_REF)
+ {
+ LogString loggerName(getAttribute(utf8Decoder, currentElement, REF_ATTR));
+ LoggerPtr logger = repository->getLogger(loggerName, loggerFactory);
+ eh->setLogger(logger);
+ }
+ else if (tagName == ROOT_REF)
+ {
+ LoggerPtr root = repository->getRootLogger();
+ eh->setLogger(root);
+ }
+ }
- propSetter.activate(p);
- ObjectPtrT<AppenderSkeleton> appSkeleton(appender);
+ propSetter.activate(p);
+ ObjectPtrT<AppenderSkeleton> appSkeleton(appender);
- if (appSkeleton != 0)
- {
- appSkeleton->setErrorHandler(eh);
- }
- }
+ if (appSkeleton != 0)
+ {
+ appSkeleton->setErrorHandler(eh);
+ }
+ }
}
/**
Used internally to parse a filter element.
*/
void DOMConfigurator::parseFilters(Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- std::vector<log4cxx::spi::FilterPtr>& filters)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ std::vector<log4cxx::spi::FilterPtr>& filters)
{
- LogString clazz = subst(getAttribute(utf8Decoder, element, CLASS_ATTR));
- FilterPtr filter = OptionConverter::instantiateByClassName(clazz,
- Filter::getStaticClass(), 0);
+ LogString clazz = subst(getAttribute(utf8Decoder, element, CLASS_ATTR));
+ FilterPtr filter = OptionConverter::instantiateByClassName(clazz,
+ Filter::getStaticClass(), 0);
- if (filter != 0)
- {
- PropertySetter propSetter(filter);
+ if (filter != 0)
+ {
+ PropertySetter propSetter(filter);
- for (apr_xml_elem* currentElement = element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- }
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ }
- propSetter.activate(p);
- filters.push_back(filter);
- }
+ propSetter.activate(p);
+ filters.push_back(filter);
+ }
}
/**
Used internally to parse an category or logger element.
*/
void DOMConfigurator::parseLogger(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* loggerElement,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* loggerElement,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- // Create a new Logger object from the <category> element.
- LogString loggerName = subst(getAttribute(utf8Decoder, loggerElement, NAME_ATTR));
+ // Create a new Logger object from the <category> element.
+ LogString loggerName = subst(getAttribute(utf8Decoder, loggerElement, NAME_ATTR));
- LogLog::debug(LOG4CXX_STR("Retreiving an instance of Logger."));
- LoggerPtr logger = repository->getLogger(loggerName, loggerFactory);
+ LogLog::debug(LOG4CXX_STR("Retreiving an instance of Logger."));
+ LoggerPtr logger = repository->getLogger(loggerName, loggerFactory);
- // Setting up a logger needs to be an atomic operation, in order
- // to protect potential log operations while logger
- // configuration is in progress.
- LOCK_W sync(logger->getMutex());
- bool additivity = OptionConverter::toBoolean(
- subst(getAttribute(utf8Decoder, loggerElement, ADDITIVITY_ATTR)),
- true);
+ // Setting up a logger needs to be an atomic operation, in order
+ // to protect potential log operations while logger
+ // configuration is in progress.
+ LOCK_W sync(logger->getMutex());
+ bool additivity = OptionConverter::toBoolean(
+ subst(getAttribute(utf8Decoder, loggerElement, ADDITIVITY_ATTR)),
+ true);
- LogLog::debug(LOG4CXX_STR("Setting [") + logger->getName() + LOG4CXX_STR("] additivity to [") +
- (additivity ? LogString(LOG4CXX_STR("true")) : LogString(LOG4CXX_STR("false"))) + LOG4CXX_STR("]."));
- logger->setAdditivity(additivity);
- parseChildrenOfLoggerElement(p, utf8Decoder, loggerElement, logger, false, doc, appenders);
+ LogLog::debug(LOG4CXX_STR("Setting [") + logger->getName() + LOG4CXX_STR("] additivity to [") +
+ (additivity ? LogString(LOG4CXX_STR("true")) : LogString(LOG4CXX_STR("false"))) + LOG4CXX_STR("]."));
+ logger->setAdditivity(additivity);
+ parseChildrenOfLoggerElement(p, utf8Decoder, loggerElement, logger, false, doc, appenders);
}
/**
Used internally to parse the logger factory element.
*/
void DOMConfigurator::parseLoggerFactory(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* factoryElement)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* factoryElement)
{
- LogString className(subst(getAttribute(utf8Decoder, factoryElement, CLASS_ATTR)));
+ LogString className(subst(getAttribute(utf8Decoder, factoryElement, CLASS_ATTR)));
- if (className.empty())
- {
- LogLog::error(LOG4CXX_STR("Logger Factory tag class attribute not found."));
- LogLog::debug(LOG4CXX_STR("No Logger Factory configured."));
- }
- else
- {
- LogLog::debug(LOG4CXX_STR("Desired logger factory: [") + className + LOG4CXX_STR("]"));
- loggerFactory = OptionConverter::instantiateByClassName(
- className,
- LoggerFactory::getStaticClass(),
- 0);
- PropertySetter propSetter(loggerFactory);
+ if (className.empty())
+ {
+ LogLog::error(LOG4CXX_STR("Logger Factory tag class attribute not found."));
+ LogLog::debug(LOG4CXX_STR("No Logger Factory configured."));
+ }
+ else
+ {
+ LogLog::debug(LOG4CXX_STR("Desired logger factory: [") + className + LOG4CXX_STR("]"));
+ loggerFactory = OptionConverter::instantiateByClassName(
+ className,
+ LoggerFactory::getStaticClass(),
+ 0);
+ PropertySetter propSetter(loggerFactory);
- for (apr_xml_elem* currentElement = factoryElement->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = factoryElement->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- }
- }
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ }
+ }
}
/**
Used internally to parse the root logger element.
*/
void DOMConfigurator::parseRoot(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* rootElement,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* rootElement,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- LoggerPtr root = repository->getRootLogger();
- // logger configuration needs to be atomic
- LOCK_W sync(root->getMutex());
- parseChildrenOfLoggerElement(p, utf8Decoder, rootElement, root, true, doc, appenders);
+ LoggerPtr root = repository->getRootLogger();
+ // logger configuration needs to be atomic
+ LOCK_W sync(root->getMutex());
+ parseChildrenOfLoggerElement(p, utf8Decoder, rootElement, root, true, doc, appenders);
}
/**
Used internally to parse the children of a logger element.
*/
void DOMConfigurator::parseChildrenOfLoggerElement(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* loggerElement, LoggerPtr logger, bool isRoot,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* loggerElement, LoggerPtr logger, bool isRoot,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- PropertySetter propSetter(logger);
+ PropertySetter propSetter(logger);
- // Remove all existing appenders from logger. They will be
- // reconstructed if need be.
- logger->removeAllAppenders();
+ // Remove all existing appenders from logger. They will be
+ // reconstructed if need be.
+ logger->removeAllAppenders();
- for (apr_xml_elem* currentElement = loggerElement->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = loggerElement->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == APPENDER_REF_TAG)
- {
- AppenderPtr appender = findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders);
- LogString refName = subst(getAttribute(utf8Decoder, currentElement, REF_ATTR));
+ if (tagName == APPENDER_REF_TAG)
+ {
+ AppenderPtr appender = findAppenderByReference(p, utf8Decoder, currentElement, doc, appenders);
+ LogString refName = subst(getAttribute(utf8Decoder, currentElement, REF_ATTR));
- if (appender != 0)
- {
- LogLog::debug(LOG4CXX_STR("Adding appender named [") + refName +
- LOG4CXX_STR("] to logger [") + logger->getName() + LOG4CXX_STR("]."));
- }
- else
- {
- LogLog::debug(LOG4CXX_STR("Appender named [") + refName +
- LOG4CXX_STR("] not found."));
- }
+ if (appender != 0)
+ {
+ LogLog::debug(LOG4CXX_STR("Adding appender named [") + refName +
+ LOG4CXX_STR("] to logger [") + logger->getName() + LOG4CXX_STR("]."));
+ }
+ else
+ {
+ LogLog::debug(LOG4CXX_STR("Appender named [") + refName +
+ LOG4CXX_STR("] not found."));
+ }
- logger->addAppender(appender);
+ logger->addAppender(appender);
- }
- else if (tagName == LEVEL_TAG)
- {
- parseLevel(p, utf8Decoder, currentElement, logger, isRoot);
- }
- else if (tagName == PRIORITY_TAG)
- {
- parseLevel(p, utf8Decoder, currentElement, logger, isRoot);
- }
- else if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- }
+ }
+ else if (tagName == LEVEL_TAG)
+ {
+ parseLevel(p, utf8Decoder, currentElement, logger, isRoot);
+ }
+ else if (tagName == PRIORITY_TAG)
+ {
+ parseLevel(p, utf8Decoder, currentElement, logger, isRoot);
+ }
+ else if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ }
- propSetter.activate(p);
+ propSetter.activate(p);
}
/**
Used internally to parse a layout element.
*/
LayoutPtr DOMConfigurator::parseLayout (
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* layout_element)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* layout_element)
{
- LogString className(subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR)));
- LogLog::debug(LOG4CXX_STR("Parsing layout of class: \"") + className + LOG4CXX_STR("\""));
+ LogString className(subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR)));
+ LogLog::debug(LOG4CXX_STR("Parsing layout of class: \"") + className + LOG4CXX_STR("\""));
- try
- {
- ObjectPtr instance = Loader::loadClass(className).newInstance();
- LayoutPtr layout = instance;
- PropertySetter propSetter(layout);
+ try
+ {
+ ObjectPtr instance = Loader::loadClass(className).newInstance();
+ LayoutPtr layout = instance;
+ PropertySetter propSetter(layout);
- for (apr_xml_elem* currentElement = layout_element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = layout_element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- }
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ }
- propSetter.activate(p);
- return layout;
- }
- catch (Exception& oops)
- {
- LogLog::error(LOG4CXX_STR("Could not create the Layout. Reported error follows."),
- oops);
- return 0;
- }
+ propSetter.activate(p);
+ return layout;
+ }
+ catch (Exception& oops)
+ {
+ LogLog::error(LOG4CXX_STR("Could not create the Layout. Reported error follows."),
+ oops);
+ return 0;
+ }
}
/**
Used internally to parse a triggering policy
*/
ObjectPtr DOMConfigurator::parseTriggeringPolicy (
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* layout_element)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* layout_element)
{
- LogString className = subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR));
- LogLog::debug(LOG4CXX_STR("Parsing triggering policy of class: \"") + className + LOG4CXX_STR("\""));
+ LogString className = subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR));
+ LogLog::debug(LOG4CXX_STR("Parsing triggering policy of class: \"") + className + LOG4CXX_STR("\""));
- try
- {
- ObjectPtr instance = Loader::loadClass(className).newInstance();
- PropertySetter propSetter(instance);
+ try
+ {
+ ObjectPtr instance = Loader::loadClass(className).newInstance();
+ PropertySetter propSetter(instance);
- for (apr_xml_elem* currentElement = layout_element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = layout_element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- else if (tagName == FILTER_TAG)
- {
- std::vector<log4cxx::spi::FilterPtr> filters;
- parseFilters(p, utf8Decoder, currentElement, filters);
- FilterBasedTriggeringPolicyPtr fbtp(instance);
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ else if (tagName == FILTER_TAG)
+ {
+ std::vector<log4cxx::spi::FilterPtr> filters;
+ parseFilters(p, utf8Decoder, currentElement, filters);
+ FilterBasedTriggeringPolicyPtr fbtp(instance);
- if (fbtp != NULL)
- {
- for (std::vector<log4cxx::spi::FilterPtr>::iterator iter = filters.begin();
- iter != filters.end();
- iter++)
- {
- fbtp->addFilter(*iter);
- }
- }
- }
- }
+ if (fbtp != NULL)
+ {
+ for (std::vector<log4cxx::spi::FilterPtr>::iterator iter = filters.begin();
+ iter != filters.end();
+ iter++)
+ {
+ fbtp->addFilter(*iter);
+ }
+ }
+ }
+ }
- propSetter.activate(p);
- return instance;
- }
- catch (Exception& oops)
- {
- LogLog::error(LOG4CXX_STR("Could not create the TriggeringPolicy. Reported error follows."),
- oops);
- return 0;
- }
+ propSetter.activate(p);
+ return instance;
+ }
+ catch (Exception& oops)
+ {
+ LogLog::error(LOG4CXX_STR("Could not create the TriggeringPolicy. Reported error follows."),
+ oops);
+ return 0;
+ }
}
/**
Used internally to parse a triggering policy
*/
RollingPolicyPtr DOMConfigurator::parseRollingPolicy (
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* layout_element)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* layout_element)
{
- LogString className = subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR));
- LogLog::debug(LOG4CXX_STR("Parsing rolling policy of class: \"") + className + LOG4CXX_STR("\""));
+ LogString className = subst(getAttribute(utf8Decoder, layout_element, CLASS_ATTR));
+ LogLog::debug(LOG4CXX_STR("Parsing rolling policy of class: \"") + className + LOG4CXX_STR("\""));
- try
- {
- ObjectPtr instance = Loader::loadClass(className).newInstance();
- RollingPolicyPtr layout = instance;
- PropertySetter propSetter(layout);
+ try
+ {
+ ObjectPtr instance = Loader::loadClass(className).newInstance();
+ RollingPolicyPtr layout = instance;
+ PropertySetter propSetter(layout);
- for (apr_xml_elem* currentElement = layout_element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (apr_xml_elem* currentElement = layout_element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == PARAM_TAG)
- {
- setParameter(p, utf8Decoder, currentElement, propSetter);
- }
- }
+ if (tagName == PARAM_TAG)
+ {
+ setParameter(p, utf8Decoder, currentElement, propSetter);
+ }
+ }
- propSetter.activate(p);
- return layout;
- }
- catch (Exception& oops)
- {
- LogLog::error(LOG4CXX_STR("Could not create the RollingPolicy. Reported error follows."),
- oops);
- return 0;
- }
+ propSetter.activate(p);
+ return layout;
+ }
+ catch (Exception& oops)
+ {
+ LogLog::error(LOG4CXX_STR("Could not create the RollingPolicy. Reported error follows."),
+ oops);
+ return 0;
+ }
}
@@ -697,238 +697,238 @@
Used internally to parse a level element.
*/
void DOMConfigurator::parseLevel(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element, LoggerPtr logger, bool isRoot)
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element, LoggerPtr logger, bool isRoot)
{
- LogString loggerName = logger->getName();
+ LogString loggerName = logger->getName();
- if (isRoot)
- {
- loggerName = LOG4CXX_STR("root");
- }
+ if (isRoot)
+ {
+ loggerName = LOG4CXX_STR("root");
+ }
- LogString levelStr(subst(getAttribute(utf8Decoder, element, VALUE_ATTR)));
- LogLog::debug(LOG4CXX_STR("Level value for ") + loggerName + LOG4CXX_STR(" is [") + levelStr + LOG4CXX_STR("]."));
+ LogString levelStr(subst(getAttribute(utf8Decoder, element, VALUE_ATTR)));
+ LogLog::debug(LOG4CXX_STR("Level value for ") + loggerName + LOG4CXX_STR(" is [") + levelStr + LOG4CXX_STR("]."));
- if (StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("INHERITED"), LOG4CXX_STR("inherited"))
- || StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
- {
- if (isRoot)
- {
- LogLog::error(LOG4CXX_STR("Root level cannot be inherited. Ignoring directive."));
- }
- else
- {
- logger->setLevel(0);
- }
- }
- else
- {
- LogString className(subst(getAttribute(utf8Decoder, element, CLASS_ATTR)));
+ if (StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("INHERITED"), LOG4CXX_STR("inherited"))
+ || StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
+ {
+ if (isRoot)
+ {
+ LogLog::error(LOG4CXX_STR("Root level cannot be inherited. Ignoring directive."));
+ }
+ else
+ {
+ logger->setLevel(0);
+ }
+ }
+ else
+ {
+ LogString className(subst(getAttribute(utf8Decoder, element, CLASS_ATTR)));
- if (className.empty())
- {
- logger->setLevel(OptionConverter::toLevel(levelStr, Level::getDebug()));
- }
- else
- {
- LogLog::debug(LOG4CXX_STR("Desired Level sub-class: [") + className + LOG4CXX_STR("]"));
+ if (className.empty())
+ {
+ logger->setLevel(OptionConverter::toLevel(levelStr, Level::getDebug()));
+ }
+ else
+ {
+ LogLog::debug(LOG4CXX_STR("Desired Level sub-class: [") + className + LOG4CXX_STR("]"));
- try
- {
- Level::LevelClass& levelClass =
- (Level::LevelClass&)Loader::loadClass(className);
- LevelPtr level = levelClass.toLevel(levelStr);
- logger->setLevel(level);
- }
- catch (Exception& oops)
- {
- LogLog::error(
- LOG4CXX_STR("Could not create level [") + levelStr +
- LOG4CXX_STR("]. Reported error follows."),
- oops);
+ try
+ {
+ Level::LevelClass& levelClass =
+ (Level::LevelClass&)Loader::loadClass(className);
+ LevelPtr level = levelClass.toLevel(levelStr);
+ logger->setLevel(level);
+ }
+ catch (Exception& oops)
+ {
+ LogLog::error(
+ LOG4CXX_STR("Could not create level [") + levelStr +
+ LOG4CXX_STR("]. Reported error follows."),
+ oops);
- return;
- }
- catch (...)
- {
- LogLog::error(
- LOG4CXX_STR("Could not create level [") + levelStr);
+ return;
+ }
+ catch (...)
+ {
+ LogLog::error(
+ LOG4CXX_STR("Could not create level [") + levelStr);
- return;
- }
- }
- }
+ return;
+ }
+ }
+ }
- LogLog::debug(loggerName + LOG4CXX_STR(" level set to ") +
- logger->getEffectiveLevel()->toString());
+ LogLog::debug(loggerName + LOG4CXX_STR(" level set to ") +
+ logger->getEffectiveLevel()->toString());
}
void DOMConfigurator::setParameter(log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* elem,
- PropertySetter& propSetter)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* elem,
+ PropertySetter& propSetter)
{
- LogString name(subst(getAttribute(utf8Decoder, elem, NAME_ATTR)));
- LogString value(subst(getAttribute(utf8Decoder, elem, VALUE_ATTR)));
- value = subst(value);
- propSetter.setProperty(name, value, p);
+ LogString name(subst(getAttribute(utf8Decoder, elem, NAME_ATTR)));
+ LogString value(subst(getAttribute(utf8Decoder, elem, VALUE_ATTR)));
+ value = subst(value);
+ propSetter.setProperty(name, value, p);
}
void DOMConfigurator::doConfigure(const File& filename, spi::LoggerRepositoryPtr& repository1)
{
- repository1->setConfigured(true);
- this->repository = repository1;
- LogString msg(LOG4CXX_STR("DOMConfigurator configuring file "));
- msg.append(filename.getPath());
- msg.append(LOG4CXX_STR("..."));
- LogLog::debug(msg);
+ repository1->setConfigured(true);
+ this->repository = repository1;
+ LogString msg(LOG4CXX_STR("DOMConfigurator configuring file "));
+ msg.append(filename.getPath());
+ msg.append(LOG4CXX_STR("..."));
+ LogLog::debug(msg);
- loggerFactory = new DefaultLoggerFactory();
+ loggerFactory = new DefaultLoggerFactory();
- Pool p;
- apr_file_t* fd;
+ Pool p;
+ apr_file_t* fd;
- log4cxx_status_t rv = filename.open(&fd, APR_READ, APR_OS_DEFAULT, p);
+ log4cxx_status_t rv = filename.open(&fd, APR_READ, APR_OS_DEFAULT, p);
- if (rv != APR_SUCCESS)
- {
- LogString msg2(LOG4CXX_STR("Could not open file ["));
- msg2.append(filename.getPath());
- msg2.append(LOG4CXX_STR("]."));
- LogLog::error(msg2);
- }
- else
- {
- apr_xml_parser* parser = NULL;
- apr_xml_doc* doc = NULL;
- rv = apr_xml_parse_file(p.getAPRPool(), &parser, &doc, fd, 2000);
+ if (rv != APR_SUCCESS)
+ {
+ LogString msg2(LOG4CXX_STR("Could not open file ["));
+ msg2.append(filename.getPath());
+ msg2.append(LOG4CXX_STR("]."));
+ LogLog::error(msg2);
+ }
+ else
+ {
+ apr_xml_parser* parser = NULL;
+ apr_xml_doc* doc = NULL;
+ rv = apr_xml_parse_file(p.getAPRPool(), &parser, &doc, fd, 2000);
- if (rv != APR_SUCCESS)
- {
- char errbuf[2000];
- char errbufXML[2000];
- LogString msg2(LOG4CXX_STR("Error parsing file ["));
- msg2.append(filename.getPath());
- msg2.append(LOG4CXX_STR("], "));
- apr_strerror(rv, errbuf, sizeof(errbuf));
- LOG4CXX_DECODE_CHAR(lerrbuf, std::string(errbuf));
- msg2.append(lerrbuf);
+ if (rv != APR_SUCCESS)
+ {
+ char errbuf[2000];
+ char errbufXML[2000];
+ LogString msg2(LOG4CXX_STR("Error parsing file ["));
+ msg2.append(filename.getPath());
+ msg2.append(LOG4CXX_STR("], "));
+ apr_strerror(rv, errbuf, sizeof(errbuf));
+ LOG4CXX_DECODE_CHAR(lerrbuf, std::string(errbuf));
+ msg2.append(lerrbuf);
- if (parser)
- {
- apr_xml_parser_geterror(parser, errbufXML, sizeof(errbufXML));
- LOG4CXX_DECODE_CHAR(lerrbufXML, std::string(errbufXML));
- msg2.append(lerrbufXML);
- }
+ if (parser)
+ {
+ apr_xml_parser_geterror(parser, errbufXML, sizeof(errbufXML));
+ LOG4CXX_DECODE_CHAR(lerrbufXML, std::string(errbufXML));
+ msg2.append(lerrbufXML);
+ }
- LogLog::error(msg2);
- }
- else
- {
- AppenderMap appenders;
- CharsetDecoderPtr utf8Decoder(CharsetDecoder::getUTF8Decoder());
- parse(p, utf8Decoder, doc->root, doc, appenders);
- }
- }
+ LogLog::error(msg2);
+ }
+ else
+ {
+ AppenderMap appenders;
+ CharsetDecoderPtr utf8Decoder(CharsetDecoder::getUTF8Decoder());
+ parse(p, utf8Decoder, doc->root, doc, appenders);
+ }
+ }
}
void DOMConfigurator::configure(const std::string& filename)
{
- File file(filename);
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configure(const std::wstring& filename)
{
- File file(filename);
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
#endif
#if LOG4CXX_UNICHAR_API
void DOMConfigurator::configure(const std::basic_string<UniChar>& filename)
{
- File file(filename);
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
#endif
#if LOG4CXX_CFSTRING_API
void DOMConfigurator::configure(const CFStringRef& filename)
{
- File file(filename);
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
#endif
void DOMConfigurator::configureAndWatch(const std::string& filename)
{
- configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configureAndWatch(const std::wstring& filename)
{
- configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
#endif
#if LOG4CXX_UNICHAR_API
void DOMConfigurator::configureAndWatch(const std::basic_string<UniChar>& filename)
{
- configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
#endif
#if LOG4CXX_CFSTRING_API
void DOMConfigurator::configureAndWatch(const CFStringRef& filename)
{
- configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
#endif
void DOMConfigurator::configureAndWatch(const std::string& filename, long delay)
{
- File file(filename);
+ File file(filename);
#if APR_HAS_THREADS
- if ( xdog )
- {
- APRInitializer::unregisterCleanup(xdog);
- delete xdog;
- }
+ if ( xdog )
+ {
+ APRInitializer::unregisterCleanup(xdog);
+ delete xdog;
+ }
- xdog = new XMLWatchdog(file);
- APRInitializer::registerCleanup(xdog);
- xdog->setDelay(delay);
- xdog->start();
+ xdog = new XMLWatchdog(file);
+ APRInitializer::registerCleanup(xdog);
+ xdog->setDelay(delay);
+ xdog->start();
#else
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
#endif
}
#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configureAndWatch(const std::wstring& filename, long delay)
{
- File file(filename);
+ File file(filename);
#if APR_HAS_THREADS
- if ( xdog )
- {
- APRInitializer::unregisterCleanup(xdog);
- delete xdog;
- }
+ if ( xdog )
+ {
+ APRInitializer::unregisterCleanup(xdog);
+ delete xdog;
+ }
- xdog = new XMLWatchdog(file);
- APRInitializer::registerCleanup(xdog);
- xdog->setDelay(delay);
- xdog->start();
+ xdog = new XMLWatchdog(file);
+ APRInitializer::registerCleanup(xdog);
+ xdog->setDelay(delay);
+ xdog->start();
#else
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
#endif
}
#endif
@@ -936,21 +936,21 @@
#if LOG4CXX_UNICHAR_API
void DOMConfigurator::configureAndWatch(const std::basic_string<UniChar>& filename, long delay)
{
- File file(filename);
+ File file(filename);
#if APR_HAS_THREADS
- if ( xdog )
- {
- APRInitializer::unregisterCleanup(xdog);
- delete xdog;
- }
+ if ( xdog )
+ {
+ APRInitializer::unregisterCleanup(xdog);
+ delete xdog;
+ }
- xdog = new XMLWatchdog(file);
- APRInitializer::registerCleanup(xdog);
- xdog->setDelay(delay);
- xdog->start();
+ xdog = new XMLWatchdog(file);
+ APRInitializer::registerCleanup(xdog);
+ xdog->setDelay(delay);
+ xdog->start();
#else
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
#endif
}
#endif
@@ -958,154 +958,154 @@
#if LOG4CXX_CFSTRING_API
void DOMConfigurator::configureAndWatch(const CFStringRef& filename, long delay)
{
- File file(filename);
+ File file(filename);
#if APR_HAS_THREADS
- if ( xdog )
- {
- APRInitializer::unregisterCleanup(xdog);
- delete xdog;
- }
+ if ( xdog )
+ {
+ APRInitializer::unregisterCleanup(xdog);
+ delete xdog;
+ }
- xdog = new XMLWatchdog(file);
- APRInitializer::registerCleanup(xdog);
- xdog->setDelay(delay);
- xdog->start();
+ xdog = new XMLWatchdog(file);
+ APRInitializer::registerCleanup(xdog);
+ xdog->setDelay(delay);
+ xdog->start();
#else
- DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
#endif
}
#endif
void DOMConfigurator::parse(
- Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- apr_xml_doc* doc,
- AppenderMap& appenders)
+ Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ apr_xml_doc* doc,
+ AppenderMap& appenders)
{
- std::string rootElementName(element->name);
+ std::string rootElementName(element->name);
- if (rootElementName != CONFIGURATION_TAG)
- {
- if (rootElementName == OLD_CONFIGURATION_TAG)
- {
- //LogLog::warn(LOG4CXX_STR("The <")+String(OLD_CONFIGURATION_TAG)+
- // LOG4CXX_STR("> element has been deprecated."));
- //LogLog::warn(LOG4CXX_STR("Use the <")+String(CONFIGURATION_TAG)+
- // LOG4CXX_STR("> element instead."));
- }
- else
- {
- LogLog::error(LOG4CXX_STR("DOM element is - not a <configuration> element."));
- return;
- }
- }
+ if (rootElementName != CONFIGURATION_TAG)
+ {
+ if (rootElementName == OLD_CONFIGURATION_TAG)
+ {
+ //LogLog::warn(LOG4CXX_STR("The <")+String(OLD_CONFIGURATION_TAG)+
+ // LOG4CXX_STR("> element has been deprecated."));
+ //LogLog::warn(LOG4CXX_STR("Use the <")+String(CONFIGURATION_TAG)+
+ // LOG4CXX_STR("> element instead."));
+ }
+ else
+ {
+ LogLog::error(LOG4CXX_STR("DOM element is - not a <configuration> element."));
+ return;
+ }
+ }
- LogString debugAttrib = subst(getAttribute(utf8Decoder, element, INTERNAL_DEBUG_ATTR));
+ LogString debugAttrib = subst(getAttribute(utf8Decoder, element, INTERNAL_DEBUG_ATTR));
- static const LogString NuLL(LOG4CXX_STR("NULL"));
- LogLog::debug(LOG4CXX_STR("debug attribute= \"") + debugAttrib + LOG4CXX_STR("\"."));
+ static const LogString NuLL(LOG4CXX_STR("NULL"));
+ LogLog::debug(LOG4CXX_STR("debug attribute= \"") + debugAttrib + LOG4CXX_STR("\"."));
- // if the log4j.dtd is not specified in the XML file, then the
- // "debug" attribute is returned as the empty string.
- if (!debugAttrib.empty() && debugAttrib != NuLL)
- {
- LogLog::setInternalDebugging(OptionConverter::toBoolean(debugAttrib, true));
- }
- else
- {
- LogLog::debug(LOG4CXX_STR("Ignoring internalDebug attribute."));
- }
+ // if the log4j.dtd is not specified in the XML file, then the
+ // "debug" attribute is returned as the empty string.
+ if (!debugAttrib.empty() && debugAttrib != NuLL)
+ {
+ LogLog::setInternalDebugging(OptionConverter::toBoolean(debugAttrib, true));
+ }
+ else
+ {
+ LogLog::debug(LOG4CXX_STR("Ignoring internalDebug attribute."));
+ }
- LogString confDebug = subst(getAttribute(utf8Decoder, element, CONFIG_DEBUG_ATTR));
+ LogString confDebug = subst(getAttribute(utf8Decoder, element, CONFIG_DEBUG_ATTR));
- if (!confDebug.empty() && confDebug != NuLL)
- {
- LogLog::warn(LOG4CXX_STR("The \"configDebug\" attribute is deprecated."));
- LogLog::warn(LOG4CXX_STR("Use the \"internalDebug\" attribute instead."));
- LogLog::setInternalDebugging(OptionConverter::toBoolean(confDebug, true));
- }
+ if (!confDebug.empty() && confDebug != NuLL)
+ {
+ LogLog::warn(LOG4CXX_STR("The \"configDebug\" attribute is deprecated."));
+ LogLog::warn(LOG4CXX_STR("Use the \"internalDebug\" attribute instead."));
+ LogLog::setInternalDebugging(OptionConverter::toBoolean(confDebug, true));
+ }
- LogString thresholdStr = subst(getAttribute(utf8Decoder, element, THRESHOLD_ATTR));
- LogLog::debug(LOG4CXX_STR("Threshold =\"") + thresholdStr + LOG4CXX_STR("\"."));
+ LogString thresholdStr = subst(getAttribute(utf8Decoder, element, THRESHOLD_ATTR));
+ LogLog::debug(LOG4CXX_STR("Threshold =\"") + thresholdStr + LOG4CXX_STR("\"."));
- if (!thresholdStr.empty() && thresholdStr != NuLL)
- {
- repository->setThreshold(thresholdStr);
- }
+ if (!thresholdStr.empty() && thresholdStr != NuLL)
+ {
+ repository->setThreshold(thresholdStr);
+ }
- LogString strstrValue = subst(getAttribute(utf8Decoder, element, STRINGSTREAM_ATTR));
- LogLog::debug(LOG4CXX_STR("Stringstream =\"") + strstrValue + LOG4CXX_STR("\"."));
+ LogString strstrValue = subst(getAttribute(utf8Decoder, element, STRINGSTREAM_ATTR));
+ LogLog::debug(LOG4CXX_STR("Stringstream =\"") + strstrValue + LOG4CXX_STR("\"."));
- if (!strstrValue.empty() && strstrValue != NuLL)
- {
- MessageBufferUseStaticStream();
- }
+ if (!strstrValue.empty() && strstrValue != NuLL)
+ {
+ MessageBufferUseStaticStream();
+ }
- apr_xml_elem* currentElement;
+ apr_xml_elem* currentElement;
- for (currentElement = element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (currentElement = element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == CATEGORY_FACTORY_TAG)
- {
- parseLoggerFactory(p, utf8Decoder, currentElement);
- }
- }
+ if (tagName == CATEGORY_FACTORY_TAG)
+ {
+ parseLoggerFactory(p, utf8Decoder, currentElement);
+ }
+ }
- for (currentElement = element->first_child;
- currentElement;
- currentElement = currentElement->next)
- {
- std::string tagName(currentElement->name);
+ for (currentElement = element->first_child;
+ currentElement;
+ currentElement = currentElement->next)
+ {
+ std::string tagName(currentElement->name);
- if (tagName == CATEGORY || tagName == LOGGER)
- {
- parseLogger(p, utf8Decoder, currentElement, doc, appenders);
- }
- else if (tagName == ROOT_TAG)
- {
- parseRoot(p, utf8Decoder, currentElement, doc, appenders);
- }
- }
+ if (tagName == CATEGORY || tagName == LOGGER)
+ {
+ parseLogger(p, utf8Decoder, currentElement, doc, appenders);
+ }
+ else if (tagName == ROOT_TAG)
+ {
+ parseRoot(p, utf8Decoder, currentElement, doc, appenders);
+ }
+ }
}
LogString DOMConfigurator::subst(const LogString& value)
{
- try
- {
- return OptionConverter::substVars(value, props);
- }
- catch (IllegalArgumentException& e)
- {
- LogLog::warn(LOG4CXX_STR("Could not perform variable substitution."), e);
- return value;
- }
+ try
+ {
+ return OptionConverter::substVars(value, props);
+ }
+ catch (IllegalArgumentException& e)
+ {
+ LogLog::warn(LOG4CXX_STR("Could not perform variable substitution."), e);
+ return value;
+ }
}
LogString DOMConfigurator::getAttribute(
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- const std::string& attrName)
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ const std::string& attrName)
{
- LogString attrValue;
+ LogString attrValue;
- for (apr_xml_attr* attr = element->attr;
- attr;
- attr = attr->next)
- {
- if (attrName == attr->name)
- {
- ByteBuffer buf((char*) attr->value, strlen(attr->value));
- utf8Decoder->decode(buf, attrValue);
- }
- }
+ for (apr_xml_attr* attr = element->attr;
+ attr;
+ attr = attr->next)
+ {
+ if (attrName == attr->name)
+ {
+ ByteBuffer buf((char*) attr->value, strlen(attr->value));
+ utf8Decoder->decode(buf, attrValue);
+ }
+ }
- return attrValue;
+ return attrValue;
}
diff --git a/src/main/cpp/exception.cpp b/src/main/cpp/exception.cpp
index f8bdd0f..0023a9a 100644
--- a/src/main/cpp/exception.cpp
+++ b/src/main/cpp/exception.cpp
@@ -28,246 +28,246 @@
Exception::Exception(const LogString& msg1)
{
- std::string m;
- Transcoder::encode(msg1, m);
- size_t len = m.size();
+ std::string m;
+ Transcoder::encode(msg1, m);
+ size_t len = m.size();
- if (len > MSG_SIZE)
- {
- len = MSG_SIZE;
- }
+ if (len > MSG_SIZE)
+ {
+ len = MSG_SIZE;
+ }
#if defined(__STDC_LIB_EXT1__) || defined(__STDC_SECURE_LIB__)
- memcpy_s(msg, sizeof msg, m.data(), len);
+ memcpy_s(msg, sizeof msg, m.data(), len);
#else
- memcpy(msg, m.data(), len);
+ memcpy(msg, m.data(), len);
#endif
- msg[len] = 0;
+ msg[len] = 0;
}
Exception::Exception(const char* m)
{
#if defined(__STDC_LIB_EXT1__) || defined(__STDC_SECURE_LIB__)
- strncpy_s(msg, sizeof msg, m, MSG_SIZE);
+ strncpy_s(msg, sizeof msg, m, MSG_SIZE);
#else
- strncpy(msg, m, MSG_SIZE);
+ strncpy(msg, m, MSG_SIZE);
#endif
- msg[MSG_SIZE] = 0;
+ msg[MSG_SIZE] = 0;
}
Exception::Exception(const Exception& src) : std::exception()
{
#if defined(__STDC_LIB_EXT1__) || defined(__STDC_SECURE_LIB__)
- strcpy_s(msg, sizeof msg, src.msg);
+ strcpy_s(msg, sizeof msg, src.msg);
#else
- strcpy(msg, src.msg);
+ strcpy(msg, src.msg);
#endif
}
Exception& Exception::operator=(const Exception& src)
{
#if defined(__STDC_LIB_EXT1__) || defined(__STDC_SECURE_LIB__)
- strcpy_s(msg, sizeof msg, src.msg);
+ strcpy_s(msg, sizeof msg, src.msg);
#else
- strcpy(msg, src.msg);
+ strcpy(msg, src.msg);
#endif
- return *this;
+ return *this;
}
const char* Exception::what() const throw()
{
- return msg;
+ return msg;
}
RuntimeException::RuntimeException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
RuntimeException::RuntimeException(const LogString& msg1)
- : Exception(msg1)
+ : Exception(msg1)
{
}
RuntimeException::RuntimeException(const RuntimeException& src)
- : Exception(src)
+ : Exception(src)
{
}
RuntimeException& RuntimeException::operator=(const RuntimeException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString RuntimeException::formatMessage(log4cxx_status_t stat)
{
- LogString s(LOG4CXX_STR("RuntimeException: return code = "));
- Pool p;
- StringHelper::toString(stat, p, s);
- return s;
+ LogString s(LOG4CXX_STR("RuntimeException: return code = "));
+ Pool p;
+ StringHelper::toString(stat, p, s);
+ return s;
}
NullPointerException::NullPointerException(const LogString& msg1)
- : RuntimeException(msg1)
+ : RuntimeException(msg1)
{
}
NullPointerException::NullPointerException(const NullPointerException& src)
- : RuntimeException(src)
+ : RuntimeException(src)
{
}
NullPointerException& NullPointerException::operator=(const NullPointerException& src)
{
- RuntimeException::operator=(src);
- return *this;
+ RuntimeException::operator=(src);
+ return *this;
}
IllegalArgumentException::IllegalArgumentException(const LogString& msg1)
- : RuntimeException(msg1)
+ : RuntimeException(msg1)
{
}
IllegalArgumentException::IllegalArgumentException(const IllegalArgumentException& src)
- : RuntimeException(src)
+ : RuntimeException(src)
{
}
IllegalArgumentException& IllegalArgumentException::operator=(const IllegalArgumentException& src)
{
- RuntimeException::operator=(src);
- return *this;
+ RuntimeException::operator=(src);
+ return *this;
}
IOException::IOException()
- : Exception(LOG4CXX_STR("IO exception"))
+ : Exception(LOG4CXX_STR("IO exception"))
{
}
IOException::IOException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
IOException::IOException(const LogString& msg1)
- : Exception(msg1)
+ : Exception(msg1)
{
}
IOException::IOException(const IOException& src)
- : Exception(src)
+ : Exception(src)
{
}
IOException& IOException::operator=(const IOException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString IOException::formatMessage(log4cxx_status_t stat)
{
- LogString s(LOG4CXX_STR("IO Exception : status code = "));
- Pool p;
- StringHelper::toString(stat, p, s);
- return s;
+ LogString s(LOG4CXX_STR("IO Exception : status code = "));
+ Pool p;
+ StringHelper::toString(stat, p, s);
+ return s;
}
MissingResourceException::MissingResourceException(const LogString& key)
- : Exception(formatMessage(key))
+ : Exception(formatMessage(key))
{
}
MissingResourceException::MissingResourceException(const MissingResourceException& src)
- : Exception(src)
+ : Exception(src)
{
}
MissingResourceException& MissingResourceException::operator=(const MissingResourceException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString MissingResourceException::formatMessage(const LogString& key)
{
- LogString s(LOG4CXX_STR("MissingResourceException: resource key = \""));
- s.append(key);
- s.append(LOG4CXX_STR("\"."));
- return s;
+ LogString s(LOG4CXX_STR("MissingResourceException: resource key = \""));
+ s.append(key);
+ s.append(LOG4CXX_STR("\"."));
+ return s;
}
PoolException::PoolException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
PoolException::PoolException(const PoolException& src)
- : Exception(src)
+ : Exception(src)
{
}
PoolException& PoolException::operator=(const PoolException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString PoolException::formatMessage(log4cxx_status_t)
{
- return LOG4CXX_STR("Pool exception");
+ return LOG4CXX_STR("Pool exception");
}
TranscoderException::TranscoderException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
TranscoderException::TranscoderException(const TranscoderException& src)
- : Exception(src)
+ : Exception(src)
{
}
TranscoderException& TranscoderException::operator=(const TranscoderException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString TranscoderException::formatMessage(log4cxx_status_t)
{
- return LOG4CXX_STR("Transcoder exception");
+ return LOG4CXX_STR("Transcoder exception");
}
MutexException::MutexException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
MutexException::MutexException(const MutexException& src)
- : Exception(src)
+ : Exception(src)
{
}
MutexException& MutexException::operator=(const MutexException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString MutexException::formatMessage(log4cxx_status_t stat)
{
- LogString s(LOG4CXX_STR("Mutex exception: stat = "));
- Pool p;
- StringHelper::toString(stat, p, s);
- return s;
+ LogString s(LOG4CXX_STR("Mutex exception: stat = "));
+ Pool p;
+ StringHelper::toString(stat, p, s);
+ return s;
}
InterruptedException::InterruptedException() : Exception(LOG4CXX_STR("Thread was interrupted"))
@@ -275,146 +275,146 @@
}
InterruptedException::InterruptedException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
InterruptedException::InterruptedException(const InterruptedException& src)
- : Exception(src)
+ : Exception(src)
{
}
InterruptedException& InterruptedException::operator=(const InterruptedException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString InterruptedException::formatMessage(log4cxx_status_t stat)
{
- LogString s(LOG4CXX_STR("InterruptedException: stat = "));
- Pool p;
- StringHelper::toString(stat, p, s);
- return s;
+ LogString s(LOG4CXX_STR("InterruptedException: stat = "));
+ Pool p;
+ StringHelper::toString(stat, p, s);
+ return s;
}
ThreadException::ThreadException(log4cxx_status_t stat)
- : Exception(formatMessage(stat))
+ : Exception(formatMessage(stat))
{
}
ThreadException::ThreadException(const LogString& msg)
- : Exception(msg)
+ : Exception(msg)
{
}
ThreadException::ThreadException(const ThreadException& src)
- : Exception(src)
+ : Exception(src)
{
}
ThreadException& ThreadException::operator=(const ThreadException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString ThreadException::formatMessage(log4cxx_status_t stat)
{
- LogString s(LOG4CXX_STR("Thread exception: stat = "));
- Pool p;
- StringHelper::toString(stat, p, s);
- return s;
+ LogString s(LOG4CXX_STR("Thread exception: stat = "));
+ Pool p;
+ StringHelper::toString(stat, p, s);
+ return s;
}
IllegalMonitorStateException::IllegalMonitorStateException(const LogString& msg1)
- : Exception(msg1)
+ : Exception(msg1)
{
}
IllegalMonitorStateException::IllegalMonitorStateException(const IllegalMonitorStateException& src)
- : Exception(src)
+ : Exception(src)
{
}
IllegalMonitorStateException& IllegalMonitorStateException::operator=(const IllegalMonitorStateException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
InstantiationException::InstantiationException(const LogString& msg1)
- : Exception(msg1)
+ : Exception(msg1)
{
}
InstantiationException::InstantiationException(const InstantiationException& src)
- : Exception(src)
+ : Exception(src)
{
}
InstantiationException& InstantiationException::operator=(const InstantiationException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
ClassNotFoundException::ClassNotFoundException(const LogString& className)
- : Exception(formatMessage(className))
+ : Exception(formatMessage(className))
{
}
ClassNotFoundException::ClassNotFoundException(const ClassNotFoundException& src)
- : Exception(src)
+ : Exception(src)
{
}
ClassNotFoundException& ClassNotFoundException::operator=(const ClassNotFoundException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
LogString ClassNotFoundException::formatMessage(const LogString& className)
{
- LogString s(LOG4CXX_STR("Class not found: "));
- s.append(className);
- return s;
+ LogString s(LOG4CXX_STR("Class not found: "));
+ s.append(className);
+ return s;
}
NoSuchElementException::NoSuchElementException()
- : Exception(LOG4CXX_STR("No such element"))
+ : Exception(LOG4CXX_STR("No such element"))
{
}
NoSuchElementException::NoSuchElementException(const NoSuchElementException& src)
- : Exception(src)
+ : Exception(src)
{
}
NoSuchElementException& NoSuchElementException::operator=(const NoSuchElementException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
IllegalStateException::IllegalStateException()
- : Exception(LOG4CXX_STR("Illegal state"))
+ : Exception(LOG4CXX_STR("Illegal state"))
{
}
IllegalStateException::IllegalStateException(const IllegalStateException& src)
- : Exception(src)
+ : Exception(src)
{
}
IllegalStateException& IllegalStateException::operator=(const IllegalStateException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
SocketException::SocketException(const LogString& msg) : IOException(msg)
@@ -426,14 +426,14 @@
}
SocketException::SocketException(const SocketException& src)
- : IOException(src)
+ : IOException(src)
{
}
SocketException& SocketException::operator=(const SocketException& src)
{
- IOException::operator=(src);
- return *this;
+ IOException::operator=(src);
+ return *this;
}
ConnectException::ConnectException(log4cxx_status_t status) : SocketException(status)
@@ -441,14 +441,14 @@
}
ConnectException::ConnectException(const ConnectException& src)
- : SocketException(src)
+ : SocketException(src)
{
}
ConnectException& ConnectException::operator=(const ConnectException& src)
{
- SocketException::operator=(src);
- return *this;
+ SocketException::operator=(src);
+ return *this;
}
ClosedChannelException::ClosedChannelException() : SocketException(LOG4CXX_STR("Attempt to write to closed socket"))
@@ -456,14 +456,14 @@
}
ClosedChannelException::ClosedChannelException(const ClosedChannelException& src)
- : SocketException(src)
+ : SocketException(src)
{
}
ClosedChannelException& ClosedChannelException::operator=(const ClosedChannelException& src)
{
- SocketException::operator=(src);
- return *this;
+ SocketException::operator=(src);
+ return *this;
}
BindException::BindException(log4cxx_status_t status) : SocketException(status)
@@ -471,14 +471,14 @@
}
BindException::BindException(const BindException& src)
- : SocketException(src)
+ : SocketException(src)
{
}
BindException& BindException::operator=(const BindException& src)
{
- SocketException::operator=(src);
- return *this;
+ SocketException::operator=(src);
+ return *this;
}
InterruptedIOException::InterruptedIOException(const LogString& msg) : IOException(msg)
@@ -486,28 +486,28 @@
}
InterruptedIOException::InterruptedIOException(const InterruptedIOException& src)
- : IOException(src)
+ : IOException(src)
{
}
InterruptedIOException& InterruptedIOException::operator=(const InterruptedIOException& src)
{
- IOException::operator=(src);
- return *this;
+ IOException::operator=(src);
+ return *this;
}
SocketTimeoutException::SocketTimeoutException()
- : InterruptedIOException(LOG4CXX_STR("SocketTimeoutException"))
+ : InterruptedIOException(LOG4CXX_STR("SocketTimeoutException"))
{
}
SocketTimeoutException::SocketTimeoutException(const SocketTimeoutException& src)
- : InterruptedIOException(src)
+ : InterruptedIOException(src)
{
}
SocketTimeoutException& SocketTimeoutException::operator=(const SocketTimeoutException& src)
{
- InterruptedIOException::operator=(src);
- return *this;
+ InterruptedIOException::operator=(src);
+ return *this;
}
diff --git a/src/main/cpp/fallbackerrorhandler.cpp b/src/main/cpp/fallbackerrorhandler.cpp
index 36509cc..7e59270 100644
--- a/src/main/cpp/fallbackerrorhandler.cpp
+++ b/src/main/cpp/fallbackerrorhandler.cpp
@@ -31,72 +31,72 @@
IMPLEMENT_LOG4CXX_OBJECT(FallbackErrorHandler)
FallbackErrorHandler::FallbackErrorHandler()
- : backup(), primary(), loggers()
+ : backup(), primary(), loggers()
{
}
void FallbackErrorHandler::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void FallbackErrorHandler::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void FallbackErrorHandler::setLogger(const LoggerPtr& logger)
{
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Adding logger ["))
- + logger->getName() + LOG4CXX_STR("]."));
- loggers.push_back(logger);
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Adding logger ["))
+ + logger->getName() + LOG4CXX_STR("]."));
+ loggers.push_back(logger);
}
void FallbackErrorHandler::error(const LogString& message,
- const std::exception& e,
- int errorCode) const
+ const std::exception& e,
+ int errorCode) const
{
- error(message, e, errorCode, 0);
+ error(message, e, errorCode, 0);
}
void FallbackErrorHandler::error(const LogString& message,
- const std::exception& e,
- int, const spi::LoggingEventPtr&) const
+ const std::exception& e,
+ int, const spi::LoggingEventPtr&) const
{
- LogLog::debug(((LogString) LOG4CXX_STR("FB: The following error reported: "))
- + message, e);
- LogLog::debug(LOG4CXX_STR("FB: INITIATING FALLBACK PROCEDURE."));
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: The following error reported: "))
+ + message, e);
+ LogLog::debug(LOG4CXX_STR("FB: INITIATING FALLBACK PROCEDURE."));
- for (size_t i = 0; i < loggers.size(); i++)
- {
- LoggerPtr& l = (LoggerPtr&)loggers.at(i);
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Searching for ["))
- + primary->getName() + LOG4CXX_STR("] in logger [")
- + l->getName() + LOG4CXX_STR("]."));
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Replacing ["))
- + primary->getName() + LOG4CXX_STR("] by [")
- + backup->getName() + LOG4CXX_STR("] in logger [")
- + l->getName() + LOG4CXX_STR("]."));
- l->removeAppender(primary);
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Adding appender ["))
- + backup->getName() + LOG4CXX_STR("] to logger ")
- + l->getName());
- l->addAppender(backup);
- }
+ for (size_t i = 0; i < loggers.size(); i++)
+ {
+ LoggerPtr& l = (LoggerPtr&)loggers.at(i);
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Searching for ["))
+ + primary->getName() + LOG4CXX_STR("] in logger [")
+ + l->getName() + LOG4CXX_STR("]."));
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Replacing ["))
+ + primary->getName() + LOG4CXX_STR("] by [")
+ + backup->getName() + LOG4CXX_STR("] in logger [")
+ + l->getName() + LOG4CXX_STR("]."));
+ l->removeAppender(primary);
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Adding appender ["))
+ + backup->getName() + LOG4CXX_STR("] to logger ")
+ + l->getName());
+ l->addAppender(backup);
+ }
}
void FallbackErrorHandler::setAppender(const AppenderPtr& primary1)
{
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Setting primary appender to ["))
- + primary1->getName() + LOG4CXX_STR("]."));
- this->primary = primary1;
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Setting primary appender to ["))
+ + primary1->getName() + LOG4CXX_STR("]."));
+ this->primary = primary1;
}
void FallbackErrorHandler::setBackupAppender(const AppenderPtr& backup1)
{
- LogLog::debug(((LogString) LOG4CXX_STR("FB: Setting backup appender to ["))
- + backup1->getName() + LOG4CXX_STR("]."));
- this->backup = backup1;
+ LogLog::debug(((LogString) LOG4CXX_STR("FB: Setting backup appender to ["))
+ + backup1->getName() + LOG4CXX_STR("]."));
+ this->backup = backup1;
}
void FallbackErrorHandler::activateOptions(Pool&)
diff --git a/src/main/cpp/file.cpp b/src/main/cpp/file.cpp
index bddea7e..b5d09b8 100644
--- a/src/main/cpp/file.cpp
+++ b/src/main/cpp/file.cpp
@@ -34,81 +34,81 @@
template<class S>
static LogString decodeLS(const S* src)
{
- LogString dst;
+ LogString dst;
- if (src != 0)
- {
- Transcoder::decode(src, dst);
- }
+ if (src != 0)
+ {
+ Transcoder::decode(src, dst);
+ }
- return dst;
+ return dst;
}
template<class S>
static LogString decodeLS(const std::basic_string<S>& src)
{
- LogString dst;
- Transcoder::decode(src, dst);
- return dst;
+ LogString dst;
+ Transcoder::decode(src, dst);
+ return dst;
}
File::File(const std::string& name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
File::File(const char* name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
#if LOG4CXX_WCHAR_T_API
File::File(const std::wstring& name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
File::File(const wchar_t* name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
#endif
#if LOG4CXX_UNICHAR_API
File::File(const std::basic_string<UniChar>& name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
File::File(const UniChar* name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
#endif
#if LOG4CXX_CFSTRING_API
File::File(const CFStringRef& name1)
- : path(decodeLS(name1))
+ : path(decodeLS(name1))
{
}
#endif
File::File(const File& src)
- : path(src.path)
+ : path(src.path)
{
}
File& File::operator=(const File& src)
{
- if (this == &src)
- {
- return *this;
- }
+ if (this == &src)
+ {
+ return *this;
+ }
- path.assign(src.path);
+ path.assign(src.path);
- return *this;
+ return *this;
}
@@ -119,194 +119,194 @@
LogString File::getPath() const
{
- return path;
+ return path;
}
File& File::setPath(const LogString& newName)
{
- path.assign(newName);
- return *this;
+ path.assign(newName);
+ return *this;
}
LogString File::getName() const
{
- const logchar slashes[] = { 0x2F, 0x5C, 0 };
- size_t lastSlash = path.find_last_of(slashes);
+ const logchar slashes[] = { 0x2F, 0x5C, 0 };
+ size_t lastSlash = path.find_last_of(slashes);
- if (lastSlash != LogString::npos)
- {
- return path.substr(lastSlash + 1);
- }
+ if (lastSlash != LogString::npos)
+ {
+ return path.substr(lastSlash + 1);
+ }
- return path;
+ return path;
}
char* File::getPath(Pool& p) const
{
- int style = APR_FILEPATH_ENCODING_UNKNOWN;
- apr_filepath_encoding(&style, p.getAPRPool());
- char* retval = NULL;
+ int style = APR_FILEPATH_ENCODING_UNKNOWN;
+ apr_filepath_encoding(&style, p.getAPRPool());
+ char* retval = NULL;
- if (style == APR_FILEPATH_ENCODING_UTF8)
- {
- retval = Transcoder::encodeUTF8(path, p);
- }
- else
- {
- retval = Transcoder::encode(path, p);
- }
+ if (style == APR_FILEPATH_ENCODING_UTF8)
+ {
+ retval = Transcoder::encodeUTF8(path, p);
+ }
+ else
+ {
+ retval = Transcoder::encode(path, p);
+ }
- return retval;
+ return retval;
}
log4cxx_status_t File::open(apr_file_t** file, int flags,
- int perm, Pool& p) const
+ int perm, Pool& p) const
{
- return apr_file_open(file, getPath(p), flags, perm, p.getAPRPool());
+ return apr_file_open(file, getPath(p), flags, perm, p.getAPRPool());
}
bool File::exists(Pool& p) const
{
- apr_finfo_t finfo;
- apr_status_t rv = apr_stat(&finfo, getPath(p),
- 0, p.getAPRPool());
- return rv == APR_SUCCESS;
+ apr_finfo_t finfo;
+ apr_status_t rv = apr_stat(&finfo, getPath(p),
+ 0, p.getAPRPool());
+ return rv == APR_SUCCESS;
}
char* File::convertBackSlashes(char* src)
{
- for (char* c = src; *c != 0; c++)
- {
- if (*c == '\\')
- {
- *c = '/';
- }
- }
+ for (char* c = src; *c != 0; c++)
+ {
+ if (*c == '\\')
+ {
+ *c = '/';
+ }
+ }
- return src;
+ return src;
}
bool File::deleteFile(Pool& p) const
{
- apr_status_t rv = apr_file_remove(convertBackSlashes(getPath(p)),
- p.getAPRPool());
- return rv == APR_SUCCESS;
+ apr_status_t rv = apr_file_remove(convertBackSlashes(getPath(p)),
+ p.getAPRPool());
+ return rv == APR_SUCCESS;
}
bool File::renameTo(const File& dest, Pool& p) const
{
- apr_status_t rv = apr_file_rename(convertBackSlashes(getPath(p)),
- convertBackSlashes(dest.getPath(p)),
- p.getAPRPool());
- return rv == APR_SUCCESS;
+ apr_status_t rv = apr_file_rename(convertBackSlashes(getPath(p)),
+ convertBackSlashes(dest.getPath(p)),
+ p.getAPRPool());
+ return rv == APR_SUCCESS;
}
size_t File::length(Pool& pool) const
{
- apr_finfo_t finfo;
- apr_status_t rv = apr_stat(&finfo, getPath(pool),
- APR_FINFO_SIZE, pool.getAPRPool());
+ apr_finfo_t finfo;
+ apr_status_t rv = apr_stat(&finfo, getPath(pool),
+ APR_FINFO_SIZE, pool.getAPRPool());
- if (rv == APR_SUCCESS)
- {
- return (size_t) finfo.size;
- }
+ if (rv == APR_SUCCESS)
+ {
+ return (size_t) finfo.size;
+ }
- return 0;
+ return 0;
}
log4cxx_time_t File::lastModified(Pool& pool) const
{
- apr_finfo_t finfo;
- apr_status_t rv = apr_stat(&finfo, getPath(pool),
- APR_FINFO_MTIME, pool.getAPRPool());
+ apr_finfo_t finfo;
+ apr_status_t rv = apr_stat(&finfo, getPath(pool),
+ APR_FINFO_MTIME, pool.getAPRPool());
- if (rv == APR_SUCCESS)
- {
- return finfo.mtime;
- }
+ if (rv == APR_SUCCESS)
+ {
+ return finfo.mtime;
+ }
- return 0;
+ return 0;
}
std::vector<LogString> File::list(Pool& p) const
{
- apr_dir_t* dir;
- apr_finfo_t entry;
- std::vector<LogString> filenames;
+ apr_dir_t* dir;
+ apr_finfo_t entry;
+ std::vector<LogString> filenames;
- apr_status_t stat = apr_dir_open(&dir,
- convertBackSlashes(getPath(p)),
- p.getAPRPool());
+ apr_status_t stat = apr_dir_open(&dir,
+ convertBackSlashes(getPath(p)),
+ p.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- int style = APR_FILEPATH_ENCODING_UNKNOWN;
- apr_filepath_encoding(&style, p.getAPRPool());
- stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+ if (stat == APR_SUCCESS)
+ {
+ int style = APR_FILEPATH_ENCODING_UNKNOWN;
+ apr_filepath_encoding(&style, p.getAPRPool());
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
- while (stat == APR_SUCCESS)
- {
- if (entry.name != NULL)
- {
- LogString filename;
+ while (stat == APR_SUCCESS)
+ {
+ if (entry.name != NULL)
+ {
+ LogString filename;
- if (style == APR_FILEPATH_ENCODING_UTF8)
- {
- Transcoder::decodeUTF8(entry.name, filename);
- }
- else
- {
- Transcoder::decode(entry.name, filename);
- }
+ if (style == APR_FILEPATH_ENCODING_UTF8)
+ {
+ Transcoder::decodeUTF8(entry.name, filename);
+ }
+ else
+ {
+ Transcoder::decode(entry.name, filename);
+ }
- filenames.push_back(filename);
- }
+ filenames.push_back(filename);
+ }
- stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
- }
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+ }
- stat = apr_dir_close(dir);
- }
+ stat = apr_dir_close(dir);
+ }
- return filenames;
+ return filenames;
}
LogString File::getParent(Pool&) const
{
- LogString::size_type slashPos = path.rfind(LOG4CXX_STR('/'));
- LogString::size_type backPos = path.rfind(LOG4CXX_STR('\\'));
+ LogString::size_type slashPos = path.rfind(LOG4CXX_STR('/'));
+ LogString::size_type backPos = path.rfind(LOG4CXX_STR('\\'));
- if (slashPos == LogString::npos)
- {
- slashPos = backPos;
- }
- else
- {
- if (backPos != LogString::npos && backPos > slashPos)
- {
- slashPos = backPos;
- }
- }
+ if (slashPos == LogString::npos)
+ {
+ slashPos = backPos;
+ }
+ else
+ {
+ if (backPos != LogString::npos && backPos > slashPos)
+ {
+ slashPos = backPos;
+ }
+ }
- LogString parent;
+ LogString parent;
- if (slashPos != LogString::npos && slashPos > 0)
- {
- parent.assign(path, 0, slashPos);
- }
+ if (slashPos != LogString::npos && slashPos > 0)
+ {
+ parent.assign(path, 0, slashPos);
+ }
- return parent;
+ return parent;
}
bool File::mkdirs(Pool& p) const
{
- apr_status_t stat = apr_dir_make_recursive(convertBackSlashes(getPath(p)),
- APR_OS_DEFAULT, p.getAPRPool());
- return stat == APR_SUCCESS;
+ apr_status_t stat = apr_dir_make_recursive(convertBackSlashes(getPath(p)),
+ APR_OS_DEFAULT, p.getAPRPool());
+ return stat == APR_SUCCESS;
}
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index 79af437..b83f0e1 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -37,155 +37,155 @@
FileAppender::FileAppender()
{
- LOCK_W sync(mutex);
- fileAppend = true;
- bufferedIO = false;
- bufferSize = 8 * 1024;
+ LOCK_W sync(mutex);
+ fileAppend = true;
+ bufferedIO = false;
+ bufferSize = 8 * 1024;
}
FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1,
- bool append1, bool bufferedIO1, int bufferSize1)
- : WriterAppender(layout1)
+ bool append1, bool bufferedIO1, int bufferSize1)
+ : WriterAppender(layout1)
{
- {
- LOCK_W sync(mutex);
- fileAppend = append1;
- fileName = fileName1;
- bufferedIO = bufferedIO1;
- bufferSize = bufferSize1;
- }
- Pool p;
- activateOptions(p);
+ {
+ LOCK_W sync(mutex);
+ fileAppend = append1;
+ fileName = fileName1;
+ bufferedIO = bufferedIO1;
+ bufferSize = bufferSize1;
+ }
+ Pool p;
+ activateOptions(p);
}
FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1,
- bool append1)
- : WriterAppender(layout1)
+ bool append1)
+ : WriterAppender(layout1)
{
- {
- LOCK_W sync(mutex);
- fileAppend = append1;
- fileName = fileName1;
- bufferedIO = false;
- bufferSize = 8 * 1024;
- }
- Pool p;
- activateOptions(p);
+ {
+ LOCK_W sync(mutex);
+ fileAppend = append1;
+ fileName = fileName1;
+ bufferedIO = false;
+ bufferSize = 8 * 1024;
+ }
+ Pool p;
+ activateOptions(p);
}
FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1)
- : WriterAppender(layout1)
+ : WriterAppender(layout1)
{
- {
- LOCK_W sync(mutex);
- fileAppend = true;
- fileName = fileName1;
- bufferedIO = false;
- bufferSize = 8 * 1024;
- }
- Pool p;
- activateOptions(p);
+ {
+ LOCK_W sync(mutex);
+ fileAppend = true;
+ fileName = fileName1;
+ bufferedIO = false;
+ bufferSize = 8 * 1024;
+ }
+ Pool p;
+ activateOptions(p);
}
FileAppender::~FileAppender()
{
- finalize();
+ finalize();
}
void FileAppender::setAppend(bool fileAppend1)
{
- LOCK_W sync(mutex);
- this->fileAppend = fileAppend1;
+ LOCK_W sync(mutex);
+ this->fileAppend = fileAppend1;
}
void FileAppender::setFile(const LogString& file)
{
- LOCK_W sync(mutex);
- fileName = file;
+ LOCK_W sync(mutex);
+ fileName = file;
}
void FileAppender::setBufferedIO(bool bufferedIO1)
{
- LOCK_W sync(mutex);
- this->bufferedIO = bufferedIO1;
+ LOCK_W sync(mutex);
+ this->bufferedIO = bufferedIO1;
- if (bufferedIO1)
- {
- setImmediateFlush(false);
- }
+ if (bufferedIO1)
+ {
+ setImmediateFlush(false);
+ }
}
void FileAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"), LOG4CXX_STR("file"))
- || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
- {
- LOCK_W sync(mutex);
- fileName = stripDuplicateBackslashes(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("APPEND"), LOG4CXX_STR("append")))
- {
- LOCK_W sync(mutex);
- fileAppend = OptionConverter::toBoolean(value, true);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
- {
- LOCK_W sync(mutex);
- bufferedIO = OptionConverter::toBoolean(value, true);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
- {
- LOCK_W sync(mutex);
- bufferedIO = !OptionConverter::toBoolean(value, false);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- LOCK_W sync(mutex);
- bufferSize = OptionConverter::toFileSize(value, 8 * 1024);
- }
- else
- {
- WriterAppender::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"), LOG4CXX_STR("file"))
+ || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
+ {
+ LOCK_W sync(mutex);
+ fileName = stripDuplicateBackslashes(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("APPEND"), LOG4CXX_STR("append")))
+ {
+ LOCK_W sync(mutex);
+ fileAppend = OptionConverter::toBoolean(value, true);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
+ {
+ LOCK_W sync(mutex);
+ bufferedIO = OptionConverter::toBoolean(value, true);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
+ {
+ LOCK_W sync(mutex);
+ bufferedIO = !OptionConverter::toBoolean(value, false);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ LOCK_W sync(mutex);
+ bufferSize = OptionConverter::toFileSize(value, 8 * 1024);
+ }
+ else
+ {
+ WriterAppender::setOption(option, value);
+ }
}
void FileAppender::activateOptions(Pool& p)
{
- LOCK_W sync(mutex);
- int errors = 0;
+ LOCK_W sync(mutex);
+ int errors = 0;
- if (!fileName.empty())
- {
- try
- {
- setFile(fileName, fileAppend, bufferedIO, bufferSize, p);
- }
- catch (IOException& e)
- {
- errors++;
- LogString msg(LOG4CXX_STR("setFile("));
- msg.append(fileName);
- msg.append(1, (logchar) 0x2C /* ',' */);
- StringHelper::toString(fileAppend, msg);
- msg.append(LOG4CXX_STR(") call failed."));
- errorHandler->error(msg, e, ErrorCode::FILE_OPEN_FAILURE);
- }
- }
- else
- {
- errors++;
- LogLog::error(LogString(LOG4CXX_STR("File option not set for appender ["))
- + name + LOG4CXX_STR("]."));
- LogLog::warn(LOG4CXX_STR("Are you using FileAppender instead of ConsoleAppender?"));
- }
+ if (!fileName.empty())
+ {
+ try
+ {
+ setFile(fileName, fileAppend, bufferedIO, bufferSize, p);
+ }
+ catch (IOException& e)
+ {
+ errors++;
+ LogString msg(LOG4CXX_STR("setFile("));
+ msg.append(fileName);
+ msg.append(1, (logchar) 0x2C /* ',' */);
+ StringHelper::toString(fileAppend, msg);
+ msg.append(LOG4CXX_STR(") call failed."));
+ errorHandler->error(msg, e, ErrorCode::FILE_OPEN_FAILURE);
+ }
+ }
+ else
+ {
+ errors++;
+ LogLog::error(LogString(LOG4CXX_STR("File option not set for appender ["))
+ + name + LOG4CXX_STR("]."));
+ LogLog::warn(LOG4CXX_STR("Are you using FileAppender instead of ConsoleAppender?"));
+ }
- if (errors == 0)
- {
- WriterAppender::activateOptions(p);
- }
+ if (errors == 0)
+ {
+ WriterAppender::activateOptions(p);
+ }
}
@@ -202,45 +202,45 @@
*/
LogString FileAppender::stripDuplicateBackslashes(const LogString& src)
{
- logchar backslash = 0x5C; // '\\'
- LogString::size_type i = src.find_last_of(backslash);
+ logchar backslash = 0x5C; // '\\'
+ LogString::size_type i = src.find_last_of(backslash);
- if (i != LogString::npos)
- {
- LogString tmp(src);
+ if (i != LogString::npos)
+ {
+ LogString tmp(src);
- for (;
- i != LogString::npos && i > 0;
- i = tmp.find_last_of(backslash, i - 1))
- {
- //
- // if the preceding character is a slash then
- // remove the preceding character
- // and continue processing
- if (tmp[i - 1] == backslash)
- {
- tmp.erase(i, 1);
- i--;
+ for (;
+ i != LogString::npos && i > 0;
+ i = tmp.find_last_of(backslash, i - 1))
+ {
+ //
+ // if the preceding character is a slash then
+ // remove the preceding character
+ // and continue processing
+ if (tmp[i - 1] == backslash)
+ {
+ tmp.erase(i, 1);
+ i--;
- if (i == 0)
- {
- break;
- }
- }
- else
- {
- //
- // if there an odd number of slashes
- // the string wasn't trying to work around
- // OptionConverter::convertSpecialChars
- return src;
- }
- }
+ if (i == 0)
+ {
+ break;
+ }
+ }
+ else
+ {
+ //
+ // if there an odd number of slashes
+ // the string wasn't trying to work around
+ // OptionConverter::convertSpecialChars
+ return src;
+ }
+ }
- return tmp;
- }
+ return tmp;
+ }
- return src;
+ return src;
}
/**
@@ -264,97 +264,97 @@
*/
void FileAppender::setFile(
- const LogString& filename,
- bool append1,
- bool bufferedIO1,
- size_t bufferSize1,
- Pool& p)
+ const LogString& filename,
+ bool append1,
+ bool bufferedIO1,
+ size_t bufferSize1,
+ Pool& p)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- // It does not make sense to have immediate flush and bufferedIO.
- if (bufferedIO1)
- {
- setImmediateFlush(false);
- }
+ // It does not make sense to have immediate flush and bufferedIO.
+ if (bufferedIO1)
+ {
+ setImmediateFlush(false);
+ }
- closeWriter();
+ closeWriter();
- bool writeBOM = false;
+ bool writeBOM = false;
- if (StringHelper::equalsIgnoreCase(getEncoding(),
- LOG4CXX_STR("utf-16"), LOG4CXX_STR("UTF-16")))
- {
- //
- // don't want to write a byte order mark if the file exists
- //
- if (append1)
- {
- File outFile;
- outFile.setPath(filename);
- writeBOM = !outFile.exists(p);
- }
- else
- {
- writeBOM = true;
- }
- }
+ if (StringHelper::equalsIgnoreCase(getEncoding(),
+ LOG4CXX_STR("utf-16"), LOG4CXX_STR("UTF-16")))
+ {
+ //
+ // don't want to write a byte order mark if the file exists
+ //
+ if (append1)
+ {
+ File outFile;
+ outFile.setPath(filename);
+ writeBOM = !outFile.exists(p);
+ }
+ else
+ {
+ writeBOM = true;
+ }
+ }
- OutputStreamPtr outStream;
+ OutputStreamPtr outStream;
- try
- {
- outStream = new FileOutputStream(filename, append1);
- }
- catch (IOException& ex)
- {
- LogString parentName = File().setPath(filename).getParent(p);
+ try
+ {
+ outStream = new FileOutputStream(filename, append1);
+ }
+ catch (IOException& ex)
+ {
+ LogString parentName = File().setPath(filename).getParent(p);
- if (!parentName.empty())
- {
- File parentDir;
- parentDir.setPath(parentName);
+ if (!parentName.empty())
+ {
+ File parentDir;
+ parentDir.setPath(parentName);
- if (!parentDir.exists(p) && parentDir.mkdirs(p))
- {
- outStream = new FileOutputStream(filename, append1);
- }
- else
- {
- throw;
- }
- }
- else
- {
- throw;
- }
- }
+ if (!parentDir.exists(p) && parentDir.mkdirs(p))
+ {
+ outStream = new FileOutputStream(filename, append1);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw;
+ }
+ }
- //
- // if a new file and UTF-16, then write a BOM
- //
- if (writeBOM)
- {
- char bom[] = { (char) 0xFE, (char) 0xFF };
- ByteBuffer buf(bom, 2);
- outStream->write(buf, p);
- }
+ //
+ // if a new file and UTF-16, then write a BOM
+ //
+ if (writeBOM)
+ {
+ char bom[] = { (char) 0xFE, (char) 0xFF };
+ ByteBuffer buf(bom, 2);
+ outStream->write(buf, p);
+ }
- WriterPtr newWriter(createWriter(outStream));
+ WriterPtr newWriter(createWriter(outStream));
- if (bufferedIO1)
- {
- newWriter = new BufferedWriter(newWriter, bufferSize1);
- }
+ if (bufferedIO1)
+ {
+ newWriter = new BufferedWriter(newWriter, bufferSize1);
+ }
- setWriter(newWriter);
+ setWriter(newWriter);
- this->fileAppend = append1;
- this->bufferedIO = bufferedIO1;
- this->fileName = filename;
- this->bufferSize = bufferSize1;
- writeHeader(p);
+ this->fileAppend = append1;
+ this->bufferedIO = bufferedIO1;
+ this->fileName = filename;
+ this->bufferSize = bufferSize1;
+ writeHeader(p);
}
diff --git a/src/main/cpp/filedatepatternconverter.cpp b/src/main/cpp/filedatepatternconverter.cpp
index 0433454..cd03645 100644
--- a/src/main/cpp/filedatepatternconverter.cpp
+++ b/src/main/cpp/filedatepatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -28,15 +28,15 @@
using namespace log4cxx::helpers;
PatternConverterPtr FileDatePatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() == 0)
- {
- std::vector<LogString> altOptions;
- altOptions.push_back(LOG4CXX_STR("yyyy-MM-dd"));
- return DatePatternConverter::newInstance(altOptions);
- }
+ if (options.size() == 0)
+ {
+ std::vector<LogString> altOptions;
+ altOptions.push_back(LOG4CXX_STR("yyyy-MM-dd"));
+ return DatePatternConverter::newInstance(altOptions);
+ }
- return DatePatternConverter::newInstance(options);
+ return DatePatternConverter::newInstance(options);
}
diff --git a/src/main/cpp/fileinputstream.cpp b/src/main/cpp/fileinputstream.cpp
index f3231df..c177362 100644
--- a/src/main/cpp/fileinputstream.cpp
+++ b/src/main/cpp/fileinputstream.cpp
@@ -22,7 +22,7 @@
#include <apr_file_io.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -33,82 +33,82 @@
FileInputStream::FileInputStream(const LogString& filename) : fileptr(0)
{
- open(filename);
+ open(filename);
}
FileInputStream::FileInputStream(const logchar* filename) : fileptr(0)
{
- LogString fn(filename);
- open(fn);
+ LogString fn(filename);
+ open(fn);
}
void FileInputStream::open(const LogString& filename)
{
- apr_fileperms_t perm = APR_OS_DEFAULT;
- apr_int32_t flags = APR_READ;
- apr_status_t stat = File().setPath(filename).open(&fileptr, flags, perm, pool);
+ apr_fileperms_t perm = APR_OS_DEFAULT;
+ apr_int32_t flags = APR_READ;
+ apr_status_t stat = File().setPath(filename).open(&fileptr, flags, perm, pool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
}
FileInputStream::FileInputStream(const File& aFile)
{
- apr_fileperms_t perm = APR_OS_DEFAULT;
- apr_int32_t flags = APR_READ;
- apr_status_t stat = aFile.open(&fileptr, flags, perm, pool);
+ apr_fileperms_t perm = APR_OS_DEFAULT;
+ apr_int32_t flags = APR_READ;
+ apr_status_t stat = aFile.open(&fileptr, flags, perm, pool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
}
FileInputStream::~FileInputStream()
{
- if (fileptr != NULL && !APRInitializer::isDestructed)
- {
- apr_file_close(fileptr);
- }
+ if (fileptr != NULL && !APRInitializer::isDestructed)
+ {
+ apr_file_close(fileptr);
+ }
}
void FileInputStream::close()
{
- apr_status_t stat = apr_file_close(fileptr);
+ apr_status_t stat = apr_file_close(fileptr);
- if (stat == APR_SUCCESS)
- {
- fileptr = NULL;
- }
- else
- {
- throw IOException(stat);
- }
+ if (stat == APR_SUCCESS)
+ {
+ fileptr = NULL;
+ }
+ else
+ {
+ throw IOException(stat);
+ }
}
int FileInputStream::read(ByteBuffer& buf)
{
- apr_size_t bytesRead = buf.remaining();
- apr_status_t stat = apr_file_read(fileptr, buf.current(), &bytesRead);
- int retval = -1;
+ apr_size_t bytesRead = buf.remaining();
+ apr_status_t stat = apr_file_read(fileptr, buf.current(), &bytesRead);
+ int retval = -1;
- if (!APR_STATUS_IS_EOF(stat))
- {
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (!APR_STATUS_IS_EOF(stat))
+ {
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- buf.position(buf.position() + bytesRead);
- retval = bytesRead;
- }
+ buf.position(buf.position() + bytesRead);
+ retval = bytesRead;
+ }
- return retval;
+ return retval;
}
diff --git a/src/main/cpp/filelocationpatternconverter.cpp b/src/main/cpp/filelocationpatternconverter.cpp
index fdd81e9..4889aee 100644
--- a/src/main/cpp/filelocationpatternconverter.cpp
+++ b/src/main/cpp/filelocationpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -32,22 +32,22 @@
IMPLEMENT_LOG4CXX_OBJECT(FileLocationPatternConverter)
FileLocationPatternConverter::FileLocationPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("File Location"),
- LOG4CXX_STR("file"))
+ LoggingEventPatternConverter(LOG4CXX_STR("File Location"),
+ LOG4CXX_STR("file"))
{
}
PatternConverterPtr FileLocationPatternConverter::newInstance(
- const std::vector<LogString>& /* options */ )
+ const std::vector<LogString>& /* options */ )
{
- static PatternConverterPtr instance(new FileLocationPatternConverter());
- return instance;
+ static PatternConverterPtr instance(new FileLocationPatternConverter());
+ return instance;
}
void FileLocationPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */ ) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */ ) const
{
- append(toAppendTo, event->getLocationInformation().getFileName());
+ append(toAppendTo, event->getLocationInformation().getFileName());
}
diff --git a/src/main/cpp/fileoutputstream.cpp b/src/main/cpp/fileoutputstream.cpp
index b4cc809..036ede3 100644
--- a/src/main/cpp/fileoutputstream.cpp
+++ b/src/main/cpp/fileoutputstream.cpp
@@ -22,7 +22,7 @@
#include <apr_file_io.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -32,64 +32,64 @@
IMPLEMENT_LOG4CXX_OBJECT(FileOutputStream)
FileOutputStream::FileOutputStream(const LogString& filename,
- bool append) : pool(), fileptr(open(filename, append, pool))
+ bool append) : pool(), fileptr(open(filename, append, pool))
{
}
FileOutputStream::FileOutputStream(const logchar* filename,
- bool append) : pool(), fileptr(open(filename, append, pool))
+ bool append) : pool(), fileptr(open(filename, append, pool))
{
}
apr_file_t* FileOutputStream::open(const LogString& filename,
- bool append, Pool& pool)
+ bool append, Pool& pool)
{
- apr_fileperms_t perm = APR_OS_DEFAULT;
- apr_int32_t flags = APR_WRITE | APR_CREATE;
+ apr_fileperms_t perm = APR_OS_DEFAULT;
+ apr_int32_t flags = APR_WRITE | APR_CREATE;
- if (append)
- {
- flags |= APR_APPEND;
- }
- else
- {
- flags |= APR_TRUNCATE;
- }
+ if (append)
+ {
+ flags |= APR_APPEND;
+ }
+ else
+ {
+ flags |= APR_TRUNCATE;
+ }
- File fn;
- fn.setPath(filename);
- apr_file_t* fileptr = 0;
- apr_status_t stat = fn.open(&fileptr, flags, perm, pool);
+ File fn;
+ fn.setPath(filename);
+ apr_file_t* fileptr = 0;
+ apr_status_t stat = fn.open(&fileptr, flags, perm, pool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- return fileptr;
+ return fileptr;
}
FileOutputStream::~FileOutputStream()
{
- if (fileptr != NULL && !APRInitializer::isDestructed)
- {
- apr_file_close(fileptr);
- }
+ if (fileptr != NULL && !APRInitializer::isDestructed)
+ {
+ apr_file_close(fileptr);
+ }
}
void FileOutputStream::close(Pool& /* p */)
{
- if (fileptr != NULL)
- {
- apr_status_t stat = apr_file_close(fileptr);
+ if (fileptr != NULL)
+ {
+ apr_status_t stat = apr_file_close(fileptr);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- fileptr = NULL;
- }
+ fileptr = NULL;
+ }
}
void FileOutputStream::flush(Pool& /* p */)
@@ -98,28 +98,28 @@
void FileOutputStream::write(ByteBuffer& buf, Pool& /* p */ )
{
- if (fileptr == NULL)
- {
- throw IOException(-1);
- }
+ if (fileptr == NULL)
+ {
+ throw IOException(-1);
+ }
- size_t nbytes = buf.remaining();
- size_t pos = buf.position();
- const char* data = buf.data();
+ size_t nbytes = buf.remaining();
+ size_t pos = buf.position();
+ const char* data = buf.data();
- while (nbytes > 0)
- {
- apr_status_t stat = apr_file_write(
- fileptr, data + pos, &nbytes);
+ while (nbytes > 0)
+ {
+ apr_status_t stat = apr_file_write(
+ fileptr, data + pos, &nbytes);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- pos += nbytes;
- buf.position(pos);
- nbytes = buf.remaining();
- }
+ pos += nbytes;
+ buf.position(pos);
+ nbytes = buf.remaining();
+ }
}
diff --git a/src/main/cpp/filerenameaction.cpp b/src/main/cpp/filerenameaction.cpp
index 3559aa8..8dc416a 100644
--- a/src/main/cpp/filerenameaction.cpp
+++ b/src/main/cpp/filerenameaction.cpp
@@ -25,13 +25,13 @@
IMPLEMENT_LOG4CXX_OBJECT(FileRenameAction)
FileRenameAction::FileRenameAction(const File& toRename,
- const File& renameTo,
- bool renameEmptyFile1)
- : source(toRename), destination(renameTo), renameEmptyFile(renameEmptyFile1)
+ const File& renameTo,
+ bool renameEmptyFile1)
+ : source(toRename), destination(renameTo), renameEmptyFile(renameEmptyFile1)
{
}
bool FileRenameAction::execute(log4cxx::helpers::Pool& pool1) const
{
- return source.renameTo(destination, pool1);
+ return source.renameTo(destination, pool1);
}
diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp
index b672bbb..beea70d 100644
--- a/src/main/cpp/filewatchdog.cpp
+++ b/src/main/cpp/filewatchdog.cpp
@@ -32,79 +32,79 @@
#if APR_HAS_THREADS
FileWatchdog::FileWatchdog(const File& file1)
- : file(file1), delay(DEFAULT_DELAY), lastModif(0),
- warnedAlready(false), interrupted(0), thread()
+ : file(file1), delay(DEFAULT_DELAY), lastModif(0),
+ warnedAlready(false), interrupted(0), thread()
{
}
FileWatchdog::~FileWatchdog()
{
- apr_atomic_set32(&interrupted, 0xFFFF);
+ apr_atomic_set32(&interrupted, 0xFFFF);
- try
- {
- thread.interrupt();
- thread.join();
- }
- catch (Exception& e)
- {
- }
+ try
+ {
+ thread.interrupt();
+ thread.join();
+ }
+ catch (Exception& e)
+ {
+ }
}
void FileWatchdog::checkAndConfigure()
{
- Pool pool1;
+ Pool pool1;
- if (!file.exists(pool1))
- {
- if (!warnedAlready)
- {
- LogLog::debug(((LogString) LOG4CXX_STR("["))
- + file.getPath()
- + LOG4CXX_STR("] does not exist."));
- warnedAlready = true;
- }
- }
- else
- {
- apr_time_t thisMod = file.lastModified(pool1);
+ if (!file.exists(pool1))
+ {
+ if (!warnedAlready)
+ {
+ LogLog::debug(((LogString) LOG4CXX_STR("["))
+ + file.getPath()
+ + LOG4CXX_STR("] does not exist."));
+ warnedAlready = true;
+ }
+ }
+ else
+ {
+ apr_time_t thisMod = file.lastModified(pool1);
- if (thisMod > lastModif)
- {
- lastModif = thisMod;
- doOnChange();
- warnedAlready = false;
- }
- }
+ if (thisMod > lastModif)
+ {
+ lastModif = thisMod;
+ doOnChange();
+ warnedAlready = false;
+ }
+ }
}
void* APR_THREAD_FUNC FileWatchdog::run(apr_thread_t* /* thread */, void* data)
{
- FileWatchdog* pThis = (FileWatchdog*) data;
+ FileWatchdog* pThis = (FileWatchdog*) data;
- unsigned int interrupted = apr_atomic_read32(&pThis->interrupted);
+ unsigned int interrupted = apr_atomic_read32(&pThis->interrupted);
- while (!interrupted)
- {
- try
- {
- Thread::sleep(pThis->delay);
- pThis->checkAndConfigure();
- }
- catch (InterruptedException& ex)
- {
- interrupted = apr_atomic_read32(&pThis->interrupted);
- }
- }
+ while (!interrupted)
+ {
+ try
+ {
+ Thread::sleep(pThis->delay);
+ pThis->checkAndConfigure();
+ }
+ catch (InterruptedException& ex)
+ {
+ interrupted = apr_atomic_read32(&pThis->interrupted);
+ }
+ }
- return NULL;
+ return NULL;
}
void FileWatchdog::start()
{
- checkAndConfigure();
+ checkAndConfigure();
- thread.run(run, this);
+ thread.run(run, this);
}
#endif
diff --git a/src/main/cpp/filter.cpp b/src/main/cpp/filter.cpp
index 72526d4..87e9d9e 100644
--- a/src/main/cpp/filter.cpp
+++ b/src/main/cpp/filter.cpp
@@ -28,22 +28,22 @@
void Filter::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void Filter::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
FilterPtr Filter::getNext() const
{
- return next;
+ return next;
}
void Filter::setNext(const FilterPtr& newNext)
{
- next = newNext;
+ next = newNext;
}
void Filter::activateOptions(Pool&)
diff --git a/src/main/cpp/filterbasedtriggeringpolicy.cpp b/src/main/cpp/filterbasedtriggeringpolicy.cpp
index 1f7e2c6..c8d9f23 100644
--- a/src/main/cpp/filterbasedtriggeringpolicy.cpp
+++ b/src/main/cpp/filterbasedtriggeringpolicy.cpp
@@ -36,32 +36,32 @@
bool FilterBasedTriggeringPolicy::isTriggeringEvent(
- Appender* /* appender */,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& /* filename */,
- size_t /* fileLength */ )
+ Appender* /* appender */,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& /* filename */,
+ size_t /* fileLength */ )
{
- if (headFilter == NULL)
- {
- return false;
- }
+ if (headFilter == NULL)
+ {
+ return false;
+ }
- for (log4cxx::spi::FilterPtr f = headFilter; f != NULL; f = f->getNext())
- {
- switch (f->decide(event))
- {
- case Filter::DENY:
- return false;
+ for (log4cxx::spi::FilterPtr f = headFilter; f != NULL; f = f->getNext())
+ {
+ switch (f->decide(event))
+ {
+ case Filter::DENY:
+ return false;
- case Filter::ACCEPT:
- return true;
+ case Filter::ACCEPT:
+ return true;
- case Filter::NEUTRAL:
- break;
- }
- }
+ case Filter::NEUTRAL:
+ break;
+ }
+ }
- return true;
+ return true;
}
/**
@@ -70,28 +70,28 @@
*/
void FilterBasedTriggeringPolicy::addFilter(const log4cxx::spi::FilterPtr& newFilter)
{
- if (headFilter == NULL)
- {
- headFilter = newFilter;
- tailFilter = newFilter;
- }
- else
- {
- tailFilter->setNext(newFilter);
- tailFilter = newFilter;
- }
+ if (headFilter == NULL)
+ {
+ headFilter = newFilter;
+ tailFilter = newFilter;
+ }
+ else
+ {
+ tailFilter->setNext(newFilter);
+ tailFilter = newFilter;
+ }
}
void FilterBasedTriggeringPolicy::clearFilters()
{
- log4cxx::spi::FilterPtr empty;
- headFilter = empty;
- tailFilter = empty;
+ log4cxx::spi::FilterPtr empty;
+ headFilter = empty;
+ tailFilter = empty;
}
log4cxx::spi::FilterPtr& FilterBasedTriggeringPolicy::getFilter()
{
- return headFilter;
+ return headFilter;
}
/**
@@ -99,10 +99,10 @@
*/
void FilterBasedTriggeringPolicy::activateOptions(log4cxx::helpers::Pool& p)
{
- for (log4cxx::spi::FilterPtr f = headFilter; f != NULL; f = f->getNext())
- {
- f->activateOptions(p);
- }
+ for (log4cxx::spi::FilterPtr f = headFilter; f != NULL; f = f->getNext())
+ {
+ f->activateOptions(p);
+ }
}
void FilterBasedTriggeringPolicy::setOption(const LogString& /* option */, const LogString& /* value */ )
diff --git a/src/main/cpp/fixedwindowrollingpolicy.cpp b/src/main/cpp/fixedwindowrollingpolicy.cpp
index f186053..4f03e10 100644
--- a/src/main/cpp/fixedwindowrollingpolicy.cpp
+++ b/src/main/cpp/fixedwindowrollingpolicy.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -41,41 +41,41 @@
IMPLEMENT_LOG4CXX_OBJECT(FixedWindowRollingPolicy)
FixedWindowRollingPolicy::FixedWindowRollingPolicy() :
- minIndex(1), maxIndex(7)
+ minIndex(1), maxIndex(7)
{
}
void FixedWindowRollingPolicy::setMaxIndex(int maxIndex1)
{
- this->maxIndex = maxIndex1;
+ this->maxIndex = maxIndex1;
}
void FixedWindowRollingPolicy::setMinIndex(int minIndex1)
{
- this->minIndex = minIndex1;
+ this->minIndex = minIndex1;
}
void FixedWindowRollingPolicy::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MININDEX"),
- LOG4CXX_STR("minindex")))
- {
- minIndex = OptionConverter::toInt(value, 1);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXINDEX"),
- LOG4CXX_STR("maxindex")))
- {
- maxIndex = OptionConverter::toInt(value, 7);
- }
- else
- {
- RollingPolicyBase::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MININDEX"),
+ LOG4CXX_STR("minindex")))
+ {
+ minIndex = OptionConverter::toInt(value, 1);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXINDEX"),
+ LOG4CXX_STR("maxindex")))
+ {
+ maxIndex = OptionConverter::toInt(value, 7);
+ }
+ else
+ {
+ RollingPolicyBase::setOption(option, value);
+ }
}
/**
@@ -83,124 +83,124 @@
*/
void FixedWindowRollingPolicy::activateOptions(Pool& p)
{
- RollingPolicyBase::activateOptions(p);
+ RollingPolicyBase::activateOptions(p);
- if (maxIndex < minIndex)
- {
- LogLog::warn(
- LOG4CXX_STR("MaxIndex cannot be smaller than MinIndex."));
- maxIndex = minIndex;
- }
+ if (maxIndex < minIndex)
+ {
+ LogLog::warn(
+ LOG4CXX_STR("MaxIndex cannot be smaller than MinIndex."));
+ maxIndex = minIndex;
+ }
- if ((maxIndex - minIndex) > MAX_WINDOW_SIZE)
- {
- LogLog::warn(LOG4CXX_STR("Large window sizes are not allowed."));
- maxIndex = minIndex + MAX_WINDOW_SIZE;
- }
+ if ((maxIndex - minIndex) > MAX_WINDOW_SIZE)
+ {
+ LogLog::warn(LOG4CXX_STR("Large window sizes are not allowed."));
+ maxIndex = minIndex + MAX_WINDOW_SIZE;
+ }
- PatternConverterPtr itc = getIntegerPatternConverter();
+ PatternConverterPtr itc = getIntegerPatternConverter();
- if (itc == NULL)
- {
- throw IllegalStateException();
- }
+ if (itc == NULL)
+ {
+ throw IllegalStateException();
+ }
}
/**
* {@inheritDoc}
*/
RolloverDescriptionPtr FixedWindowRollingPolicy::initialize(
- const LogString& currentActiveFile,
- const bool append,
- Pool& pool)
+ const LogString& currentActiveFile,
+ const bool append,
+ Pool& pool)
{
- LogString newActiveFile(currentActiveFile);
- explicitActiveFile = false;
+ LogString newActiveFile(currentActiveFile);
+ explicitActiveFile = false;
- if (currentActiveFile.length() > 0)
- {
- explicitActiveFile = true;
- newActiveFile = currentActiveFile;
- }
+ if (currentActiveFile.length() > 0)
+ {
+ explicitActiveFile = true;
+ newActiveFile = currentActiveFile;
+ }
- if (!explicitActiveFile)
- {
- LogString buf;
- ObjectPtr obj(new Integer(minIndex));
- formatFileName(obj, buf, pool);
- newActiveFile = buf;
- }
+ if (!explicitActiveFile)
+ {
+ LogString buf;
+ ObjectPtr obj(new Integer(minIndex));
+ formatFileName(obj, buf, pool);
+ newActiveFile = buf;
+ }
- ActionPtr noAction;
+ ActionPtr noAction;
- return new RolloverDescription(newActiveFile, append, noAction, noAction);
+ return new RolloverDescription(newActiveFile, append, noAction, noAction);
}
/**
* {@inheritDoc}
*/
RolloverDescriptionPtr FixedWindowRollingPolicy::rollover(
- const LogString& currentActiveFile,
- const bool append,
- Pool& pool)
+ const LogString& currentActiveFile,
+ const bool append,
+ Pool& pool)
{
- RolloverDescriptionPtr desc;
+ RolloverDescriptionPtr desc;
- if (maxIndex < 0)
- {
- return desc;
- }
+ if (maxIndex < 0)
+ {
+ return desc;
+ }
- int purgeStart = minIndex;
+ int purgeStart = minIndex;
- if (!explicitActiveFile)
- {
- purgeStart++;
- }
+ if (!explicitActiveFile)
+ {
+ purgeStart++;
+ }
- if (!purge(purgeStart, maxIndex, pool))
- {
- return desc;
- }
+ if (!purge(purgeStart, maxIndex, pool))
+ {
+ return desc;
+ }
- LogString buf;
- ObjectPtr obj(new Integer(purgeStart));
- formatFileName(obj, buf, pool);
+ LogString buf;
+ ObjectPtr obj(new Integer(purgeStart));
+ formatFileName(obj, buf, pool);
- LogString renameTo(buf);
- LogString compressedName(renameTo);
- ActionPtr compressAction ;
+ LogString renameTo(buf);
+ LogString compressedName(renameTo);
+ ActionPtr compressAction ;
- if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".gz")))
- {
- renameTo.resize(renameTo.size() - 3);
- compressAction =
- new GZCompressAction(
- File().setPath(renameTo),
- File().setPath(compressedName),
- true);
- }
- else if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".zip")))
- {
- renameTo.resize(renameTo.size() - 4);
- compressAction =
- new ZipCompressAction(
- File().setPath(renameTo),
- File().setPath(compressedName),
- true);
- }
+ if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".gz")))
+ {
+ renameTo.resize(renameTo.size() - 3);
+ compressAction =
+ new GZCompressAction(
+ File().setPath(renameTo),
+ File().setPath(compressedName),
+ true);
+ }
+ else if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".zip")))
+ {
+ renameTo.resize(renameTo.size() - 4);
+ compressAction =
+ new ZipCompressAction(
+ File().setPath(renameTo),
+ File().setPath(compressedName),
+ true);
+ }
- FileRenameActionPtr renameAction =
- new FileRenameAction(
- File().setPath(currentActiveFile),
- File().setPath(renameTo),
- false);
+ FileRenameActionPtr renameAction =
+ new FileRenameAction(
+ File().setPath(currentActiveFile),
+ File().setPath(renameTo),
+ false);
- desc = new RolloverDescription(
- currentActiveFile, append,
- renameAction, compressAction);
+ desc = new RolloverDescription(
+ currentActiveFile, append,
+ renameAction, compressAction);
- return desc;
+ return desc;
}
/**
@@ -209,7 +209,7 @@
*/
int FixedWindowRollingPolicy::getMaxIndex() const
{
- return maxIndex;
+ return maxIndex;
}
/**
@@ -218,7 +218,7 @@
*/
int FixedWindowRollingPolicy::getMinIndex() const
{
- return minIndex;
+ return minIndex;
}
@@ -231,126 +231,126 @@
*/
bool FixedWindowRollingPolicy::purge(int lowIndex, int highIndex, Pool& p) const
{
- int suffixLength = 0;
+ int suffixLength = 0;
- std::vector<FileRenameActionPtr> renames;
- LogString buf;
- ObjectPtr obj = new Integer(lowIndex);
- formatFileName(obj, buf, p);
+ std::vector<FileRenameActionPtr> renames;
+ LogString buf;
+ ObjectPtr obj = new Integer(lowIndex);
+ formatFileName(obj, buf, p);
- LogString lowFilename(buf);
+ LogString lowFilename(buf);
- if (lowFilename.compare(lowFilename.length() - 3, 3, LOG4CXX_STR(".gz")) == 0)
- {
- suffixLength = 3;
- }
- else if (lowFilename.compare(lowFilename.length() - 4, 4, LOG4CXX_STR(".zip")) == 0)
- {
- suffixLength = 4;
- }
+ if (lowFilename.compare(lowFilename.length() - 3, 3, LOG4CXX_STR(".gz")) == 0)
+ {
+ suffixLength = 3;
+ }
+ else if (lowFilename.compare(lowFilename.length() - 4, 4, LOG4CXX_STR(".zip")) == 0)
+ {
+ suffixLength = 4;
+ }
- for (int i = lowIndex; i <= highIndex; i++)
- {
- File toRenameCompressed;
- toRenameCompressed.setPath(lowFilename);
- File toRenameBase;
- toRenameBase.setPath(lowFilename.substr(0, lowFilename.length() - suffixLength));
- File* toRename = &toRenameCompressed;
- bool isBase = false;
- bool exists = toRenameCompressed.exists(p);
+ for (int i = lowIndex; i <= highIndex; i++)
+ {
+ File toRenameCompressed;
+ toRenameCompressed.setPath(lowFilename);
+ File toRenameBase;
+ toRenameBase.setPath(lowFilename.substr(0, lowFilename.length() - suffixLength));
+ File* toRename = &toRenameCompressed;
+ bool isBase = false;
+ bool exists = toRenameCompressed.exists(p);
- if (suffixLength > 0)
- {
- if (exists)
- {
- if (toRenameBase.exists(p))
- {
- toRenameBase.deleteFile(p);
- }
- }
- else
- {
- toRename = &toRenameBase;
- exists = toRenameBase.exists(p);
- isBase = true;
- }
- }
+ if (suffixLength > 0)
+ {
+ if (exists)
+ {
+ if (toRenameBase.exists(p))
+ {
+ toRenameBase.deleteFile(p);
+ }
+ }
+ else
+ {
+ toRename = &toRenameBase;
+ exists = toRenameBase.exists(p);
+ isBase = true;
+ }
+ }
- if (exists)
- {
- //
- // if at upper index then
- // attempt to delete last file
- // if that fails then abandon purge
- if (i == highIndex)
- {
- if (!toRename->deleteFile(p))
- {
- return false;
- }
+ if (exists)
+ {
+ //
+ // if at upper index then
+ // attempt to delete last file
+ // if that fails then abandon purge
+ if (i == highIndex)
+ {
+ if (!toRename->deleteFile(p))
+ {
+ return false;
+ }
- break;
- }
+ break;
+ }
- //
- // if intermediate index
- // add a rename action to the list
- buf.erase(buf.begin(), buf.end());
- obj = new Integer(i + 1);
- formatFileName(obj, buf, p);
+ //
+ // if intermediate index
+ // add a rename action to the list
+ buf.erase(buf.begin(), buf.end());
+ obj = new Integer(i + 1);
+ formatFileName(obj, buf, p);
- LogString highFilename(buf);
- LogString renameTo(highFilename);
+ LogString highFilename(buf);
+ LogString renameTo(highFilename);
- if (isBase)
- {
- renameTo =
- highFilename.substr(0, highFilename.length() - suffixLength);
- }
+ if (isBase)
+ {
+ renameTo =
+ highFilename.substr(0, highFilename.length() - suffixLength);
+ }
- renames.push_back(new FileRenameAction(*toRename, File().setPath(renameTo), true));
- lowFilename = highFilename;
- }
- else
- {
- break;
- }
- }
+ renames.push_back(new FileRenameAction(*toRename, File().setPath(renameTo), true));
+ lowFilename = highFilename;
+ }
+ else
+ {
+ break;
+ }
+ }
- //
- // work renames backwards
- //
- for (std::vector<FileRenameActionPtr>::reverse_iterator iter = renames.rbegin();
- iter != renames.rend();
- iter++)
- {
+ //
+ // work renames backwards
+ //
+ for (std::vector<FileRenameActionPtr>::reverse_iterator iter = renames.rbegin();
+ iter != renames.rend();
+ iter++)
+ {
- try
- {
- if (!(*iter)->execute(p))
- {
- return false;
- }
- }
- catch (std::exception& ex)
- {
- LogLog::warn(LOG4CXX_STR("Exception during purge in RollingFileAppender"));
+ try
+ {
+ if (!(*iter)->execute(p))
+ {
+ return false;
+ }
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(LOG4CXX_STR("Exception during purge in RollingFileAppender"));
- return false;
- }
- }
+ return false;
+ }
+ }
- return true;
+ return true;
}
#define RULES_PUT(spec, cls) \
- specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
+ specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
log4cxx::pattern::PatternMap FixedWindowRollingPolicy::getFormatSpecifiers() const
{
- PatternMap specs;
- RULES_PUT("i", IntegerPatternConverter);
- RULES_PUT("index", IntegerPatternConverter);
- return specs;
+ PatternMap specs;
+ RULES_PUT("i", IntegerPatternConverter);
+ RULES_PUT("index", IntegerPatternConverter);
+ return specs;
}
diff --git a/src/main/cpp/formattinginfo.cpp b/src/main/cpp/formattinginfo.cpp
index c50d635..f91eb3f 100644
--- a/src/main/cpp/formattinginfo.cpp
+++ b/src/main/cpp/formattinginfo.cpp
@@ -31,10 +31,10 @@
* @param maxLength maximum length.
*/
FormattingInfo::FormattingInfo(
- const bool leftAlign1, const int minLength1, const int maxLength1) :
- minLength(minLength1),
- maxLength(maxLength1),
- leftAlign(leftAlign1)
+ const bool leftAlign1, const int minLength1, const int maxLength1) :
+ minLength(minLength1),
+ maxLength(maxLength1),
+ leftAlign(leftAlign1)
{
}
@@ -44,8 +44,8 @@
*/
FormattingInfoPtr FormattingInfo::getDefault()
{
- static FormattingInfoPtr def(new FormattingInfo(false, 0, INT_MAX));
- return def;
+ static FormattingInfoPtr def(new FormattingInfo(false, 0, INT_MAX));
+ return def;
}
/**
@@ -56,22 +56,22 @@
*/
void FormattingInfo::format(const int fieldStart, LogString& buffer) const
{
- int rawLength = buffer.length() - fieldStart;
+ int rawLength = buffer.length() - fieldStart;
- if (rawLength > maxLength)
- {
- buffer.erase(buffer.begin() + fieldStart,
- buffer.begin() + fieldStart + (rawLength - maxLength));
- }
- else if (rawLength < minLength)
- {
- if (leftAlign)
- {
- buffer.append(minLength - rawLength, (logchar) 0x20 /* ' ' */);
- }
- else
- {
- buffer.insert(fieldStart, minLength - rawLength, 0x20 /* ' ' */);
- }
- }
+ if (rawLength > maxLength)
+ {
+ buffer.erase(buffer.begin() + fieldStart,
+ buffer.begin() + fieldStart + (rawLength - maxLength));
+ }
+ else if (rawLength < minLength)
+ {
+ if (leftAlign)
+ {
+ buffer.append(minLength - rawLength, (logchar) 0x20 /* ' ' */);
+ }
+ else
+ {
+ buffer.insert(fieldStart, minLength - rawLength, 0x20 /* ' ' */);
+ }
+ }
}
diff --git a/src/main/cpp/fulllocationpatternconverter.cpp b/src/main/cpp/fulllocationpatternconverter.cpp
index 8dc0cb9..466c2f5 100644
--- a/src/main/cpp/fulllocationpatternconverter.cpp
+++ b/src/main/cpp/fulllocationpatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -33,27 +33,27 @@
IMPLEMENT_LOG4CXX_OBJECT(FullLocationPatternConverter)
FullLocationPatternConverter::FullLocationPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Full Location"),
- LOG4CXX_STR("fullLocation"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Full Location"),
+ LOG4CXX_STR("fullLocation"))
{
}
PatternConverterPtr FullLocationPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr instance(new FullLocationPatternConverter());
- return instance;
+ static PatternConverterPtr instance(new FullLocationPatternConverter());
+ return instance;
}
void FullLocationPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& p) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& p) const
{
- append(toAppendTo, event->getLocationInformation().getFileName());
- toAppendTo.append(1, (logchar) 0x28 /* '(' */);
- StringHelper::toString(
- event->getLocationInformation().getLineNumber(),
- p, toAppendTo);
- toAppendTo.append(1, (logchar) 0x29 /* ')' */);
+ append(toAppendTo, event->getLocationInformation().getFileName());
+ toAppendTo.append(1, (logchar) 0x28 /* '(' */);
+ StringHelper::toString(
+ event->getLocationInformation().getLineNumber(),
+ p, toAppendTo);
+ toAppendTo.append(1, (logchar) 0x29 /* ')' */);
}
diff --git a/src/main/cpp/gzcompressaction.cpp b/src/main/cpp/gzcompressaction.cpp
index ccde682..b6735a9 100644
--- a/src/main/cpp/gzcompressaction.cpp
+++ b/src/main/cpp/gzcompressaction.cpp
@@ -28,108 +28,108 @@
IMPLEMENT_LOG4CXX_OBJECT(GZCompressAction)
GZCompressAction::GZCompressAction(const File& src,
- const File& dest,
- bool del)
- : source(src), destination(dest), deleteSource(del)
+ const File& dest,
+ bool del)
+ : source(src), destination(dest), deleteSource(del)
{
}
bool GZCompressAction::execute(log4cxx::helpers::Pool& p) const
{
- if (source.exists(p))
- {
- apr_pool_t* aprpool = p.getAPRPool();
- apr_procattr_t* attr;
- apr_status_t stat = apr_procattr_create(&attr, aprpool);
+ if (source.exists(p))
+ {
+ apr_pool_t* aprpool = p.getAPRPool();
+ apr_procattr_t* attr;
+ apr_status_t stat = apr_procattr_create(&attr, aprpool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_FULL_BLOCK, APR_FULL_BLOCK);
+ stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_FULL_BLOCK, APR_FULL_BLOCK);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH);
+ stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- //
- // set child process output to destination file
- //
- apr_file_t* child_out;
- apr_int32_t flags = APR_FOPEN_READ | APR_FOPEN_WRITE |
- APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE;
- stat = destination.open(&child_out, flags, APR_OS_DEFAULT, p);
+ //
+ // set child process output to destination file
+ //
+ apr_file_t* child_out;
+ apr_int32_t flags = APR_FOPEN_READ | APR_FOPEN_WRITE |
+ APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE;
+ stat = destination.open(&child_out, flags, APR_OS_DEFAULT, p);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- stat = apr_procattr_child_out_set(attr, child_out, NULL);
+ stat = apr_procattr_child_out_set(attr, child_out, NULL);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- //
- // redirect the child's error stream to this processes' error stream
- //
- apr_file_t* child_err;
- stat = apr_file_open_stderr(&child_err, aprpool);
+ //
+ // redirect the child's error stream to this processes' error stream
+ //
+ apr_file_t* child_err;
+ stat = apr_file_open_stderr(&child_err, aprpool);
- if (stat == APR_SUCCESS)
- {
- stat = apr_procattr_child_err_set(attr, child_err, NULL);
+ if (stat == APR_SUCCESS)
+ {
+ stat = apr_procattr_child_err_set(attr, child_err, NULL);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
+ }
- const char** args = (const char**)
- apr_palloc(aprpool, 4 * sizeof(*args));
- int i = 0;
- args[i++] = "gzip";
- args[i++] = "-c";
- args[i++] = Transcoder::encode(source.getPath(), p);
- args[i++] = NULL;
+ const char** args = (const char**)
+ apr_palloc(aprpool, 4 * sizeof(*args));
+ int i = 0;
+ args[i++] = "gzip";
+ args[i++] = "-c";
+ args[i++] = Transcoder::encode(source.getPath(), p);
+ args[i++] = NULL;
- apr_proc_t pid;
- stat = apr_proc_create(&pid, "gzip", args, NULL, attr, aprpool);
+ apr_proc_t pid;
+ stat = apr_proc_create(&pid, "gzip", args, NULL, attr, aprpool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- apr_proc_wait(&pid, NULL, NULL, APR_WAIT);
- stat = apr_file_close(child_out);
+ apr_proc_wait(&pid, NULL, NULL, APR_WAIT);
+ stat = apr_file_close(child_out);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- if (deleteSource)
- {
- source.deleteFile(p);
- }
+ if (deleteSource)
+ {
+ source.deleteFile(p);
+ }
- return true;
- }
+ return true;
+ }
- return false;
+ return false;
}
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
index 7d1078e..b406e19 100644
--- a/src/main/cpp/hierarchy.cpp
+++ b/src/main/cpp/hierarchy.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -33,7 +33,7 @@
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/stringhelper.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
#include <log4cxx/defaultconfigurator.h>
@@ -49,371 +49,371 @@
IMPLEMENT_LOG4CXX_OBJECT(Hierarchy)
Hierarchy::Hierarchy() :
- pool(),
- mutex(pool),
- loggers(new LoggerMap()),
- provisionNodes(new ProvisionNodeMap())
+ pool(),
+ mutex(pool),
+ loggers(new LoggerMap()),
+ provisionNodes(new ProvisionNodeMap())
{
- synchronized sync(mutex);
- root = new RootLogger(pool, Level::getDebug());
- root->setHierarchy(this);
- defaultFactory = new DefaultLoggerFactory();
- emittedNoAppenderWarning = false;
- configured = false;
- thresholdInt = Level::ALL_INT;
- threshold = Level::getAll();
- emittedNoResourceBundleWarning = false;
+ synchronized sync(mutex);
+ root = new RootLogger(pool, Level::getDebug());
+ root->setHierarchy(this);
+ defaultFactory = new DefaultLoggerFactory();
+ emittedNoAppenderWarning = false;
+ configured = false;
+ thresholdInt = Level::ALL_INT;
+ threshold = Level::getAll();
+ emittedNoResourceBundleWarning = false;
}
Hierarchy::~Hierarchy()
{
- // TODO LOGCXX-430
- // https://issues.apache.org/jira/browse/LOGCXX-430?focusedCommentId=15175254&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15175254
+ // TODO LOGCXX-430
+ // https://issues.apache.org/jira/browse/LOGCXX-430?focusedCommentId=15175254&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15175254
#ifndef APR_HAS_THREADS
- delete loggers;
- delete provisionNodes;
+ delete loggers;
+ delete provisionNodes;
#endif
}
void Hierarchy::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void Hierarchy::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void Hierarchy::addHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener)
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- if (std::find(listeners.begin(), listeners.end(), listener) != listeners.end())
- {
- LogLog::warn(LOG4CXX_STR("Ignoring attempt to add an existent listener."));
- }
- else
- {
- listeners.push_back(listener);
- }
+ if (std::find(listeners.begin(), listeners.end(), listener) != listeners.end())
+ {
+ LogLog::warn(LOG4CXX_STR("Ignoring attempt to add an existent listener."));
+ }
+ else
+ {
+ listeners.push_back(listener);
+ }
}
void Hierarchy::clear()
{
- synchronized sync(mutex);
- loggers->clear();
+ synchronized sync(mutex);
+ loggers->clear();
}
void Hierarchy::emitNoAppenderWarning(const LoggerPtr& logger)
{
- bool emitWarning = false;
- {
- synchronized sync(mutex);
- emitWarning = !emittedNoAppenderWarning;
- emittedNoAppenderWarning = true;
- }
+ bool emitWarning = false;
+ {
+ synchronized sync(mutex);
+ emitWarning = !emittedNoAppenderWarning;
+ emittedNoAppenderWarning = true;
+ }
- // No appender in hierarchy, warn user only once.
- if (emitWarning)
- {
- LogLog::warn(((LogString) LOG4CXX_STR("No appender could be found for logger ("))
- + logger->getName() + LOG4CXX_STR(")."));
- LogLog::warn(LOG4CXX_STR("Please initialize the log4cxx system properly."));
- }
+ // No appender in hierarchy, warn user only once.
+ if (emitWarning)
+ {
+ LogLog::warn(((LogString) LOG4CXX_STR("No appender could be found for logger ("))
+ + logger->getName() + LOG4CXX_STR(")."));
+ LogLog::warn(LOG4CXX_STR("Please initialize the log4cxx system properly."));
+ }
}
LoggerPtr Hierarchy::exists(const LogString& name)
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- LoggerPtr logger;
- LoggerMap::iterator it = loggers->find(name);
+ LoggerPtr logger;
+ LoggerMap::iterator it = loggers->find(name);
- if (it != loggers->end())
- {
- logger = it->second;
- }
+ if (it != loggers->end())
+ {
+ logger = it->second;
+ }
- return logger;
+ return logger;
}
void Hierarchy::setThreshold(const LevelPtr& l)
{
- if (l != 0)
- {
- synchronized sync(mutex);
- thresholdInt = l->toInt();
- threshold = l;
+ if (l != 0)
+ {
+ synchronized sync(mutex);
+ thresholdInt = l->toInt();
+ threshold = l;
- if (thresholdInt != Level::ALL_INT)
- {
- setConfigured(true);
- }
- }
+ if (thresholdInt != Level::ALL_INT)
+ {
+ setConfigured(true);
+ }
+ }
}
void Hierarchy::setThreshold(const LogString& levelStr)
{
- LevelPtr l(Level::toLevelLS(levelStr, 0));
+ LevelPtr l(Level::toLevelLS(levelStr, 0));
- if (l != 0)
- {
- setThreshold(l);
- }
- else
- {
- LogLog::warn(((LogString) LOG4CXX_STR("No level could be found named \""))
- + levelStr + LOG4CXX_STR("\"."));
- }
+ if (l != 0)
+ {
+ setThreshold(l);
+ }
+ else
+ {
+ LogLog::warn(((LogString) LOG4CXX_STR("No level could be found named \""))
+ + levelStr + LOG4CXX_STR("\"."));
+ }
}
void Hierarchy::fireAddAppenderEvent(const LoggerPtr& logger, const AppenderPtr& appender)
{
- setConfigured(true);
- HierarchyEventListenerList clonedList;
- {
- synchronized sync(mutex);
- clonedList = listeners;
- }
+ setConfigured(true);
+ HierarchyEventListenerList clonedList;
+ {
+ synchronized sync(mutex);
+ clonedList = listeners;
+ }
- HierarchyEventListenerList::iterator it, itEnd = clonedList.end();
- HierarchyEventListenerPtr listener;
+ HierarchyEventListenerList::iterator it, itEnd = clonedList.end();
+ HierarchyEventListenerPtr listener;
- for (it = clonedList.begin(); it != itEnd; it++)
- {
- listener = *it;
- listener->addAppenderEvent(logger, appender);
- }
+ for (it = clonedList.begin(); it != itEnd; it++)
+ {
+ listener = *it;
+ listener->addAppenderEvent(logger, appender);
+ }
}
void Hierarchy::fireRemoveAppenderEvent(const LoggerPtr& logger, const AppenderPtr& appender)
{
- HierarchyEventListenerList clonedList;
- {
- synchronized sync(mutex);
- clonedList = listeners;
- }
- HierarchyEventListenerList::iterator it, itEnd = clonedList.end();
- HierarchyEventListenerPtr listener;
+ HierarchyEventListenerList clonedList;
+ {
+ synchronized sync(mutex);
+ clonedList = listeners;
+ }
+ HierarchyEventListenerList::iterator it, itEnd = clonedList.end();
+ HierarchyEventListenerPtr listener;
- for (it = clonedList.begin(); it != itEnd; it++)
- {
- listener = *it;
- listener->removeAppenderEvent(logger, appender);
- }
+ for (it = clonedList.begin(); it != itEnd; it++)
+ {
+ listener = *it;
+ listener->removeAppenderEvent(logger, appender);
+ }
}
const LevelPtr& Hierarchy::getThreshold() const
{
- return threshold;
+ return threshold;
}
LoggerPtr Hierarchy::getLogger(const LogString& name)
{
- return getLogger(name, defaultFactory);
+ return getLogger(name, defaultFactory);
}
LoggerPtr Hierarchy::getLogger(const LogString& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- LoggerMap::iterator it = loggers->find(name);
+ LoggerMap::iterator it = loggers->find(name);
- if (it != loggers->end())
- {
- return it->second;
- }
- else
- {
- LoggerPtr logger(factory->makeNewLoggerInstance(pool, name));
- logger->setHierarchy(this);
- loggers->insert(LoggerMap::value_type(name, logger));
+ if (it != loggers->end())
+ {
+ return it->second;
+ }
+ else
+ {
+ LoggerPtr logger(factory->makeNewLoggerInstance(pool, name));
+ logger->setHierarchy(this);
+ loggers->insert(LoggerMap::value_type(name, logger));
- ProvisionNodeMap::iterator it2 = provisionNodes->find(name);
+ ProvisionNodeMap::iterator it2 = provisionNodes->find(name);
- if (it2 != provisionNodes->end())
- {
- updateChildren(it2->second, logger);
- provisionNodes->erase(it2);
- }
+ if (it2 != provisionNodes->end())
+ {
+ updateChildren(it2->second, logger);
+ provisionNodes->erase(it2);
+ }
- updateParents(logger);
- return logger;
- }
+ updateParents(logger);
+ return logger;
+ }
}
LoggerList Hierarchy::getCurrentLoggers() const
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- LoggerList v;
- LoggerMap::const_iterator it, itEnd = loggers->end();
+ LoggerList v;
+ LoggerMap::const_iterator it, itEnd = loggers->end();
- for (it = loggers->begin(); it != itEnd; it++)
- {
- v.push_back(it->second);
- }
+ for (it = loggers->begin(); it != itEnd; it++)
+ {
+ v.push_back(it->second);
+ }
- return v;
+ return v;
}
LoggerPtr Hierarchy::getRootLogger() const
{
- return root;
+ return root;
}
bool Hierarchy::isDisabled(int level) const
{
- if (!configured)
- {
- synchronized sync(mutex);
+ if (!configured)
+ {
+ synchronized sync(mutex);
- if (!configured)
- {
- DefaultConfigurator::configure(
- const_cast<Hierarchy*>(this));
- }
- }
+ if (!configured)
+ {
+ DefaultConfigurator::configure(
+ const_cast<Hierarchy*>(this));
+ }
+ }
- return thresholdInt > level;
+ return thresholdInt > level;
}
void Hierarchy::resetConfiguration()
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- getRootLogger()->setLevel(Level::getDebug());
- root->setResourceBundle(0);
- setThreshold(Level::getAll());
+ getRootLogger()->setLevel(Level::getDebug());
+ root->setResourceBundle(0);
+ setThreshold(Level::getAll());
- shutdown(); // nested locks are OK
+ shutdown(); // nested locks are OK
- LoggerList loggers1 = getCurrentLoggers();
- LoggerList::iterator it, itEnd = loggers1.end();
+ LoggerList loggers1 = getCurrentLoggers();
+ LoggerList::iterator it, itEnd = loggers1.end();
- for (it = loggers1.begin(); it != itEnd; it++)
- {
- LoggerPtr& logger = *it;
- logger->setLevel(0);
- logger->setAdditivity(true);
- logger->setResourceBundle(0);
- }
+ for (it = loggers1.begin(); it != itEnd; it++)
+ {
+ LoggerPtr& logger = *it;
+ logger->setLevel(0);
+ logger->setAdditivity(true);
+ logger->setResourceBundle(0);
+ }
- //rendererMap.clear();
+ //rendererMap.clear();
}
void Hierarchy::shutdown()
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- setConfigured(false);
+ setConfigured(false);
- LoggerPtr root1 = getRootLogger();
+ LoggerPtr root1 = getRootLogger();
- // begin by closing nested appenders
- root1->closeNestedAppenders();
+ // begin by closing nested appenders
+ root1->closeNestedAppenders();
- LoggerList loggers1 = getCurrentLoggers();
- LoggerList::iterator it, itEnd = loggers1.end();
+ LoggerList loggers1 = getCurrentLoggers();
+ LoggerList::iterator it, itEnd = loggers1.end();
- for (it = loggers1.begin(); it != itEnd; it++)
- {
- LoggerPtr& logger = *it;
- logger->closeNestedAppenders();
- }
+ for (it = loggers1.begin(); it != itEnd; it++)
+ {
+ LoggerPtr& logger = *it;
+ logger->closeNestedAppenders();
+ }
- // then, remove all appenders
- root1->removeAllAppenders();
+ // then, remove all appenders
+ root1->removeAllAppenders();
- for (it = loggers1.begin(); it != itEnd; it++)
- {
- LoggerPtr& logger = *it;
- logger->removeAllAppenders();
- }
+ for (it = loggers1.begin(); it != itEnd; it++)
+ {
+ LoggerPtr& logger = *it;
+ logger->removeAllAppenders();
+ }
}
void Hierarchy::updateParents(LoggerPtr logger)
{
- synchronized sync(mutex);
- const LogString name(logger->getName());
- int length = name.size();
- bool parentFound = false;
+ synchronized sync(mutex);
+ const LogString name(logger->getName());
+ int length = name.size();
+ bool parentFound = false;
- // if name = "w.x.y.z", loop through "w.x.y", "w.x" and "w", but not "w.x.y.z"
- for (size_t i = name.find_last_of(0x2E /* '.' */, length - 1);
- (i != LogString::npos) && (i != 0);
- i = name.find_last_of(0x2E /* '.' */, i - 1))
- {
- LogString substr = name.substr(0, i);
+ // if name = "w.x.y.z", loop through "w.x.y", "w.x" and "w", but not "w.x.y.z"
+ for (size_t i = name.find_last_of(0x2E /* '.' */, length - 1);
+ (i != LogString::npos) && (i != 0);
+ i = name.find_last_of(0x2E /* '.' */, i - 1))
+ {
+ LogString substr = name.substr(0, i);
- LoggerMap::iterator it = loggers->find(substr);
+ LoggerMap::iterator it = loggers->find(substr);
- if (it != loggers->end())
- {
- parentFound = true;
- logger->parent = it->second;
- break; // no need to update the ancestors of the closest ancestor
- }
- else
- {
- ProvisionNodeMap::iterator it2 = provisionNodes->find(substr);
+ if (it != loggers->end())
+ {
+ parentFound = true;
+ logger->parent = it->second;
+ break; // no need to update the ancestors of the closest ancestor
+ }
+ else
+ {
+ ProvisionNodeMap::iterator it2 = provisionNodes->find(substr);
- if (it2 != provisionNodes->end())
- {
- it2->second.push_back(logger);
- }
- else
- {
- ProvisionNode node(1, logger);
- provisionNodes->insert(
- ProvisionNodeMap::value_type(substr, node));
- }
- }
- }
+ if (it2 != provisionNodes->end())
+ {
+ it2->second.push_back(logger);
+ }
+ else
+ {
+ ProvisionNode node(1, logger);
+ provisionNodes->insert(
+ ProvisionNodeMap::value_type(substr, node));
+ }
+ }
+ }
- // If we could not find any existing parents, then link with root.
- if (!parentFound)
- {
- logger->parent = root;
- }
+ // If we could not find any existing parents, then link with root.
+ if (!parentFound)
+ {
+ logger->parent = root;
+ }
}
void Hierarchy::updateChildren(ProvisionNode& pn, LoggerPtr logger)
{
- ProvisionNode::iterator it, itEnd = pn.end();
+ ProvisionNode::iterator it, itEnd = pn.end();
- for (it = pn.begin(); it != itEnd; it++)
- {
- LoggerPtr& l = *it;
+ for (it = pn.begin(); it != itEnd; it++)
+ {
+ LoggerPtr& l = *it;
- // Unless this child already points to a correct (lower) parent,
- // make cat.parent point to l.parent and l.parent to cat.
- if (!StringHelper::startsWith(l->parent->name, logger->name))
- {
- logger->parent = l->parent;
- l->parent = logger;
- }
- }
+ // Unless this child already points to a correct (lower) parent,
+ // make cat.parent point to l.parent and l.parent to cat.
+ if (!StringHelper::startsWith(l->parent->name, logger->name))
+ {
+ logger->parent = l->parent;
+ l->parent = logger;
+ }
+ }
}
void Hierarchy::setConfigured(bool newValue)
{
- synchronized sync(mutex);
- configured = newValue;
+ synchronized sync(mutex);
+ configured = newValue;
}
bool Hierarchy::isConfigured()
{
- return configured;
+ return configured;
}
diff --git a/src/main/cpp/htmllayout.cpp b/src/main/cpp/htmllayout.cpp
index 21ba54b..f63e78e 100644
--- a/src/main/cpp/htmllayout.cpp
+++ b/src/main/cpp/htmllayout.cpp
@@ -37,190 +37,190 @@
HTMLLayout::HTMLLayout()
- : locationInfo(false), title(LOG4CXX_STR("Log4cxx Log Messages")),
- dateFormat()
+ : locationInfo(false), title(LOG4CXX_STR("Log4cxx Log Messages")),
+ dateFormat()
{
- dateFormat.setTimeZone(TimeZone::getGMT());
+ dateFormat.setTimeZone(TimeZone::getGMT());
}
void HTMLLayout::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("TITLE"), LOG4CXX_STR("title")))
- {
- setTitle(value);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, false));
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("TITLE"), LOG4CXX_STR("title")))
+ {
+ setTitle(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, false));
+ }
}
void HTMLLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- Pool& p) const
+ const spi::LoggingEventPtr& event,
+ Pool& p) const
{
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<tr>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<td>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<tr>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<td>"));
- dateFormat.format(output, event->getTimeStamp(), p);
+ dateFormat.format(output, event->getTimeStamp(), p);
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<td title=\""));
- LogString threadName(event->getThreadName());
- output.append(threadName);
- output.append(LOG4CXX_STR(" thread\">"));
- output.append(threadName);
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<td title=\""));
+ LogString threadName(event->getThreadName());
+ output.append(threadName);
+ output.append(LOG4CXX_STR(" thread\">"));
+ output.append(threadName);
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<td title=\"Level\">"));
+ output.append(LOG4CXX_STR("<td title=\"Level\">"));
- if (event->getLevel()->equals(Level::getDebug()))
- {
- output.append(LOG4CXX_STR("<font color=\"#339933\">"));
- output.append(event->getLevel()->toString());
- output.append(LOG4CXX_STR("</font>"));
- }
- else if (event->getLevel()->isGreaterOrEqual(Level::getWarn()))
- {
- output.append(LOG4CXX_STR("<font color=\"#993300\"><strong>"));
- output.append(event->getLevel()->toString());
- output.append(LOG4CXX_STR("</strong></font>"));
- }
- else
- {
- output.append(event->getLevel()->toString());
- }
+ if (event->getLevel()->equals(Level::getDebug()))
+ {
+ output.append(LOG4CXX_STR("<font color=\"#339933\">"));
+ output.append(event->getLevel()->toString());
+ output.append(LOG4CXX_STR("</font>"));
+ }
+ else if (event->getLevel()->isGreaterOrEqual(Level::getWarn()))
+ {
+ output.append(LOG4CXX_STR("<font color=\"#993300\"><strong>"));
+ output.append(event->getLevel()->toString());
+ output.append(LOG4CXX_STR("</strong></font>"));
+ }
+ else
+ {
+ output.append(event->getLevel()->toString());
+ }
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<td title=\""));
- output.append(event->getLoggerName());
- output.append(LOG4CXX_STR(" logger\">"));
- Transform::appendEscapingTags(output, event->getLoggerName());
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<td title=\""));
+ output.append(event->getLoggerName());
+ output.append(LOG4CXX_STR(" logger\">"));
+ Transform::appendEscapingTags(output, event->getLoggerName());
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
- if (locationInfo)
- {
- output.append(LOG4CXX_STR("<td>"));
- const LocationInfo& locInfo = event->getLocationInformation();
- LOG4CXX_DECODE_CHAR(fileName, locInfo.getFileName());
- Transform::appendEscapingTags(output, fileName);
- output.append(1, (logchar) 0x3A /* ':' */);
- int line = event->getLocationInformation().getLineNumber();
+ if (locationInfo)
+ {
+ output.append(LOG4CXX_STR("<td>"));
+ const LocationInfo& locInfo = event->getLocationInformation();
+ LOG4CXX_DECODE_CHAR(fileName, locInfo.getFileName());
+ Transform::appendEscapingTags(output, fileName);
+ output.append(1, (logchar) 0x3A /* ':' */);
+ int line = event->getLocationInformation().getLineNumber();
- if (line != 0)
- {
- StringHelper::toString(line, p, output);
- }
+ if (line != 0)
+ {
+ StringHelper::toString(line, p, output);
+ }
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
- }
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
+ }
- output.append(LOG4CXX_STR("<td title=\"Message\">"));
- Transform::appendEscapingTags(output, event->getRenderedMessage());
- output.append(LOG4CXX_STR("</td>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("</tr>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<td title=\"Message\">"));
+ Transform::appendEscapingTags(output, event->getRenderedMessage());
+ output.append(LOG4CXX_STR("</td>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</tr>"));
+ output.append(LOG4CXX_EOL);
- LogString ndcVal;
+ LogString ndcVal;
- if (event->getNDC(ndcVal))
- {
- output.append(LOG4CXX_STR("<tr><td bgcolor=\"#EEEEEE\" "));
- output.append(LOG4CXX_STR("style=\"font-size : xx-small;\" colspan=\"6\" "));
- output.append(LOG4CXX_STR("title=\"Nested Diagnostic Context\">"));
- output.append(LOG4CXX_STR("NDC: "));
- Transform::appendEscapingTags(output, ndcVal);
- output.append(LOG4CXX_STR("</td></tr>"));
- output.append(LOG4CXX_EOL);
- }
+ if (event->getNDC(ndcVal))
+ {
+ output.append(LOG4CXX_STR("<tr><td bgcolor=\"#EEEEEE\" "));
+ output.append(LOG4CXX_STR("style=\"font-size : xx-small;\" colspan=\"6\" "));
+ output.append(LOG4CXX_STR("title=\"Nested Diagnostic Context\">"));
+ output.append(LOG4CXX_STR("NDC: "));
+ Transform::appendEscapingTags(output, ndcVal);
+ output.append(LOG4CXX_STR("</td></tr>"));
+ output.append(LOG4CXX_EOL);
+ }
}
void HTMLLayout::appendHeader(LogString& output, Pool& p)
{
- output.append(LOG4CXX_STR("<!DOCTYPE HTML PUBLIC "));
- output.append(LOG4CXX_STR("\"-//W3C//DTD HTML 4.01 Transitional//EN\" "));
- output.append(LOG4CXX_STR("\"http://www.w3.org/TR/html4/loose.dtd\">"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<html>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<head>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<title>"));
- output.append(title);
- output.append(LOG4CXX_STR("</title>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<style type=\"text/css\">"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<!--"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("body, table {font-family: arial,sans-serif; font-size: x-small;}"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("th {background: #336699; color: #FFFFFF; text-align: left;}"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("-->"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("</style>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("</head>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<hr size=\"1\" noshade>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("Log session start time "));
+ output.append(LOG4CXX_STR("<!DOCTYPE HTML PUBLIC "));
+ output.append(LOG4CXX_STR("\"-//W3C//DTD HTML 4.01 Transitional//EN\" "));
+ output.append(LOG4CXX_STR("\"http://www.w3.org/TR/html4/loose.dtd\">"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<html>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<head>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<title>"));
+ output.append(title);
+ output.append(LOG4CXX_STR("</title>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<style type=\"text/css\">"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<!--"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("body, table {font-family: arial,sans-serif; font-size: x-small;}"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("th {background: #336699; color: #FFFFFF; text-align: left;}"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("-->"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</style>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</head>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<hr size=\"1\" noshade>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("Log session start time "));
- dateFormat.format(output, apr_time_now(), p);
+ dateFormat.format(output, apr_time_now(), p);
- output.append(LOG4CXX_STR("<br>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<br>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<tr>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<th>Time</th>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<th>Thread</th>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<th>Level</th>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<th>Logger</th>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<br>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<br>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<tr>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<th>Time</th>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<th>Thread</th>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<th>Level</th>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<th>Logger</th>"));
+ output.append(LOG4CXX_EOL);
- if (locationInfo)
- {
- output.append(LOG4CXX_STR("<th>File:Line</th>"));
- output.append(LOG4CXX_EOL);
- }
+ if (locationInfo)
+ {
+ output.append(LOG4CXX_STR("<th>File:Line</th>"));
+ output.append(LOG4CXX_EOL);
+ }
- output.append(LOG4CXX_STR("<th>Message</th>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("</tr>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<th>Message</th>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</tr>"));
+ output.append(LOG4CXX_EOL);
}
void HTMLLayout::appendFooter(LogString& output, Pool& /* pool */ )
{
- output.append(LOG4CXX_STR("</table>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<br>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("</body></html>"));
+ output.append(LOG4CXX_STR("</table>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<br>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</body></html>"));
}
diff --git a/src/main/cpp/inetaddress.cpp b/src/main/cpp/inetaddress.cpp
index 473adf1..5158648 100644
--- a/src/main/cpp/inetaddress.cpp
+++ b/src/main/cpp/inetaddress.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -32,24 +32,24 @@
IMPLEMENT_LOG4CXX_OBJECT(InetAddress)
UnknownHostException::UnknownHostException(const LogString& msg1)
- : Exception(msg1)
+ : Exception(msg1)
{
}
UnknownHostException::UnknownHostException(const UnknownHostException& src)
- : Exception(src)
+ : Exception(src)
{
}
UnknownHostException& UnknownHostException::operator=(const UnknownHostException& src)
{
- Exception::operator=(src);
- return *this;
+ Exception::operator=(src);
+ return *this;
}
InetAddress::InetAddress(const LogString& hostName, const LogString& hostAddr)
- : ipAddrString(hostAddr), hostNameString(hostName)
+ : ipAddrString(hostAddr), hostNameString(hostName)
{
}
@@ -58,56 +58,56 @@
*/
std::vector<InetAddressPtr> InetAddress::getAllByName(const LogString& host)
{
- LOG4CXX_ENCODE_CHAR(encodedHost, host);
+ LOG4CXX_ENCODE_CHAR(encodedHost, host);
- // retrieve information about the given host
- Pool addrPool;
+ // retrieve information about the given host
+ Pool addrPool;
- apr_sockaddr_t* address = 0;
- apr_status_t status =
- apr_sockaddr_info_get(&address, encodedHost.c_str(),
- APR_INET, 0, 0, addrPool.getAPRPool());
+ apr_sockaddr_t* address = 0;
+ apr_status_t status =
+ apr_sockaddr_info_get(&address, encodedHost.c_str(),
+ APR_INET, 0, 0, addrPool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- LogString msg(LOG4CXX_STR("Cannot get information about host: "));
- msg.append(host);
- LogLog::error(msg);
- throw UnknownHostException(msg);
- }
+ if (status != APR_SUCCESS)
+ {
+ LogString msg(LOG4CXX_STR("Cannot get information about host: "));
+ msg.append(host);
+ LogLog::error(msg);
+ throw UnknownHostException(msg);
+ }
- std::vector<InetAddressPtr> result;
- apr_sockaddr_t* currentAddr = address;
+ std::vector<InetAddressPtr> result;
+ apr_sockaddr_t* currentAddr = address;
- while (currentAddr != NULL)
- {
- // retrieve the IP address of this InetAddress.
- LogString ipAddrString;
- char* ipAddr;
- status = apr_sockaddr_ip_get(&ipAddr, currentAddr);
+ while (currentAddr != NULL)
+ {
+ // retrieve the IP address of this InetAddress.
+ LogString ipAddrString;
+ char* ipAddr;
+ status = apr_sockaddr_ip_get(&ipAddr, currentAddr);
- if (status == APR_SUCCESS)
- {
- std::string ip(ipAddr);
- Transcoder::decode(ip, ipAddrString);
- }
+ if (status == APR_SUCCESS)
+ {
+ std::string ip(ipAddr);
+ Transcoder::decode(ip, ipAddrString);
+ }
- // retrieve the host name of this InetAddress.
- LogString hostNameString;
- char* hostName;
- status = apr_getnameinfo(&hostName, currentAddr, 0);
+ // retrieve the host name of this InetAddress.
+ LogString hostNameString;
+ char* hostName;
+ status = apr_getnameinfo(&hostName, currentAddr, 0);
- if (status == APR_SUCCESS)
- {
- std::string host(hostName);
- Transcoder::decode(host, hostNameString);
- }
+ if (status == APR_SUCCESS)
+ {
+ std::string host(hostName);
+ Transcoder::decode(host, hostNameString);
+ }
- result.push_back(new InetAddress(hostNameString, ipAddrString));
- currentAddr = currentAddr->next;
- }
+ result.push_back(new InetAddress(hostNameString, ipAddrString));
+ currentAddr = currentAddr->next;
+ }
- return result;
+ return result;
}
@@ -115,35 +115,35 @@
*/
InetAddressPtr InetAddress::getByName(const LogString& host)
{
- return getAllByName(host)[0];
+ return getAllByName(host)[0];
}
/** Returns the IP address string "%d.%d.%d.%d".
*/
LogString InetAddress::getHostAddress() const
{
- return ipAddrString;
+ return ipAddrString;
}
/** Gets the host name for this IP address.
*/
LogString InetAddress::getHostName() const
{
- return hostNameString;
+ return hostNameString;
}
/** Returns the local host.
*/
InetAddressPtr InetAddress::getLocalHost()
{
- return getByName(LOG4CXX_STR("127.0.0.1"));
+ return getByName(LOG4CXX_STR("127.0.0.1"));
}
InetAddressPtr InetAddress::anyAddress()
{
- // APR_ANYADDR does not work with the LOG4CXX_STR macro
- return getByName(LOG4CXX_STR("0.0.0.0"));
+ // APR_ANYADDR does not work with the LOG4CXX_STR macro
+ return getByName(LOG4CXX_STR("0.0.0.0"));
}
@@ -151,9 +151,9 @@
*/
LogString InetAddress::toString() const
{
- LogString rv(getHostName());
- rv.append(LOG4CXX_STR("/"));
- rv.append(getHostAddress());
- return rv;
+ LogString rv(getHostName());
+ rv.append(LOG4CXX_STR("/"));
+ rv.append(getHostAddress());
+ return rv;
}
diff --git a/src/main/cpp/inputstreamreader.cpp b/src/main/cpp/inputstreamreader.cpp
index 752adad..3ab887e 100644
--- a/src/main/cpp/inputstreamreader.cpp
+++ b/src/main/cpp/inputstreamreader.cpp
@@ -30,26 +30,26 @@
IMPLEMENT_LOG4CXX_OBJECT(InputStreamReader)
InputStreamReader::InputStreamReader(const InputStreamPtr& in1)
- : in(in1), dec(CharsetDecoder::getDefaultDecoder())
+ : in(in1), dec(CharsetDecoder::getDefaultDecoder())
{
- if (in1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
- }
+ if (in1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
+ }
}
InputStreamReader::InputStreamReader(const InputStreamPtr& in1, const CharsetDecoderPtr& dec1)
- : in(in1), dec(dec1)
+ : in(in1), dec(dec1)
{
- if (in1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
- }
+ if (in1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
+ }
- if (dec1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("dec parameter may not be null."));
- }
+ if (dec1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("dec parameter may not be null."));
+ }
}
InputStreamReader::~InputStreamReader()
@@ -58,36 +58,36 @@
void InputStreamReader::close(Pool& )
{
- in->close();
+ in->close();
}
LogString InputStreamReader::read(Pool& p)
{
- const size_t BUFSIZE = 4096;
- ByteBuffer buf(p.pstralloc(BUFSIZE), BUFSIZE);
- LogString output;
+ const size_t BUFSIZE = 4096;
+ ByteBuffer buf(p.pstralloc(BUFSIZE), BUFSIZE);
+ LogString output;
- // read whole file
- while (in->read(buf) >= 0)
- {
- buf.flip();
- log4cxx_status_t stat = dec->decode(buf, output);
+ // read whole file
+ while (in->read(buf) >= 0)
+ {
+ buf.flip();
+ log4cxx_status_t stat = dec->decode(buf, output);
- if (stat != 0)
- {
- throw IOException(stat);
- }
+ if (stat != 0)
+ {
+ throw IOException(stat);
+ }
- if (buf.remaining() > 0)
- {
- memmove(buf.data(), buf.current(), buf.remaining());
- buf.limit(buf.remaining());
- }
- else
- {
- buf.clear();
- }
- }
+ if (buf.remaining() > 0)
+ {
+ memmove(buf.data(), buf.current(), buf.remaining());
+ buf.limit(buf.remaining());
+ }
+ else
+ {
+ buf.clear();
+ }
+ }
- return output;
+ return output;
}
diff --git a/src/main/cpp/integerpatternconverter.cpp b/src/main/cpp/integerpatternconverter.cpp
index 4eeb10f..27be938 100644
--- a/src/main/cpp/integerpatternconverter.cpp
+++ b/src/main/cpp/integerpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -31,27 +31,27 @@
IMPLEMENT_LOG4CXX_OBJECT(IntegerPatternConverter)
IntegerPatternConverter::IntegerPatternConverter() :
- PatternConverter(LOG4CXX_STR("Integer"),
- LOG4CXX_STR("integer"))
+ PatternConverter(LOG4CXX_STR("Integer"),
+ LOG4CXX_STR("integer"))
{
}
PatternConverterPtr IntegerPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr instance(new IntegerPatternConverter());
- return instance;
+ static PatternConverterPtr instance(new IntegerPatternConverter());
+ return instance;
}
void IntegerPatternConverter::format(
- const ObjectPtr& obj,
- LogString& toAppendTo,
- Pool& p) const
+ const ObjectPtr& obj,
+ LogString& toAppendTo,
+ Pool& p) const
{
- IntegerPtr i(obj);
+ IntegerPtr i(obj);
- if (i != NULL)
- {
- StringHelper::toString(i->intValue(), p, toAppendTo);
- }
+ if (i != NULL)
+ {
+ StringHelper::toString(i->intValue(), p, toAppendTo);
+ }
}
diff --git a/src/main/cpp/layout.cpp b/src/main/cpp/layout.cpp
index acaf730..a54215c 100644
--- a/src/main/cpp/layout.cpp
+++ b/src/main/cpp/layout.cpp
@@ -27,17 +27,17 @@
void Layout::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void Layout::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
LogString Layout::getContentType() const
{
- return LOG4CXX_STR("text/plain");
+ return LOG4CXX_STR("text/plain");
}
void Layout::appendHeader(LogString&, log4cxx::helpers::Pool&) {}
diff --git a/src/main/cpp/level.cpp b/src/main/cpp/level.cpp
index 6a18f9c..ef388a9 100644
--- a/src/main/cpp/level.cpp
+++ b/src/main/cpp/level.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/stringhelper.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -31,135 +31,135 @@
LevelPtr Level::getOff()
{
- return LevelPtr(new Level(Level::OFF_INT, LOG4CXX_STR("OFF"), 0));
+ return LevelPtr(new Level(Level::OFF_INT, LOG4CXX_STR("OFF"), 0));
}
LevelPtr Level::getFatal()
{
- return LevelPtr(new Level(Level::FATAL_INT, LOG4CXX_STR("FATAL"), 0));
+ return LevelPtr(new Level(Level::FATAL_INT, LOG4CXX_STR("FATAL"), 0));
}
LevelPtr Level::getError()
{
- return LevelPtr(new Level(Level::ERROR_INT, LOG4CXX_STR("ERROR"), 3));
+ return LevelPtr(new Level(Level::ERROR_INT, LOG4CXX_STR("ERROR"), 3));
}
LevelPtr Level::getWarn()
{
- return LevelPtr(new Level(Level::WARN_INT, LOG4CXX_STR("WARN"), 4));
+ return LevelPtr(new Level(Level::WARN_INT, LOG4CXX_STR("WARN"), 4));
}
LevelPtr Level::getInfo()
{
- return LevelPtr(new Level(Level::INFO_INT, LOG4CXX_STR("INFO"), 6));
+ return LevelPtr(new Level(Level::INFO_INT, LOG4CXX_STR("INFO"), 6));
}
LevelPtr Level::getDebug()
{
- return LevelPtr(new Level(Level::DEBUG_INT, LOG4CXX_STR("DEBUG"), 7));
+ return LevelPtr(new Level(Level::DEBUG_INT, LOG4CXX_STR("DEBUG"), 7));
}
LevelPtr Level::getTrace()
{
- return LevelPtr(new Level(Level::TRACE_INT, LOG4CXX_STR("TRACE"), 7));
+ return LevelPtr(new Level(Level::TRACE_INT, LOG4CXX_STR("TRACE"), 7));
}
LevelPtr Level::getAll()
{
- return LevelPtr(new Level(Level::ALL_INT, LOG4CXX_STR("ALL"), 7));
+ return LevelPtr(new Level(Level::ALL_INT, LOG4CXX_STR("ALL"), 7));
}
Level::Level(int level1,
- const LogString& name1, int syslogEquivalent1)
- : level(level1), name(name1), syslogEquivalent(syslogEquivalent1)
+ const LogString& name1, int syslogEquivalent1)
+ : level(level1), name(name1), syslogEquivalent(syslogEquivalent1)
{
- APRInitializer::initialize();
+ APRInitializer::initialize();
}
LevelPtr Level::toLevelLS(const LogString& sArg)
{
- return toLevelLS(sArg, Level::getDebug());
+ return toLevelLS(sArg, Level::getDebug());
}
LogString Level::toString() const
{
- return name;
+ return name;
}
LevelPtr Level::toLevel(int val)
{
- return toLevel(val, Level::getDebug());
+ return toLevel(val, Level::getDebug());
}
LevelPtr Level::toLevel(int val, const LevelPtr& defaultLevel)
{
- switch (val)
- {
- case ALL_INT:
- return getAll();
+ switch (val)
+ {
+ case ALL_INT:
+ return getAll();
- case DEBUG_INT:
- return getDebug();
+ case DEBUG_INT:
+ return getDebug();
- case TRACE_INT:
- return getTrace();
+ case TRACE_INT:
+ return getTrace();
- case INFO_INT:
- return getInfo();
+ case INFO_INT:
+ return getInfo();
- case WARN_INT:
- return getWarn();
+ case WARN_INT:
+ return getWarn();
- case ERROR_INT:
- return getError();
+ case ERROR_INT:
+ return getError();
- case FATAL_INT:
- return getFatal();
+ case FATAL_INT:
+ return getFatal();
- case OFF_INT:
- return getOff();
+ case OFF_INT:
+ return getOff();
- default:
- return defaultLevel;
- }
+ default:
+ return defaultLevel;
+ }
}
LevelPtr Level::toLevel(const std::string& sArg)
{
- return toLevel(sArg, Level::getDebug());
+ return toLevel(sArg, Level::getDebug());
}
LevelPtr Level::toLevel(const std::string& sArg, const LevelPtr& defaultLevel)
{
- LOG4CXX_DECODE_CHAR(s, sArg);
- return toLevelLS(s, defaultLevel);
+ LOG4CXX_DECODE_CHAR(s, sArg);
+ return toLevelLS(s, defaultLevel);
}
void Level::toString(std::string& dst) const
{
- Transcoder::encode(name, dst);
+ Transcoder::encode(name, dst);
}
#if LOG4CXX_WCHAR_T_API
LevelPtr Level::toLevel(const std::wstring& sArg)
{
- return toLevel(sArg, Level::getDebug());
+ return toLevel(sArg, Level::getDebug());
}
LevelPtr Level::toLevel(const std::wstring& sArg, const LevelPtr& defaultLevel)
{
- LOG4CXX_DECODE_WCHAR(s, sArg);
- return toLevelLS(s, defaultLevel);
+ LOG4CXX_DECODE_WCHAR(s, sArg);
+ return toLevelLS(s, defaultLevel);
}
void Level::toString(std::wstring& dst) const
{
- Transcoder::encode(name, dst);
+ Transcoder::encode(name, dst);
}
#endif
@@ -167,18 +167,18 @@
#if LOG4CXX_UNICHAR_API
LevelPtr Level::toLevel(const std::basic_string<UniChar>& sArg)
{
- return toLevel(sArg, Level::getDebug());
+ return toLevel(sArg, Level::getDebug());
}
LevelPtr Level::toLevel(const std::basic_string<UniChar>& sArg, const LevelPtr& defaultLevel)
{
- LOG4CXX_DECODE_UNICHAR(s, sArg);
- return toLevelLS(s, defaultLevel);
+ LOG4CXX_DECODE_UNICHAR(s, sArg);
+ return toLevelLS(s, defaultLevel);
}
void Level::toString(std::basic_string<UniChar>& dst) const
{
- Transcoder::encode(name, dst);
+ Transcoder::encode(name, dst);
}
#endif
@@ -186,92 +186,92 @@
#if LOG4CXX_CFSTRING_API
LevelPtr Level::toLevel(const CFStringRef& sArg)
{
- return toLevel(sArg, Level::getDebug());
+ return toLevel(sArg, Level::getDebug());
}
LevelPtr Level::toLevel(const CFStringRef& sArg, const LevelPtr& defaultLevel)
{
- LogString s;
- Transcoder::decode(sArg, s);
- return toLevelLS(s, defaultLevel);
+ LogString s;
+ Transcoder::decode(sArg, s);
+ return toLevelLS(s, defaultLevel);
}
void Level::toString(CFStringRef& dst) const
{
- dst = Transcoder::encode(name);
+ dst = Transcoder::encode(name);
}
#endif
LevelPtr Level::toLevelLS(const LogString& sArg, const LevelPtr& defaultLevel)
{
- const LogString trimmed(StringHelper::trim(sArg));
- const size_t len = trimmed.length();
+ const LogString trimmed(StringHelper::trim(sArg));
+ const size_t len = trimmed.length();
- if (len == 4)
- {
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("INFO"), LOG4CXX_STR("info")))
- {
- return getInfo();
- }
+ if (len == 4)
+ {
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("INFO"), LOG4CXX_STR("info")))
+ {
+ return getInfo();
+ }
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("WARN"), LOG4CXX_STR("warn")))
- {
- return getWarn();
- }
- }
- else
- {
- if (len == 5)
- {
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("DEBUG"), LOG4CXX_STR("debug")))
- {
- return getDebug();
- }
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("WARN"), LOG4CXX_STR("warn")))
+ {
+ return getWarn();
+ }
+ }
+ else
+ {
+ if (len == 5)
+ {
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("DEBUG"), LOG4CXX_STR("debug")))
+ {
+ return getDebug();
+ }
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("TRACE"), LOG4CXX_STR("trace")))
- {
- return getTrace();
- }
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("TRACE"), LOG4CXX_STR("trace")))
+ {
+ return getTrace();
+ }
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("ERROR"), LOG4CXX_STR("error")))
- {
- return getError();
- }
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("ERROR"), LOG4CXX_STR("error")))
+ {
+ return getError();
+ }
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("FATAL"), LOG4CXX_STR("fatal")))
- {
- return getFatal();
- }
- }
- else
- {
- if (len == 3)
- {
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("OFF"), LOG4CXX_STR("off")))
- {
- return getOff();
- }
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("FATAL"), LOG4CXX_STR("fatal")))
+ {
+ return getFatal();
+ }
+ }
+ else
+ {
+ if (len == 3)
+ {
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("OFF"), LOG4CXX_STR("off")))
+ {
+ return getOff();
+ }
- if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("ALL"), LOG4CXX_STR("all")))
- {
- return getAll();
- }
- }
- }
- }
+ if (StringHelper::equalsIgnoreCase(trimmed, LOG4CXX_STR("ALL"), LOG4CXX_STR("all")))
+ {
+ return getAll();
+ }
+ }
+ }
+ }
- return defaultLevel;
+ return defaultLevel;
}
bool Level::equals(const LevelPtr& level1) const
{
- return (this->level == level1->level);
+ return (this->level == level1->level);
}
bool Level::isGreaterOrEqual(const LevelPtr& level1) const
{
- return this->level >= level1->level;
+ return this->level >= level1->level;
}
diff --git a/src/main/cpp/levelmatchfilter.cpp b/src/main/cpp/levelmatchfilter.cpp
index c898b39..4784269 100644
--- a/src/main/cpp/levelmatchfilter.cpp
+++ b/src/main/cpp/levelmatchfilter.cpp
@@ -31,54 +31,54 @@
LevelMatchFilter::LevelMatchFilter()
- : acceptOnMatch(true)
+ : acceptOnMatch(true)
{
}
void LevelMatchFilter::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("LEVELTOMATCH"), LOG4CXX_STR("leveltomatch")))
- {
- setLevelToMatch(value);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
- {
- acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("LEVELTOMATCH"), LOG4CXX_STR("leveltomatch")))
+ {
+ setLevelToMatch(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
+ {
+ acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
+ }
}
void LevelMatchFilter::setLevelToMatch(const LogString& levelToMatch1)
{
- this->levelToMatch = OptionConverter::toLevel(levelToMatch1, this->levelToMatch);
+ this->levelToMatch = OptionConverter::toLevel(levelToMatch1, this->levelToMatch);
}
LogString LevelMatchFilter::getLevelToMatch() const
{
- return levelToMatch->toString();
+ return levelToMatch->toString();
}
Filter::FilterDecision LevelMatchFilter::decide(
- const log4cxx::spi::LoggingEventPtr& event) const
+ const log4cxx::spi::LoggingEventPtr& event) const
{
- if (levelToMatch != 0 && levelToMatch->equals(event->getLevel()))
- {
- if (acceptOnMatch)
- {
- return Filter::ACCEPT;
- }
- else
- {
- return Filter::DENY;
- }
- }
- else
- {
- return Filter::NEUTRAL;
- }
+ if (levelToMatch != 0 && levelToMatch->equals(event->getLevel()))
+ {
+ if (acceptOnMatch)
+ {
+ return Filter::ACCEPT;
+ }
+ else
+ {
+ return Filter::DENY;
+ }
+ }
+ else
+ {
+ return Filter::NEUTRAL;
+ }
}
diff --git a/src/main/cpp/levelpatternconverter.cpp b/src/main/cpp/levelpatternconverter.cpp
index ad1e356..03ffad2 100644
--- a/src/main/cpp/levelpatternconverter.cpp
+++ b/src/main/cpp/levelpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -33,24 +33,24 @@
IMPLEMENT_LOG4CXX_OBJECT(LevelPatternConverter)
LevelPatternConverter::LevelPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Level"),
- LOG4CXX_STR("level"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Level"),
+ LOG4CXX_STR("level"))
{
}
PatternConverterPtr LevelPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr def(new LevelPatternConverter());
- return def;
+ static PatternConverterPtr def(new LevelPatternConverter());
+ return def;
}
void LevelPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& /* p */) const
{
- toAppendTo.append(event->getLevel()->toString());
+ toAppendTo.append(event->getLevel()->toString());
}
@@ -59,36 +59,36 @@
*/
LogString LevelPatternConverter::getStyleClass(const ObjectPtr& obj) const
{
- LoggingEventPtr e(obj);
+ LoggingEventPtr e(obj);
- if (e != NULL)
- {
- int lint = e->getLevel()->toInt();
+ if (e != NULL)
+ {
+ int lint = e->getLevel()->toInt();
- switch (lint)
- {
- case Level::TRACE_INT:
- return LOG4CXX_STR("level trace");
+ switch (lint)
+ {
+ case Level::TRACE_INT:
+ return LOG4CXX_STR("level trace");
- case Level::DEBUG_INT:
- return LOG4CXX_STR("level debug");
+ case Level::DEBUG_INT:
+ return LOG4CXX_STR("level debug");
- case Level::INFO_INT:
- return LOG4CXX_STR("level info");
+ case Level::INFO_INT:
+ return LOG4CXX_STR("level info");
- case Level::WARN_INT:
- return LOG4CXX_STR("level warn");
+ case Level::WARN_INT:
+ return LOG4CXX_STR("level warn");
- case Level::ERROR_INT:
- return LOG4CXX_STR("level error");
+ case Level::ERROR_INT:
+ return LOG4CXX_STR("level error");
- case Level::FATAL_INT:
- return LOG4CXX_STR("level fatal");
+ case Level::FATAL_INT:
+ return LOG4CXX_STR("level fatal");
- default:
- return LogString(LOG4CXX_STR("level ")) + e->getLevel()->toString();
- }
- }
+ default:
+ return LogString(LOG4CXX_STR("level ")) + e->getLevel()->toString();
+ }
+ }
- return LOG4CXX_STR("level");
+ return LOG4CXX_STR("level");
}
diff --git a/src/main/cpp/levelrangefilter.cpp b/src/main/cpp/levelrangefilter.cpp
index 00eba07..7747b7d 100644
--- a/src/main/cpp/levelrangefilter.cpp
+++ b/src/main/cpp/levelrangefilter.cpp
@@ -31,59 +31,59 @@
LevelRangeFilter::LevelRangeFilter()
- : acceptOnMatch(false), levelMin(Level::getAll()), levelMax(Level::getOff())
+ : acceptOnMatch(false), levelMin(Level::getAll()), levelMax(Level::getOff())
{
}
void LevelRangeFilter::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("LEVELMIN"), LOG4CXX_STR("levelmin")))
- {
- levelMin = OptionConverter::toLevel(value, levelMin);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("LEVELMAX"), LOG4CXX_STR("levelmax")))
- {
- levelMax = OptionConverter::toLevel(value, levelMax);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
- {
- acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("LEVELMIN"), LOG4CXX_STR("levelmin")))
+ {
+ levelMin = OptionConverter::toLevel(value, levelMin);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("LEVELMAX"), LOG4CXX_STR("levelmax")))
+ {
+ levelMax = OptionConverter::toLevel(value, levelMax);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
+ {
+ acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
+ }
}
Filter::FilterDecision LevelRangeFilter::decide(
- const spi::LoggingEventPtr& event) const
+ const spi::LoggingEventPtr& event) const
{
- if (levelMin != 0 && !event->getLevel()->isGreaterOrEqual(levelMin))
- {
- // level of event is less than minimum
- return Filter::DENY;
- }
+ if (levelMin != 0 && !event->getLevel()->isGreaterOrEqual(levelMin))
+ {
+ // level of event is less than minimum
+ return Filter::DENY;
+ }
- if (levelMax != 0 && event->getLevel()->toInt() > levelMax->toInt())
- {
- // level of event is greater than maximum
- // Alas, there is no Level.isGreater method. and using
- // a combo of isGreaterOrEqual && !Equal seems worse than
- // checking the int values of the level objects..
- return Filter::DENY;
- }
+ if (levelMax != 0 && event->getLevel()->toInt() > levelMax->toInt())
+ {
+ // level of event is greater than maximum
+ // Alas, there is no Level.isGreater method. and using
+ // a combo of isGreaterOrEqual && !Equal seems worse than
+ // checking the int values of the level objects..
+ return Filter::DENY;
+ }
- if (acceptOnMatch)
- {
- // this filter set up to bypass later filters and always return
- // accept if level in range
- return Filter::ACCEPT;
- }
- else
- {
- // event is ok for this filter; allow later filters to have a look..
- return Filter::NEUTRAL;
- }
+ if (acceptOnMatch)
+ {
+ // this filter set up to bypass later filters and always return
+ // accept if level in range
+ return Filter::ACCEPT;
+ }
+ else
+ {
+ // event is ok for this filter; allow later filters to have a look..
+ return Filter::NEUTRAL;
+ }
}
diff --git a/src/main/cpp/linelocationpatternconverter.cpp b/src/main/cpp/linelocationpatternconverter.cpp
index d42aec0..bb606ab 100644
--- a/src/main/cpp/linelocationpatternconverter.cpp
+++ b/src/main/cpp/linelocationpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -32,24 +32,24 @@
IMPLEMENT_LOG4CXX_OBJECT(LineLocationPatternConverter)
LineLocationPatternConverter::LineLocationPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Line"),
- LOG4CXX_STR("line"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Line"),
+ LOG4CXX_STR("line"))
{
}
PatternConverterPtr LineLocationPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr instance(new LineLocationPatternConverter());
- return instance;
+ static PatternConverterPtr instance(new LineLocationPatternConverter());
+ return instance;
}
void LineLocationPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& p) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& p) const
{
- StringHelper::toString(
- event->getLocationInformation().getLineNumber(),
- p, toAppendTo);
+ StringHelper::toString(
+ event->getLocationInformation().getLineNumber(),
+ p, toAppendTo);
}
diff --git a/src/main/cpp/lineseparatorpatternconverter.cpp b/src/main/cpp/lineseparatorpatternconverter.cpp
index 9cfb44f..6aa0c82 100644
--- a/src/main/cpp/lineseparatorpatternconverter.cpp
+++ b/src/main/cpp/lineseparatorpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -32,30 +32,30 @@
IMPLEMENT_LOG4CXX_OBJECT(LineSeparatorPatternConverter)
LineSeparatorPatternConverter::LineSeparatorPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Line Sep"),
- LOG4CXX_STR("lineSep"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Line Sep"),
+ LOG4CXX_STR("lineSep"))
{
}
PatternConverterPtr LineSeparatorPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr instance(new LineSeparatorPatternConverter());
- return instance;
+ static PatternConverterPtr instance(new LineSeparatorPatternConverter());
+ return instance;
}
void LineSeparatorPatternConverter::format(
- const LoggingEventPtr& /* event */,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& /* event */,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(LOG4CXX_EOL);
+ toAppendTo.append(LOG4CXX_EOL);
}
void LineSeparatorPatternConverter::format(
- const ObjectPtr& /* event */,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const ObjectPtr& /* event */,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(LOG4CXX_EOL);
+ toAppendTo.append(LOG4CXX_EOL);
}
diff --git a/src/main/cpp/literalpatternconverter.cpp b/src/main/cpp/literalpatternconverter.cpp
index 805d13c..c526b72 100644
--- a/src/main/cpp/literalpatternconverter.cpp
+++ b/src/main/cpp/literalpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -32,37 +32,37 @@
IMPLEMENT_LOG4CXX_OBJECT(LiteralPatternConverter)
LiteralPatternConverter::LiteralPatternConverter(const LogString& literal1) :
- LoggingEventPatternConverter(LOG4CXX_STR("Literal"), LOG4CXX_STR("literal")),
- literal(literal1)
+ LoggingEventPatternConverter(LOG4CXX_STR("Literal"), LOG4CXX_STR("literal")),
+ literal(literal1)
{
}
PatternConverterPtr LiteralPatternConverter::newInstance(
- const LogString& literal)
+ const LogString& literal)
{
- if (literal.length() == 1 && literal[0] == 0x20 /* ' ' */)
- {
- static PatternConverterPtr blank(new LiteralPatternConverter(literal));
- return blank;
- }
+ if (literal.length() == 1 && literal[0] == 0x20 /* ' ' */)
+ {
+ static PatternConverterPtr blank(new LiteralPatternConverter(literal));
+ return blank;
+ }
- PatternConverterPtr pattern(new LiteralPatternConverter(literal));
- return pattern;
+ PatternConverterPtr pattern(new LiteralPatternConverter(literal));
+ return pattern;
}
void LiteralPatternConverter::format(
- const LoggingEventPtr& /* event */,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& /* event */,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(literal);
+ toAppendTo.append(literal);
}
void LiteralPatternConverter::format(
- const ObjectPtr& /* event */,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const ObjectPtr& /* event */,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(literal);
+ toAppendTo.append(literal);
}
diff --git a/src/main/cpp/loader.cpp b/src/main/cpp/loader.cpp
index 2f22b2a..c8081de 100644
--- a/src/main/cpp/loader.cpp
+++ b/src/main/cpp/loader.cpp
@@ -56,20 +56,20 @@
const Class& Loader::loadClass(const LogString& clazz)
{
- return Class::forName(clazz);
+ return Class::forName(clazz);
}
InputStreamPtr Loader::getResourceAsStream(const LogString& name)
{
- try
- {
- return new FileInputStream(name);
- }
- catch (const IOException& ioex)
- {
- }
+ try
+ {
+ return new FileInputStream(name);
+ }
+ catch (const IOException& ioex)
+ {
+ }
- return 0;
+ return 0;
}
diff --git a/src/main/cpp/locale.cpp b/src/main/cpp/locale.cpp
index fc5a6dd..f75ef8a 100644
--- a/src/main/cpp/locale.cpp
+++ b/src/main/cpp/locale.cpp
@@ -22,34 +22,34 @@
Locale::Locale(const LogString& language1)
- : language(language1)
+ : language(language1)
{
}
Locale::Locale(const LogString& language1, const LogString& country1)
- : language(language1), country(country1)
+ : language(language1), country(country1)
{
}
Locale::Locale(const LogString& language1, const LogString& country1,
- const LogString& variant1)
- : language(language1), country(country1), variant(variant1)
+ const LogString& variant1)
+ : language(language1), country(country1), variant(variant1)
{
}
const LogString& Locale::getLanguage() const
{
- return language;
+ return language;
}
const LogString& Locale::getCountry() const
{
- return country;
+ return country;
}
const LogString& Locale::getVariant() const
{
- return variant;
+ return variant;
}
diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
index f2c9a3d..0ff6246 100644
--- a/src/main/cpp/locationinfo.cpp
+++ b/src/main/cpp/locationinfo.cpp
@@ -33,8 +33,8 @@
const LocationInfo& LocationInfo::getLocationUnavailable()
{
- static const LocationInfo unavailable;
- return unavailable;
+ static const LocationInfo unavailable;
+ return unavailable;
}
/**
@@ -43,11 +43,11 @@
* location info for current code site
*/
LocationInfo::LocationInfo( const char* const fileName1,
- const char* const methodName1,
- int lineNumber1 )
- : lineNumber( lineNumber1 ),
- fileName( fileName1 ),
- methodName( methodName1 )
+ const char* const methodName1,
+ int lineNumber1 )
+ : lineNumber( lineNumber1 ),
+ fileName( fileName1 ),
+ methodName( methodName1 )
{
}
@@ -55,9 +55,9 @@
* Default constructor.
*/
LocationInfo::LocationInfo()
- : lineNumber( -1 ),
- fileName(LocationInfo::NA),
- methodName(LocationInfo::NA_METHOD)
+ : lineNumber( -1 ),
+ fileName(LocationInfo::NA),
+ methodName(LocationInfo::NA_METHOD)
{
}
@@ -66,9 +66,9 @@
* @param src source location
*/
LocationInfo::LocationInfo( const LocationInfo& src )
- : lineNumber( src.lineNumber ),
- fileName( src.fileName ),
- methodName( src.methodName )
+ : lineNumber( src.lineNumber ),
+ fileName( src.fileName ),
+ methodName( src.methodName )
{
}
@@ -78,10 +78,10 @@
*/
LocationInfo& LocationInfo::operator = ( const LocationInfo& src )
{
- fileName = src.fileName;
- methodName = src.methodName;
- lineNumber = src.lineNumber;
- return * this;
+ fileName = src.fileName;
+ methodName = src.methodName;
+ lineNumber = src.lineNumber;
+ return * this;
}
/**
@@ -89,9 +89,9 @@
*/
void LocationInfo::clear()
{
- fileName = NA;
- methodName = NA_METHOD;
- lineNumber = -1;
+ fileName = NA;
+ methodName = NA_METHOD;
+ lineNumber = -1;
}
@@ -101,7 +101,7 @@
*/
const char* LocationInfo::getFileName() const
{
- return fileName;
+ return fileName;
}
/**
@@ -110,134 +110,134 @@
*/
int LocationInfo::getLineNumber() const
{
- return lineNumber;
+ return lineNumber;
}
/** Returns the method name of the caller. */
const std::string LocationInfo::getMethodName() const
{
- std::string tmp(methodName);
- size_t parenPos = tmp.find('(');
+ std::string tmp(methodName);
+ size_t parenPos = tmp.find('(');
- if (parenPos != std::string::npos)
- {
- tmp.erase(parenPos);
- }
+ if (parenPos != std::string::npos)
+ {
+ tmp.erase(parenPos);
+ }
- size_t colonPos = tmp.rfind("::");
+ size_t colonPos = tmp.rfind("::");
- if (colonPos != std::string::npos)
- {
- tmp.erase(0, colonPos + 2);
- }
- else
- {
- size_t spacePos = tmp.find(' ');
+ if (colonPos != std::string::npos)
+ {
+ tmp.erase(0, colonPos + 2);
+ }
+ else
+ {
+ size_t spacePos = tmp.find(' ');
- if (spacePos != std::string::npos)
- {
- tmp.erase(0, spacePos + 1);
- }
- }
+ if (spacePos != std::string::npos)
+ {
+ tmp.erase(0, spacePos + 1);
+ }
+ }
- return tmp;
+ return tmp;
}
const std::string LocationInfo::getClassName() const
{
- std::string tmp(methodName);
- size_t parenPos = tmp.find('(');
+ std::string tmp(methodName);
+ size_t parenPos = tmp.find('(');
- if (parenPos != std::string::npos)
- {
- tmp.erase(parenPos);
- }
+ if (parenPos != std::string::npos)
+ {
+ tmp.erase(parenPos);
+ }
- size_t colonPos = tmp.rfind("::");
+ size_t colonPos = tmp.rfind("::");
- if (colonPos != std::string::npos)
- {
- tmp.erase(colonPos);
- size_t spacePos = tmp.find_last_of(' ');
+ if (colonPos != std::string::npos)
+ {
+ tmp.erase(colonPos);
+ size_t spacePos = tmp.find_last_of(' ');
- if (spacePos != std::string::npos)
- {
- tmp.erase(0, spacePos + 1);
- }
+ if (spacePos != std::string::npos)
+ {
+ tmp.erase(0, spacePos + 1);
+ }
- return tmp;
- }
+ return tmp;
+ }
- tmp.erase(0, tmp.length() );
- return tmp;
+ tmp.erase(0, tmp.length() );
+ return tmp;
}
void LocationInfo::write(ObjectOutputStream& os, Pool& p) const
{
- if (lineNumber == -1 && fileName == NA && methodName == NA_METHOD)
- {
- os.writeNull(p);
- }
- else
- {
- unsigned char prolog[] =
- {
- 0x72,
- 0x00,
- 0x21, 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E,
- 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F,
- 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0xED, 0x99,
- 0xBB, 0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02,
- 0x00,
- 0x01, 0x4C,
- 0x00,
- 0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 0x6E, 0x66, 0x6F, 0x74,
- 0x00,
- 0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F,
- 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x78, 0x70
- };
- os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, (char*) prolog, sizeof(prolog), p);
- char* line = p.itoa(lineNumber);
- //
- // construct Java-like fullInfo (replace "::" with ".")
- //
- std::string fullInfo(methodName);
- size_t openParen = fullInfo.find('(');
+ if (lineNumber == -1 && fileName == NA && methodName == NA_METHOD)
+ {
+ os.writeNull(p);
+ }
+ else
+ {
+ unsigned char prolog[] =
+ {
+ 0x72,
+ 0x00,
+ 0x21, 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E,
+ 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F,
+ 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0xED, 0x99,
+ 0xBB, 0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02,
+ 0x00,
+ 0x01, 0x4C,
+ 0x00,
+ 0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 0x6E, 0x66, 0x6F, 0x74,
+ 0x00,
+ 0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F,
+ 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x78, 0x70
+ };
+ os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, (char*) prolog, sizeof(prolog), p);
+ char* line = p.itoa(lineNumber);
+ //
+ // construct Java-like fullInfo (replace "::" with ".")
+ //
+ std::string fullInfo(methodName);
+ size_t openParen = fullInfo.find('(');
- if (openParen != std::string::npos)
- {
- size_t space = fullInfo.find(' ');
+ if (openParen != std::string::npos)
+ {
+ size_t space = fullInfo.find(' ');
- if (space != std::string::npos && space < openParen)
- {
- fullInfo.erase(0, space + 1);
- }
- }
+ if (space != std::string::npos && space < openParen)
+ {
+ fullInfo.erase(0, space + 1);
+ }
+ }
- openParen = fullInfo.find('(');
+ openParen = fullInfo.find('(');
- if (openParen != std::string::npos)
- {
- size_t classSep = fullInfo.rfind("::", openParen);
+ if (openParen != std::string::npos)
+ {
+ size_t classSep = fullInfo.rfind("::", openParen);
- if (classSep != std::string::npos)
- {
- fullInfo.replace(classSep, 2, ".");
- }
- else
- {
- fullInfo.insert(0, ".");
- }
- }
+ if (classSep != std::string::npos)
+ {
+ fullInfo.replace(classSep, 2, ".");
+ }
+ else
+ {
+ fullInfo.insert(0, ".");
+ }
+ }
- fullInfo.append(1, '(');
- fullInfo.append(fileName);
- fullInfo.append(1, ':');
- fullInfo.append(line);
- fullInfo.append(1, ')');
- os.writeUTFString(fullInfo, p);
- }
+ fullInfo.append(1, '(');
+ fullInfo.append(fileName);
+ fullInfo.append(1, ':');
+ fullInfo.append(line);
+ fullInfo.append(1, ')');
+ os.writeUTFString(fullInfo, p);
+ }
}
diff --git a/src/main/cpp/logger.cpp b/src/main/cpp/logger.cpp
index e1a76a2..5738740 100644
--- a/src/main/cpp/logger.cpp
+++ b/src/main/cpp/logger.cpp
@@ -30,7 +30,7 @@
#include <log4cxx/helpers/appenderattachableimpl.h>
#include <log4cxx/helpers/exception.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <log4cxx/helpers/aprinitializer.h>
@@ -42,11 +42,11 @@
IMPLEMENT_LOG4CXX_OBJECT(Logger)
Logger::Logger(Pool& p, const LogString& name1)
- : pool(&p), name(), level(), parent(), resourceBundle(),
- repository(), aai(), SHARED_MUTEX_INIT(mutex, p)
+ : pool(&p), name(), level(), parent(), resourceBundle(),
+ repository(), aai(), SHARED_MUTEX_INIT(mutex, p)
{
- name = name1;
- additive = true;
+ name = name1;
+ additive = true;
}
Logger::~Logger()
@@ -55,291 +55,291 @@
void Logger::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void Logger::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void Logger::addAppender(const AppenderPtr& newAppender)
{
- log4cxx::spi::LoggerRepository* rep = 0;
- {
- LOCK_W sync(mutex);
+ log4cxx::spi::LoggerRepository* rep = 0;
+ {
+ LOCK_W sync(mutex);
- if (aai == 0)
- {
- aai = new AppenderAttachableImpl(*pool);
- }
+ if (aai == 0)
+ {
+ aai = new AppenderAttachableImpl(*pool);
+ }
- aai->addAppender(newAppender);
- rep = repository;
- }
+ aai->addAppender(newAppender);
+ rep = repository;
+ }
- if (rep != 0)
- {
- rep->fireAddAppenderEvent(this, newAppender);
- }
+ if (rep != 0)
+ {
+ rep->fireAddAppenderEvent(this, newAppender);
+ }
}
void Logger::callAppenders(const spi::LoggingEventPtr& event, Pool& p) const
{
- int writes = 0;
+ int writes = 0;
- for (LoggerPtr logger(const_cast<Logger*>(this));
- logger != 0;
- logger = logger->parent)
- {
- // Protected against simultaneous call to addAppender, removeAppender,...
- LOCK_R sync(logger->mutex);
+ for (LoggerPtr logger(const_cast<Logger*>(this));
+ logger != 0;
+ logger = logger->parent)
+ {
+ // Protected against simultaneous call to addAppender, removeAppender,...
+ LOCK_R sync(logger->mutex);
- if (logger->aai != 0)
- {
- writes += logger->aai->appendLoopOnAppenders(event, p);
- }
+ if (logger->aai != 0)
+ {
+ writes += logger->aai->appendLoopOnAppenders(event, p);
+ }
- if (!logger->additive)
- {
- break;
- }
- }
+ if (!logger->additive)
+ {
+ break;
+ }
+ }
- if (writes == 0 && repository != 0)
- {
- repository->emitNoAppenderWarning(const_cast<Logger*>(this));
- }
+ if (writes == 0 && repository != 0)
+ {
+ repository->emitNoAppenderWarning(const_cast<Logger*>(this));
+ }
}
void Logger::closeNestedAppenders()
{
- AppenderList appenders = getAllAppenders();
+ AppenderList appenders = getAllAppenders();
- for (AppenderList::iterator it = appenders.begin(); it != appenders.end(); ++it)
- {
- (*it)->close();
- }
+ for (AppenderList::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ {
+ (*it)->close();
+ }
}
void Logger::forcedLog(const LevelPtr& level1, const std::string& message,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- Pool p;
- LOG4CXX_DECODE_CHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_CHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
+ callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const std::string& message) const
{
- Pool p;
- LOG4CXX_DECODE_CHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg,
- LocationInfo::getLocationUnavailable()));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_CHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg,
+ LocationInfo::getLocationUnavailable()));
+ callAppenders(event, p);
}
void Logger::forcedLogLS(const LevelPtr& level1, const LogString& message,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- Pool p;
- LoggingEventPtr event(new LoggingEvent(name, level1, message, location));
- callAppenders(event, p);
+ Pool p;
+ LoggingEventPtr event(new LoggingEvent(name, level1, message, location));
+ callAppenders(event, p);
}
bool Logger::getAdditivity() const
{
- return additive;
+ return additive;
}
AppenderList Logger::getAllAppenders() const
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (aai == 0)
- {
- return AppenderList();
- }
- else
- {
- return aai->getAllAppenders();
- }
+ if (aai == 0)
+ {
+ return AppenderList();
+ }
+ else
+ {
+ return aai->getAllAppenders();
+ }
}
AppenderPtr Logger::getAppender(const LogString& name1) const
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (aai == 0 || name1.empty())
- {
- return 0;
- }
+ if (aai == 0 || name1.empty())
+ {
+ return 0;
+ }
- return aai->getAppender(name1);
+ return aai->getAppender(name1);
}
const LevelPtr& Logger::getEffectiveLevel() const
{
- for (const Logger* l = this; l != 0; l = l->parent)
- {
- if (l->level != 0)
- {
- return l->level;
- }
- }
+ for (const Logger* l = this; l != 0; l = l->parent)
+ {
+ if (l->level != 0)
+ {
+ return l->level;
+ }
+ }
- throw NullPointerException(LOG4CXX_STR("No level specified for logger or ancestors."));
+ throw NullPointerException(LOG4CXX_STR("No level specified for logger or ancestors."));
#if LOG4CXX_RETURN_AFTER_THROW
- return this->level;
+ return this->level;
#endif
}
LoggerRepositoryPtr Logger::getLoggerRepository() const
{
- return repository;
+ return repository;
}
ResourceBundlePtr Logger::getResourceBundle() const
{
- for (LoggerPtr l(const_cast<Logger*>(this)); l != 0; l = l->parent)
- {
- if (l->resourceBundle != 0)
- {
- return l->resourceBundle;
- }
- }
+ for (LoggerPtr l(const_cast<Logger*>(this)); l != 0; l = l->parent)
+ {
+ if (l->resourceBundle != 0)
+ {
+ return l->resourceBundle;
+ }
+ }
- // It might be the case that there is no resource bundle
- return 0;
+ // It might be the case that there is no resource bundle
+ return 0;
}
LogString Logger::getResourceBundleString(const LogString& key) const
{
- ResourceBundlePtr rb = getResourceBundle();
+ ResourceBundlePtr rb = getResourceBundle();
- // This is one of the rare cases where we can use logging in order
- // to report errors from within log4j.
- if (rb == 0)
- {
- return LogString();
- }
- else
- {
- try
- {
- return rb->getString(key);
- }
- catch (MissingResourceException&)
- {
- logLS(Level::getError(), LOG4CXX_STR("No resource is associated with key \"") +
- key + LOG4CXX_STR("\"."), LocationInfo::getLocationUnavailable());
+ // This is one of the rare cases where we can use logging in order
+ // to report errors from within log4j.
+ if (rb == 0)
+ {
+ return LogString();
+ }
+ else
+ {
+ try
+ {
+ return rb->getString(key);
+ }
+ catch (MissingResourceException&)
+ {
+ logLS(Level::getError(), LOG4CXX_STR("No resource is associated with key \"") +
+ key + LOG4CXX_STR("\"."), LocationInfo::getLocationUnavailable());
- return LogString();
- }
- }
+ return LogString();
+ }
+ }
}
LoggerPtr Logger::getParent() const
{
- return parent;
+ return parent;
}
LevelPtr Logger::getLevel() const
{
- return level;
+ return level;
}
bool Logger::isAttached(const AppenderPtr& appender) const
{
- LOCK_R sync(mutex);
+ LOCK_R sync(mutex);
- if (appender == 0 || aai == 0)
- {
- return false;
- }
- else
- {
- return aai->isAttached(appender);
- }
+ if (appender == 0 || aai == 0)
+ {
+ return false;
+ }
+ else
+ {
+ return aai->isAttached(appender);
+ }
}
bool Logger::isTraceEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::TRACE_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::TRACE_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::TRACE_INT;
+ return getEffectiveLevel()->toInt() <= Level::TRACE_INT;
}
bool Logger::isDebugEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::DEBUG_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::DEBUG_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::DEBUG_INT;
+ return getEffectiveLevel()->toInt() <= Level::DEBUG_INT;
}
bool Logger::isEnabledFor(const LevelPtr& level1) const
{
- if (repository == 0 || repository->isDisabled(level1->toInt()))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(level1->toInt()))
+ {
+ return false;
+ }
- return level1->isGreaterOrEqual(getEffectiveLevel());
+ return level1->isGreaterOrEqual(getEffectiveLevel());
}
bool Logger::isInfoEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::INFO_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::INFO_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::INFO_INT;
+ return getEffectiveLevel()->toInt() <= Level::INFO_INT;
}
bool Logger::isErrorEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::ERROR_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::ERROR_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::ERROR_INT;
+ return getEffectiveLevel()->toInt() <= Level::ERROR_INT;
}
bool Logger::isWarnEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::WARN_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::WARN_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::WARN_INT;
+ return getEffectiveLevel()->toInt() <= Level::WARN_INT;
}
bool Logger::isFatalEnabled() const
{
- if (repository == 0 || repository->isDisabled(Level::FATAL_INT))
- {
- return false;
- }
+ if (repository == 0 || repository->isDisabled(Level::FATAL_INT))
+ {
+ return false;
+ }
- return getEffectiveLevel()->toInt() <= Level::FATAL_INT;
+ return getEffectiveLevel()->toInt() <= Level::FATAL_INT;
}
/*void Logger::l7dlog(const LevelPtr& level, const String& key,
@@ -368,294 +368,294 @@
void Logger::l7dlog(const LevelPtr& level1, const LogString& key,
- const LocationInfo& location, const std::vector<LogString>& params) const
+ const LocationInfo& location, const std::vector<LogString>& params) const
{
- if (repository == 0 || repository->isDisabled(level1->toInt()))
- {
- return;
- }
+ if (repository == 0 || repository->isDisabled(level1->toInt()))
+ {
+ return;
+ }
- if (level1->isGreaterOrEqual(getEffectiveLevel()))
- {
- LogString pattern = getResourceBundleString(key);
- LogString msg;
+ if (level1->isGreaterOrEqual(getEffectiveLevel()))
+ {
+ LogString pattern = getResourceBundleString(key);
+ LogString msg;
- if (pattern.empty())
- {
- msg = key;
- }
- else
- {
- msg = StringHelper::format(pattern, params);
- }
+ if (pattern.empty())
+ {
+ msg = key;
+ }
+ else
+ {
+ msg = StringHelper::format(pattern, params);
+ }
- forcedLogLS(level1, msg, location);
- }
+ forcedLogLS(level1, msg, location);
+ }
}
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- LOG4CXX_DECODE_CHAR(lkey, key);
+ LOG4CXX_DECODE_CHAR(lkey, key);
- std::vector<LogString> values(0);
- l7dlog(level1, lkey, location, values);
+ std::vector<LogString> values(0);
+ l7dlog(level1, lkey, location, values);
}
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
- const LocationInfo& location, const std::string& val1) const
+ const LocationInfo& location, const std::string& val1) const
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LOG4CXX_DECODE_CHAR(lval1, val1);
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LOG4CXX_DECODE_CHAR(lval1, val1);
- std::vector<LogString> values(1);
- values[0] = lval1;
- l7dlog(level1, lkey, location, values);
+ std::vector<LogString> values(1);
+ values[0] = lval1;
+ l7dlog(level1, lkey, location, values);
}
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
- const LocationInfo& location,
- const std::string& val1, const std::string& val2) const
+ const LocationInfo& location,
+ const std::string& val1, const std::string& val2) const
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LOG4CXX_DECODE_CHAR(lval1, val1);
- LOG4CXX_DECODE_CHAR(lval2, val2);
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LOG4CXX_DECODE_CHAR(lval1, val1);
+ LOG4CXX_DECODE_CHAR(lval2, val2);
- std::vector<LogString> values(2);
- values[0] = lval1;
- values[1] = lval2;
- l7dlog(level1, lkey, location, values);
+ std::vector<LogString> values(2);
+ values[0] = lval1;
+ values[1] = lval2;
+ l7dlog(level1, lkey, location, values);
}
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
- const LocationInfo& location,
- const std::string& val1, const std::string& val2, const std::string& val3) const
+ const LocationInfo& location,
+ const std::string& val1, const std::string& val2, const std::string& val3) const
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LOG4CXX_DECODE_CHAR(lval1, val1);
- LOG4CXX_DECODE_CHAR(lval2, val2);
- LOG4CXX_DECODE_CHAR(lval3, val3);
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LOG4CXX_DECODE_CHAR(lval1, val1);
+ LOG4CXX_DECODE_CHAR(lval2, val2);
+ LOG4CXX_DECODE_CHAR(lval3, val3);
- std::vector<LogString> values(3);
- values[0] = lval1;
- values[1] = lval2;
- values[2] = lval3;
- l7dlog(level1, lkey, location, values);
+ std::vector<LogString> values(3);
+ values[0] = lval1;
+ values[1] = lval2;
+ values[2] = lval3;
+ l7dlog(level1, lkey, location, values);
}
void Logger::removeAllAppenders()
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (aai != 0)
- {
- aai->removeAllAppenders();
- aai = 0;
- }
+ if (aai != 0)
+ {
+ aai->removeAllAppenders();
+ aai = 0;
+ }
}
void Logger::removeAppender(const AppenderPtr& appender)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (appender == 0 || aai == 0)
- {
- return;
- }
+ if (appender == 0 || aai == 0)
+ {
+ return;
+ }
- aai->removeAppender(appender);
+ aai->removeAppender(appender);
}
void Logger::removeAppender(const LogString& name1)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (name1.empty() || aai == 0)
- {
- return;
- }
+ if (name1.empty() || aai == 0)
+ {
+ return;
+ }
- aai->removeAppender(name1);
+ aai->removeAppender(name1);
}
void Logger::setAdditivity(bool additive1)
{
- LOCK_W sync(mutex);
- this->additive = additive1;
+ LOCK_W sync(mutex);
+ this->additive = additive1;
}
void Logger::setHierarchy(spi::LoggerRepository* repository1)
{
- this->repository = repository1;
+ this->repository = repository1;
}
void Logger::setLevel(const LevelPtr& level1)
{
- this->level = level1;
+ this->level = level1;
}
LoggerPtr Logger::getLogger(const std::string& name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
LoggerPtr Logger::getLogger(const char* const name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
LoggerPtr Logger::getRootLogger()
{
- return LogManager::getRootLogger();
+ return LogManager::getRootLogger();
}
LoggerPtr Logger::getLoggerLS(const LogString& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- return LogManager::getLoggerLS(name, factory);
+ return LogManager::getLoggerLS(name, factory);
}
void Logger::getName(std::string& rv) const
{
- Transcoder::encode(name, rv);
+ Transcoder::encode(name, rv);
}
void Logger::trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg, location);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg, location);
+ }
}
void Logger::trace(const std::string& msg) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg);
+ }
}
void Logger::debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg, location);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg, location);
+ }
}
void Logger::debug(const std::string& msg) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg);
+ }
}
void Logger::error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg, location);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg, location);
+ }
}
void Logger::error(const std::string& msg) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg);
+ }
}
void Logger::fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg, location);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg, location);
+ }
}
void Logger::fatal(const std::string& msg) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg);
+ }
}
void Logger::info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg, location);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg, location);
+ }
}
void Logger::info(const std::string& msg) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg);
+ }
}
void Logger::log(const LevelPtr& level1, const std::string& message,
- const log4cxx::spi::LocationInfo& location) const
+ const log4cxx::spi::LocationInfo& location) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message, location);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message, location);
+ }
}
void Logger::log(const LevelPtr& level1, const std::string& message) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message);
+ }
}
void Logger::logLS(const LevelPtr& level1, const LogString& message,
- const log4cxx::spi::LocationInfo& location) const
+ const log4cxx::spi::LocationInfo& location) const
{
- if (isEnabledFor(level1))
- {
- forcedLogLS(level1, message, location);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLogLS(level1, message, location);
+ }
}
void Logger::warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg, location);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg, location);
+ }
}
void Logger::warn(const std::string& msg) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg);
+ }
}
LoggerPtr Logger::getLoggerLS(const LogString& name)
{
- return LogManager::getLoggerLS(name);
+ return LogManager::getLoggerLS(name);
}
@@ -663,150 +663,150 @@
#if LOG4CXX_WCHAR_T_API
void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- Pool p;
- LOG4CXX_DECODE_WCHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_WCHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
+ callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message) const
{
- Pool p;
- LOG4CXX_DECODE_WCHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg,
- LocationInfo::getLocationUnavailable()));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_WCHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg,
+ LocationInfo::getLocationUnavailable()));
+ callAppenders(event, p);
}
void Logger::getName(std::wstring& rv) const
{
- Transcoder::encode(name, rv);
+ Transcoder::encode(name, rv);
}
LoggerPtr Logger::getLogger(const std::wstring& name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
LoggerPtr Logger::getLogger(const wchar_t* const name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
void Logger::trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg, location);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg, location);
+ }
}
void Logger::trace(const std::wstring& msg) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg);
+ }
}
void Logger::debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg, location);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg, location);
+ }
}
void Logger::debug(const std::wstring& msg) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg);
+ }
}
void Logger::error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg, location);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg, location);
+ }
}
void Logger::error(const std::wstring& msg) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg);
+ }
}
void Logger::fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg, location);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg, location);
+ }
}
void Logger::fatal(const std::wstring& msg) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg);
+ }
}
void Logger::info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg, location);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg, location);
+ }
}
void Logger::info(const std::wstring& msg) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg);
+ }
}
void Logger::log(const LevelPtr& level1, const std::wstring& message,
- const log4cxx::spi::LocationInfo& location) const
+ const log4cxx::spi::LocationInfo& location) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message, location);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message, location);
+ }
}
void Logger::log(const LevelPtr& level1, const std::wstring& message) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message);
+ }
}
void Logger::warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg, location);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg, location);
+ }
}
void Logger::warn(const std::wstring& msg) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg);
+ }
}
#endif
@@ -814,147 +814,147 @@
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- Pool p;
- LOG4CXX_DECODE_UNICHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_UNICHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
+ callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message) const
{
- Pool p;
- LOG4CXX_DECODE_UNICHAR(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg,
- LocationInfo::getLocationUnavailable()));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_UNICHAR(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg,
+ LocationInfo::getLocationUnavailable()));
+ callAppenders(event, p);
}
#endif
#if LOG4CXX_UNICHAR_API
void Logger::getName(std::basic_string<UniChar>& rv) const
{
- Transcoder::encode(name, rv);
+ Transcoder::encode(name, rv);
}
LoggerPtr Logger::getLogger(const std::basic_string<UniChar>& name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
void Logger::trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg, location);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg, location);
+ }
}
void Logger::trace(const std::basic_string<UniChar>& msg) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg);
+ }
}
void Logger::debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg, location);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg, location);
+ }
}
void Logger::debug(const std::basic_string<UniChar>& msg) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg);
+ }
}
void Logger::error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg, location);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg, location);
+ }
}
void Logger::error(const std::basic_string<UniChar>& msg) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg);
+ }
}
void Logger::fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg, location);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg, location);
+ }
}
void Logger::fatal(const std::basic_string<UniChar>& msg) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg);
+ }
}
void Logger::info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg, location);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg, location);
+ }
}
void Logger::info(const std::basic_string<UniChar>& msg) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg);
+ }
}
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message,
- const log4cxx::spi::LocationInfo& location) const
+ const log4cxx::spi::LocationInfo& location) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message, location);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message, location);
+ }
}
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message);
+ }
}
void Logger::warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg, location);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg, location);
+ }
}
void Logger::warn(const std::basic_string<UniChar>& msg) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg);
+ }
}
#endif
@@ -962,145 +962,145 @@
#if LOG4CXX_CFSTRING_API
void Logger::forcedLog(const LevelPtr& level1, const CFStringRef& message,
- const LocationInfo& location) const
+ const LocationInfo& location) const
{
- Pool p;
- LOG4CXX_DECODE_CFSTRING(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_CFSTRING(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
+ callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const CFStringRef& message) const
{
- Pool p;
- LOG4CXX_DECODE_CFSTRING(msg, message);
- LoggingEventPtr event(new LoggingEvent(name, level1, msg,
- LocationInfo::getLocationUnavailable()));
- callAppenders(event, p);
+ Pool p;
+ LOG4CXX_DECODE_CFSTRING(msg, message);
+ LoggingEventPtr event(new LoggingEvent(name, level1, msg,
+ LocationInfo::getLocationUnavailable()));
+ callAppenders(event, p);
}
void Logger::getName(CFStringRef& rv) const
{
- rv = Transcoder::encode(name);
+ rv = Transcoder::encode(name);
}
LoggerPtr Logger::getLogger(const CFStringRef& name)
{
- return LogManager::getLogger(name);
+ return LogManager::getLogger(name);
}
void Logger::trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg, location);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg, location);
+ }
}
void Logger::trace(const CFStringRef& msg) const
{
- if (isTraceEnabled())
- {
- forcedLog(log4cxx::Level::getTrace(), msg);
- }
+ if (isTraceEnabled())
+ {
+ forcedLog(log4cxx::Level::getTrace(), msg);
+ }
}
void Logger::debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg, location);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg, location);
+ }
}
void Logger::debug(const CFStringRef& msg) const
{
- if (isDebugEnabled())
- {
- forcedLog(log4cxx::Level::getDebug(), msg);
- }
+ if (isDebugEnabled())
+ {
+ forcedLog(log4cxx::Level::getDebug(), msg);
+ }
}
void Logger::error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg, location);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg, location);
+ }
}
void Logger::error(const CFStringRef& msg) const
{
- if (isErrorEnabled())
- {
- forcedLog(log4cxx::Level::getError(), msg);
- }
+ if (isErrorEnabled())
+ {
+ forcedLog(log4cxx::Level::getError(), msg);
+ }
}
void Logger::fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg, location);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg, location);
+ }
}
void Logger::fatal(const CFStringRef& msg) const
{
- if (isFatalEnabled())
- {
- forcedLog(log4cxx::Level::getFatal(), msg);
- }
+ if (isFatalEnabled())
+ {
+ forcedLog(log4cxx::Level::getFatal(), msg);
+ }
}
void Logger::info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg, location);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg, location);
+ }
}
void Logger::info(const CFStringRef& msg) const
{
- if (isInfoEnabled())
- {
- forcedLog(log4cxx::Level::getInfo(), msg);
- }
+ if (isInfoEnabled())
+ {
+ forcedLog(log4cxx::Level::getInfo(), msg);
+ }
}
void Logger::log(const LevelPtr& level1, const CFStringRef& message,
- const log4cxx::spi::LocationInfo& location) const
+ const log4cxx::spi::LocationInfo& location) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message, location);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message, location);
+ }
}
void Logger::log(const LevelPtr& level1, const CFStringRef& message) const
{
- if (isEnabledFor(level1))
- {
- forcedLog(level1, message);
- }
+ if (isEnabledFor(level1))
+ {
+ forcedLog(level1, message);
+ }
}
void Logger::warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg, location);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg, location);
+ }
}
void Logger::warn(const CFStringRef& msg) const
{
- if (isWarnEnabled())
- {
- forcedLog(log4cxx::Level::getWarn(), msg);
- }
+ if (isWarnEnabled())
+ {
+ forcedLog(log4cxx::Level::getWarn(), msg);
+ }
}
#endif
diff --git a/src/main/cpp/loggermatchfilter.cpp b/src/main/cpp/loggermatchfilter.cpp
index 3b7957b..17a659b 100644
--- a/src/main/cpp/loggermatchfilter.cpp
+++ b/src/main/cpp/loggermatchfilter.cpp
@@ -30,55 +30,55 @@
LoggerMatchFilter::LoggerMatchFilter()
- : acceptOnMatch(true), loggerToMatch(LOG4CXX_STR("root"))
+ : acceptOnMatch(true), loggerToMatch(LOG4CXX_STR("root"))
{
}
void LoggerMatchFilter::setLoggerToMatch(const LogString& value)
{
- loggerToMatch = value;
+ loggerToMatch = value;
}
LogString LoggerMatchFilter::getLoggerToMatch() const
{
- return loggerToMatch;
+ return loggerToMatch;
}
void LoggerMatchFilter::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("LOGGERTOMATCH"), LOG4CXX_STR("loggertomatch")))
- {
- setLoggerToMatch(value);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
- {
- acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("LOGGERTOMATCH"), LOG4CXX_STR("loggertomatch")))
+ {
+ setLoggerToMatch(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
+ {
+ acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
+ }
}
Filter::FilterDecision LoggerMatchFilter::decide(
- const spi::LoggingEventPtr& event) const
+ const spi::LoggingEventPtr& event) const
{
- bool matchOccured = loggerToMatch == event->getLoggerName();
+ bool matchOccured = loggerToMatch == event->getLoggerName();
- if (matchOccured)
- {
- if (acceptOnMatch)
- {
- return Filter::ACCEPT;
- }
- else
- {
- return Filter::DENY;
- }
- }
- else
- {
- return Filter::NEUTRAL;
- }
+ if (matchOccured)
+ {
+ if (acceptOnMatch)
+ {
+ return Filter::ACCEPT;
+ }
+ else
+ {
+ return Filter::DENY;
+ }
+ }
+ else
+ {
+ return Filter::NEUTRAL;
+ }
}
diff --git a/src/main/cpp/loggerpatternconverter.cpp b/src/main/cpp/loggerpatternconverter.cpp
index bea407b..c5b38de 100644
--- a/src/main/cpp/loggerpatternconverter.cpp
+++ b/src/main/cpp/loggerpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -31,30 +31,30 @@
IMPLEMENT_LOG4CXX_OBJECT(LoggerPatternConverter)
LoggerPatternConverter::LoggerPatternConverter(
- const std::vector<LogString>& options) :
- NamePatternConverter(LOG4CXX_STR("Logger"),
- LOG4CXX_STR("logger"), options)
+ const std::vector<LogString>& options) :
+ NamePatternConverter(LOG4CXX_STR("Logger"),
+ LOG4CXX_STR("logger"), options)
{
}
PatternConverterPtr LoggerPatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() == 0)
- {
- static PatternConverterPtr def(new LoggerPatternConverter(options));
- return def;
- }
+ if (options.size() == 0)
+ {
+ static PatternConverterPtr def(new LoggerPatternConverter(options));
+ return def;
+ }
- return new LoggerPatternConverter(options);
+ return new LoggerPatternConverter(options);
}
void LoggerPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */ ) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */ ) const
{
- int initialLength = toAppendTo.length();
- toAppendTo.append(event->getLoggerName());
- abbreviate(initialLength, toAppendTo);
+ int initialLength = toAppendTo.length();
+ toAppendTo.append(event->getLoggerName());
+ abbreviate(initialLength, toAppendTo);
}
diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
index f3ccc41..58d24f2 100644
--- a/src/main/cpp/loggingevent.cpp
+++ b/src/main/cpp/loggingevent.cpp
@@ -23,7 +23,7 @@
#include <log4cxx/helpers/system.h>
#include <log4cxx/helpers/socket.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
#include <log4cxx/helpers/threadspecificdata.h>
@@ -50,172 +50,172 @@
//
log4cxx_time_t LoggingEvent::getStartTime()
{
- return log4cxx::helpers::APRInitializer::initialize();
+ return log4cxx::helpers::APRInitializer::initialize();
}
LoggingEvent::LoggingEvent() :
- ndc(0),
- mdcCopy(0),
- properties(0),
- ndcLookupRequired(true),
- mdcCopyLookupRequired(true),
- timeStamp(0),
- locationInfo()
+ ndc(0),
+ mdcCopy(0),
+ properties(0),
+ ndcLookupRequired(true),
+ mdcCopyLookupRequired(true),
+ timeStamp(0),
+ locationInfo()
{
}
LoggingEvent::LoggingEvent(
- const LogString& logger1, const LevelPtr& level1,
- const LogString& message1, const LocationInfo& locationInfo1) :
- logger(logger1),
- level(level1),
- ndc(0),
- mdcCopy(0),
- properties(0),
- ndcLookupRequired(true),
- mdcCopyLookupRequired(true),
- message(message1),
- timeStamp(apr_time_now()),
- locationInfo(locationInfo1),
- threadName(getCurrentThreadName())
+ const LogString& logger1, const LevelPtr& level1,
+ const LogString& message1, const LocationInfo& locationInfo1) :
+ logger(logger1),
+ level(level1),
+ ndc(0),
+ mdcCopy(0),
+ properties(0),
+ ndcLookupRequired(true),
+ mdcCopyLookupRequired(true),
+ message(message1),
+ timeStamp(apr_time_now()),
+ locationInfo(locationInfo1),
+ threadName(getCurrentThreadName())
{
}
LoggingEvent::~LoggingEvent()
{
- delete ndc;
- delete mdcCopy;
- delete properties;
+ delete ndc;
+ delete mdcCopy;
+ delete properties;
}
bool LoggingEvent::getNDC(LogString& dest) const
{
- if (ndcLookupRequired)
- {
- ndcLookupRequired = false;
- LogString val;
+ if (ndcLookupRequired)
+ {
+ ndcLookupRequired = false;
+ LogString val;
- if (NDC::get(val))
- {
- ndc = new LogString(val);
- }
- }
+ if (NDC::get(val))
+ {
+ ndc = new LogString(val);
+ }
+ }
- if (ndc)
- {
- dest.append(*ndc);
- return true;
- }
+ if (ndc)
+ {
+ dest.append(*ndc);
+ return true;
+ }
- return false;
+ return false;
}
bool LoggingEvent::getMDC(const LogString& key, LogString& dest) const
{
- // Note the mdcCopy is used if it exists. Otherwise we use the MDC
- // that is associated with the thread.
- if (mdcCopy != 0 && !mdcCopy->empty())
- {
- MDC::Map::const_iterator it = mdcCopy->find(key);
+ // Note the mdcCopy is used if it exists. Otherwise we use the MDC
+ // that is associated with the thread.
+ if (mdcCopy != 0 && !mdcCopy->empty())
+ {
+ MDC::Map::const_iterator it = mdcCopy->find(key);
- if (it != mdcCopy->end())
- {
- if (!it->second.empty())
- {
- dest.append(it->second);
- return true;
- }
- }
- }
+ if (it != mdcCopy->end())
+ {
+ if (!it->second.empty())
+ {
+ dest.append(it->second);
+ return true;
+ }
+ }
+ }
- return MDC::get(key, dest);
+ return MDC::get(key, dest);
}
LoggingEvent::KeySet LoggingEvent::getMDCKeySet() const
{
- LoggingEvent::KeySet set;
+ LoggingEvent::KeySet set;
- if (mdcCopy != 0 && !mdcCopy->empty())
- {
- MDC::Map::const_iterator it;
+ if (mdcCopy != 0 && !mdcCopy->empty())
+ {
+ MDC::Map::const_iterator it;
- for (it = mdcCopy->begin(); it != mdcCopy->end(); it++)
- {
- set.push_back(it->first);
+ for (it = mdcCopy->begin(); it != mdcCopy->end(); it++)
+ {
+ set.push_back(it->first);
- }
- }
- else
- {
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ }
+ }
+ else
+ {
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- MDC::Map& m = data->getMap();
+ if (data != 0)
+ {
+ MDC::Map& m = data->getMap();
- for (MDC::Map::const_iterator it = m.begin(); it != m.end(); it++)
- {
- set.push_back(it->first);
- }
- }
- }
+ for (MDC::Map::const_iterator it = m.begin(); it != m.end(); it++)
+ {
+ set.push_back(it->first);
+ }
+ }
+ }
- return set;
+ return set;
}
void LoggingEvent::getMDCCopy() const
{
- if (mdcCopyLookupRequired)
- {
- mdcCopyLookupRequired = false;
- // the clone call is required for asynchronous logging.
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ if (mdcCopyLookupRequired)
+ {
+ mdcCopyLookupRequired = false;
+ // the clone call is required for asynchronous logging.
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- mdcCopy = new MDC::Map(data->getMap());
- }
- else
- {
- mdcCopy = new MDC::Map();
- }
- }
+ if (data != 0)
+ {
+ mdcCopy = new MDC::Map(data->getMap());
+ }
+ else
+ {
+ mdcCopy = new MDC::Map();
+ }
+ }
}
bool LoggingEvent::getProperty(const LogString& key, LogString& dest) const
{
- if (properties == 0)
- {
- return false;
- }
+ if (properties == 0)
+ {
+ return false;
+ }
- std::map<LogString, LogString>::const_iterator it = properties->find(key);
+ std::map<LogString, LogString>::const_iterator it = properties->find(key);
- if (it != properties->end())
- {
- dest.append(it->second);
- return true;
- }
+ if (it != properties->end())
+ {
+ dest.append(it->second);
+ return true;
+ }
- return false;
+ return false;
}
LoggingEvent::KeySet LoggingEvent::getPropertyKeySet() const
{
- LoggingEvent::KeySet set;
+ LoggingEvent::KeySet set;
- if (properties != 0)
- {
- std::map<LogString, LogString>::const_iterator it;
+ if (properties != 0)
+ {
+ std::map<LogString, LogString>::const_iterator it;
- for (it = properties->begin(); it != properties->end(); it++)
- {
- set.push_back(it->first);
- }
- }
+ for (it = properties->begin(); it != properties->end(); it++)
+ {
+ set.push_back(it->first);
+ }
+ }
- return set;
+ return set;
}
@@ -223,135 +223,135 @@
{
#if APR_HAS_THREADS
#if defined(_WIN32)
- char result[20];
- DWORD threadId = GetCurrentThreadId();
- apr_snprintf(result, sizeof(result), LOG4CXX_WIN32_THREAD_FMTSPEC, threadId);
+ char result[20];
+ DWORD threadId = GetCurrentThreadId();
+ apr_snprintf(result, sizeof(result), LOG4CXX_WIN32_THREAD_FMTSPEC, threadId);
#else
- // apr_os_thread_t encoded in HEX takes needs as many characters
- // as two times the size of the type, plus an additional null byte.
- char result[sizeof(apr_os_thread_t) * 3 + 10];
- apr_os_thread_t threadId = apr_os_thread_current();
- apr_snprintf(result, sizeof(result), LOG4CXX_APR_THREAD_FMTSPEC, (void*) &threadId);
+ // apr_os_thread_t encoded in HEX takes needs as many characters
+ // as two times the size of the type, plus an additional null byte.
+ char result[sizeof(apr_os_thread_t) * 3 + 10];
+ apr_os_thread_t threadId = apr_os_thread_current();
+ apr_snprintf(result, sizeof(result), LOG4CXX_APR_THREAD_FMTSPEC, (void*) &threadId);
#endif
- LOG4CXX_DECODE_CHAR(str, (const char*) result);
- return str;
+ LOG4CXX_DECODE_CHAR(str, (const char*) result);
+ return str;
#else
- return LOG4CXX_STR("0x00000000");
+ return LOG4CXX_STR("0x00000000");
#endif
}
void LoggingEvent::setProperty(const LogString& key, const LogString& value)
{
- if (properties == 0)
- {
- properties = new std::map<LogString, LogString>;
- }
+ if (properties == 0)
+ {
+ properties = new std::map<LogString, LogString>;
+ }
- (*properties)[key] = value;
+ (*properties)[key] = value;
}
void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)
{
- unsigned char classDesc[] =
- {
- 0x72, 0x00, 0x21,
- 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
- 0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
- 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67,
- 0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E,
- 0x74, 0xF3, 0xF2, 0xB9, 0x23, 0x74, 0x0B, 0xB5,
- 0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D,
- 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F,
- 0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75,
- 0x69, 0x72, 0x65, 0x64, 0x5A, 0x00, 0x11, 0x6E,
- 0x64, 0x63, 0x4C, 0x6F, 0x6F, 0x6B, 0x75, 0x70,
- 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64,
- 0x4A, 0x00, 0x09, 0x74, 0x69, 0x6D, 0x65, 0x53,
- 0x74, 0x61, 0x6D, 0x70, 0x4C, 0x00, 0x0C, 0x63,
- 0x61, 0x74, 0x65, 0x67, 0x6F, 0x72, 0x79, 0x4E,
- 0x61, 0x6D, 0x65, 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
- 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0C, 0x6C, 0x6F, 0x63, 0x61, 0x74,
- 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0x74,
- 0x00, 0x23, 0x4C, 0x6F, 0x72, 0x67, 0x2F, 0x61,
- 0x70, 0x61, 0x63, 0x68, 0x65, 0x2F, 0x6C, 0x6F,
- 0x67, 0x34, 0x6A, 0x2F, 0x73, 0x70, 0x69, 0x2F,
- 0x4C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
- 0x49, 0x6E, 0x66, 0x6F, 0x3B, 0x4C, 0x00, 0x07,
- 0x6D, 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x74,
- 0x00, 0x15, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F,
- 0x75, 0x74, 0x69, 0x6C, 0x2F, 0x48, 0x61, 0x73,
- 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x3B, 0x4C,
- 0x00, 0x03, 0x6E, 0x64, 0x63,
- 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
- 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0F, 0x72, 0x65, 0x6E,
- 0x64, 0x65, 0x72, 0x65, 0x64, 0x4D, 0x65, 0x73,
- 0x73, 0x61, 0x67, 0x65,
- 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
- 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0A, 0x74, 0x68, 0x72, 0x65,
- 0x61, 0x64, 0x4E, 0x61, 0x6D, 0x65,
- 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
- 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0D, 0x74, 0x68,
- 0x72, 0x6F, 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49,
- 0x6E, 0x66, 0x6F, 0x74, 0x00, 0x2B, 0x4C, 0x6F,
- 0x72, 0x67, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68,
- 0x65, 0x2F, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2F,
- 0x73, 0x70, 0x69, 0x2F, 0x54, 0x68, 0x72, 0x6F,
- 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49, 0x6E, 0x66,
- 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E,
- 0x3B, 0x78, 0x70
- };
+ unsigned char classDesc[] =
+ {
+ 0x72, 0x00, 0x21,
+ 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
+ 0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
+ 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67,
+ 0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E,
+ 0x74, 0xF3, 0xF2, 0xB9, 0x23, 0x74, 0x0B, 0xB5,
+ 0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D,
+ 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F,
+ 0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75,
+ 0x69, 0x72, 0x65, 0x64, 0x5A, 0x00, 0x11, 0x6E,
+ 0x64, 0x63, 0x4C, 0x6F, 0x6F, 0x6B, 0x75, 0x70,
+ 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64,
+ 0x4A, 0x00, 0x09, 0x74, 0x69, 0x6D, 0x65, 0x53,
+ 0x74, 0x61, 0x6D, 0x70, 0x4C, 0x00, 0x0C, 0x63,
+ 0x61, 0x74, 0x65, 0x67, 0x6F, 0x72, 0x79, 0x4E,
+ 0x61, 0x6D, 0x65, 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+ 0x4C, 0x00, 0x0C, 0x6C, 0x6F, 0x63, 0x61, 0x74,
+ 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0x74,
+ 0x00, 0x23, 0x4C, 0x6F, 0x72, 0x67, 0x2F, 0x61,
+ 0x70, 0x61, 0x63, 0x68, 0x65, 0x2F, 0x6C, 0x6F,
+ 0x67, 0x34, 0x6A, 0x2F, 0x73, 0x70, 0x69, 0x2F,
+ 0x4C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
+ 0x49, 0x6E, 0x66, 0x6F, 0x3B, 0x4C, 0x00, 0x07,
+ 0x6D, 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x74,
+ 0x00, 0x15, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F,
+ 0x75, 0x74, 0x69, 0x6C, 0x2F, 0x48, 0x61, 0x73,
+ 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x3B, 0x4C,
+ 0x00, 0x03, 0x6E, 0x64, 0x63,
+ 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+ 0x4C, 0x00, 0x0F, 0x72, 0x65, 0x6E,
+ 0x64, 0x65, 0x72, 0x65, 0x64, 0x4D, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65,
+ 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+ 0x4C, 0x00, 0x0A, 0x74, 0x68, 0x72, 0x65,
+ 0x61, 0x64, 0x4E, 0x61, 0x6D, 0x65,
+ 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+ 0x4C, 0x00, 0x0D, 0x74, 0x68,
+ 0x72, 0x6F, 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49,
+ 0x6E, 0x66, 0x6F, 0x74, 0x00, 0x2B, 0x4C, 0x6F,
+ 0x72, 0x67, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68,
+ 0x65, 0x2F, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2F,
+ 0x73, 0x70, 0x69, 0x2F, 0x54, 0x68, 0x72, 0x6F,
+ 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49, 0x6E, 0x66,
+ 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E,
+ 0x3B, 0x78, 0x70
+ };
- os.writeProlog("org.apache.log4j.spi.LoggingEvent",
- 8, (char*) classDesc, sizeof(classDesc), p);
+ os.writeProlog("org.apache.log4j.spi.LoggingEvent",
+ 8, (char*) classDesc, sizeof(classDesc), p);
}
void LoggingEvent::write(helpers::ObjectOutputStream& os, Pool& p) const
{
- writeProlog(os, p);
- // mdc and ndc lookup required should always be false
- char lookupsRequired[] = { 0, 0 };
- os.writeBytes(lookupsRequired, sizeof(lookupsRequired), p);
- os.writeLong(timeStamp / 1000, p);
- os.writeObject(logger, p);
- locationInfo.write(os, p);
+ writeProlog(os, p);
+ // mdc and ndc lookup required should always be false
+ char lookupsRequired[] = { 0, 0 };
+ os.writeBytes(lookupsRequired, sizeof(lookupsRequired), p);
+ os.writeLong(timeStamp / 1000, p);
+ os.writeObject(logger, p);
+ locationInfo.write(os, p);
- if (mdcCopy == 0 || mdcCopy->size() == 0)
- {
- os.writeNull(p);
- }
- else
- {
- os.writeObject(*mdcCopy, p);
- }
+ if (mdcCopy == 0 || mdcCopy->size() == 0)
+ {
+ os.writeNull(p);
+ }
+ else
+ {
+ os.writeObject(*mdcCopy, p);
+ }
- if (ndc == 0)
- {
- os.writeNull(p);
- }
- else
- {
- os.writeObject(*ndc, p);
- }
+ if (ndc == 0)
+ {
+ os.writeNull(p);
+ }
+ else
+ {
+ os.writeObject(*ndc, p);
+ }
- os.writeObject(message, p);
- os.writeObject(threadName, p);
- // throwable
- os.writeNull(p);
- os.writeByte(ObjectOutputStream::TC_BLOCKDATA, p);
- os.writeByte(0x04, p);
- os.writeInt(level->toInt(), p);
- os.writeNull(p);
- os.writeByte(ObjectOutputStream::TC_ENDBLOCKDATA, p);
+ os.writeObject(message, p);
+ os.writeObject(threadName, p);
+ // throwable
+ os.writeNull(p);
+ os.writeByte(ObjectOutputStream::TC_BLOCKDATA, p);
+ os.writeByte(0x04, p);
+ os.writeInt(level->toInt(), p);
+ os.writeNull(p);
+ os.writeByte(ObjectOutputStream::TC_ENDBLOCKDATA, p);
}
diff --git a/src/main/cpp/loggingeventpatternconverter.cpp b/src/main/cpp/loggingeventpatternconverter.cpp
index c3ee7f1..60ab32b 100644
--- a/src/main/cpp/loggingeventpatternconverter.cpp
+++ b/src/main/cpp/loggingeventpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -32,23 +32,23 @@
LoggingEventPatternConverter::LoggingEventPatternConverter(
- const LogString& name1, const LogString& style1) : PatternConverter(name1, style1)
+ const LogString& name1, const LogString& style1) : PatternConverter(name1, style1)
{
}
void LoggingEventPatternConverter::format(const ObjectPtr& obj,
- LogString& output,
- log4cxx::helpers::Pool& p) const
+ LogString& output,
+ log4cxx::helpers::Pool& p) const
{
- LoggingEventPtr le(obj);
+ LoggingEventPtr le(obj);
- if (le != NULL)
- {
- format(le, output, p);
- }
+ if (le != NULL)
+ {
+ format(le, output, p);
+ }
}
bool LoggingEventPatternConverter::handlesThrowable() const
{
- return false;
+ return false;
}
diff --git a/src/main/cpp/loglog.cpp b/src/main/cpp/loglog.cpp
index c811bad..faf21ef 100644
--- a/src/main/cpp/loglog.cpp
+++ b/src/main/cpp/loglog.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <iostream>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <log4cxx/helpers/synchronized.h>
@@ -32,113 +32,113 @@
LogLog::LogLog() : mutex(APRInitializer::getRootPool())
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- debugEnabled = false;
- quietMode = false;
+ debugEnabled = false;
+ quietMode = false;
}
LogLog& LogLog::getInstance()
{
- static LogLog internalLogger;
+ static LogLog internalLogger;
- return internalLogger;
+ return internalLogger;
}
void LogLog::setInternalDebugging(bool debugEnabled1)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- getInstance().debugEnabled = debugEnabled1;
+ getInstance().debugEnabled = debugEnabled1;
}
void LogLog::debug(const LogString& msg)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- if (getInstance().debugEnabled && !getInstance().quietMode)
- {
- emit(msg);
- }
+ if (getInstance().debugEnabled && !getInstance().quietMode)
+ {
+ emit(msg);
+ }
}
void LogLog::debug(const LogString& msg, const std::exception& e)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- debug(msg);
- emit(e);
+ debug(msg);
+ emit(e);
}
void LogLog::error(const LogString& msg)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- if (!getInstance().quietMode)
- {
- emit(msg);
- }
+ if (!getInstance().quietMode)
+ {
+ emit(msg);
+ }
}
void LogLog::error(const LogString& msg, const std::exception& e)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- error(msg);
- emit(e);
+ error(msg);
+ emit(e);
}
void LogLog::setQuietMode(bool quietMode1)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- getInstance().quietMode = quietMode1;
+ getInstance().quietMode = quietMode1;
}
void LogLog::warn(const LogString& msg)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- if (!getInstance().quietMode)
- {
- emit(msg);
- }
+ if (!getInstance().quietMode)
+ {
+ emit(msg);
+ }
}
void LogLog::warn(const LogString& msg, const std::exception& e)
{
- synchronized sync(getInstance().mutex);
+ synchronized sync(getInstance().mutex);
- warn(msg);
- emit(e);
+ warn(msg);
+ emit(e);
}
void LogLog::emit(const LogString& msg)
{
- LogString out(LOG4CXX_STR("log4cxx: "));
+ LogString out(LOG4CXX_STR("log4cxx: "));
- out.append(msg);
- out.append(1, (logchar) 0x0A);
+ out.append(msg);
+ out.append(1, (logchar) 0x0A);
- SystemErrWriter::write(out);
+ SystemErrWriter::write(out);
}
void LogLog::emit(const std::exception& ex)
{
- LogString out(LOG4CXX_STR("log4cxx: "));
- const char* raw = ex.what();
+ LogString out(LOG4CXX_STR("log4cxx: "));
+ const char* raw = ex.what();
- if (raw != 0)
- {
- Transcoder::decode(raw, out);
- }
- else
- {
- out.append(LOG4CXX_STR("std::exception::what() == null"));
- }
+ if (raw != 0)
+ {
+ Transcoder::decode(raw, out);
+ }
+ else
+ {
+ out.append(LOG4CXX_STR("std::exception::what() == null"));
+ }
- out.append(1, (logchar) 0x0A);
+ out.append(1, (logchar) 0x0A);
- SystemErrWriter::write(out);
+ SystemErrWriter::write(out);
}
diff --git a/src/main/cpp/logmanager.cpp b/src/main/cpp/logmanager.cpp
index e75f24d..41c1155 100644
--- a/src/main/cpp/logmanager.cpp
+++ b/src/main/cpp/logmanager.cpp
@@ -17,7 +17,7 @@
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logmanager.h>
@@ -38,7 +38,7 @@
#include <log4cxx/file.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -54,49 +54,49 @@
RepositorySelectorPtr& LogManager::getRepositorySelector()
{
- //
- // call to initialize APR and trigger "start" of logging clock
- //
- APRInitializer::initialize();
- static spi::RepositorySelectorPtr selector;
- return selector;
+ //
+ // call to initialize APR and trigger "start" of logging clock
+ //
+ APRInitializer::initialize();
+ static spi::RepositorySelectorPtr selector;
+ return selector;
}
void LogManager::setRepositorySelector(spi::RepositorySelectorPtr selector,
- void* guard1)
+ void* guard1)
{
- if ((LogManager::guard != 0) && (LogManager::guard != guard1))
- {
- throw IllegalArgumentException(LOG4CXX_STR("Attempted to reset the LoggerFactory without possessing the guard."));
- }
+ if ((LogManager::guard != 0) && (LogManager::guard != guard1))
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("Attempted to reset the LoggerFactory without possessing the guard."));
+ }
- if (selector == 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("RepositorySelector must be non-null."));
- }
+ if (selector == 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("RepositorySelector must be non-null."));
+ }
- LogManager::guard = guard1;
- LogManager::getRepositorySelector() = selector;
+ LogManager::guard = guard1;
+ LogManager::getRepositorySelector() = selector;
}
LoggerRepositoryPtr& LogManager::getLoggerRepository()
{
- if (getRepositorySelector() == 0)
- {
- LoggerRepositoryPtr hierarchy(new Hierarchy());
- RepositorySelectorPtr selector(new DefaultRepositorySelector(hierarchy));
- getRepositorySelector() = selector;
- }
+ if (getRepositorySelector() == 0)
+ {
+ LoggerRepositoryPtr hierarchy(new Hierarchy());
+ RepositorySelectorPtr selector(new DefaultRepositorySelector(hierarchy));
+ getRepositorySelector() = selector;
+ }
- return getRepositorySelector()->getLoggerRepository();
+ return getRepositorySelector()->getLoggerRepository();
}
LoggerPtr LogManager::getRootLogger()
{
- // Delegate the actual manufacturing of the logger to the logger repository.
- return getLoggerRepository()->getRootLogger();
+ // Delegate the actual manufacturing of the logger to the logger repository.
+ return getLoggerRepository()->getRootLogger();
}
/**
@@ -104,117 +104,117 @@
*/
LoggerPtr LogManager::getLoggerLS(const LogString& name)
{
- return getLoggerRepository()->getLogger(name);
+ return getLoggerRepository()->getLogger(name);
}
/**
Retrieve the appropriate Logger instance.
*/
LoggerPtr LogManager::getLoggerLS(const LogString& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- // Delegate the actual manufacturing of the logger to the logger repository.
- return getLoggerRepository()->getLogger(name, factory);
+ // Delegate the actual manufacturing of the logger to the logger repository.
+ return getLoggerRepository()->getLogger(name, factory);
}
LoggerPtr LogManager::getLogger(const std::string& name)
{
- LOG4CXX_DECODE_CHAR(n, name);
- return getLoggerLS(n);
+ LOG4CXX_DECODE_CHAR(n, name);
+ return getLoggerLS(n);
}
LoggerPtr LogManager::getLogger(const std::string& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- LOG4CXX_DECODE_CHAR(n, name);
- return getLoggerLS(n, factory);
+ LOG4CXX_DECODE_CHAR(n, name);
+ return getLoggerLS(n, factory);
}
LoggerPtr LogManager::exists(const std::string& name)
{
- LOG4CXX_DECODE_CHAR(n, name);
- return existsLS(n);
+ LOG4CXX_DECODE_CHAR(n, name);
+ return existsLS(n);
}
#if LOG4CXX_WCHAR_T_API
LoggerPtr LogManager::getLogger(const std::wstring& name)
{
- LOG4CXX_DECODE_WCHAR(n, name);
- return getLoggerLS(n);
+ LOG4CXX_DECODE_WCHAR(n, name);
+ return getLoggerLS(n);
}
LoggerPtr LogManager::getLogger(const std::wstring& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- LOG4CXX_DECODE_WCHAR(n, name);
- return getLoggerLS(n, factory);
+ LOG4CXX_DECODE_WCHAR(n, name);
+ return getLoggerLS(n, factory);
}
LoggerPtr LogManager::exists(const std::wstring& name)
{
- LOG4CXX_DECODE_WCHAR(n, name);
- return existsLS(n);
+ LOG4CXX_DECODE_WCHAR(n, name);
+ return existsLS(n);
}
#endif
#if LOG4CXX_UNICHAR_API
LoggerPtr LogManager::getLogger(const std::basic_string<UniChar>& name)
{
- LOG4CXX_DECODE_UNICHAR(n, name);
- return getLoggerLS(n);
+ LOG4CXX_DECODE_UNICHAR(n, name);
+ return getLoggerLS(n);
}
LoggerPtr LogManager::getLogger(const std::basic_string<UniChar>& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- LOG4CXX_DECODE_UNICHAR(n, name);
- return getLoggerLS(n, factory);
+ LOG4CXX_DECODE_UNICHAR(n, name);
+ return getLoggerLS(n, factory);
}
LoggerPtr LogManager::exists(const std::basic_string<UniChar>& name)
{
- LOG4CXX_DECODE_UNICHAR(n, name);
- return existsLS(n);
+ LOG4CXX_DECODE_UNICHAR(n, name);
+ return existsLS(n);
}
#endif
#if LOG4CXX_CFSTRING_API
LoggerPtr LogManager::getLogger(const CFStringRef& name)
{
- LOG4CXX_DECODE_CFSTRING(n, name);
- return getLoggerLS(n);
+ LOG4CXX_DECODE_CFSTRING(n, name);
+ return getLoggerLS(n);
}
LoggerPtr LogManager::getLogger(const CFStringRef& name,
- const spi::LoggerFactoryPtr& factory)
+ const spi::LoggerFactoryPtr& factory)
{
- LOG4CXX_DECODE_CFSTRING(n, name);
- return getLoggerLS(n, factory);
+ LOG4CXX_DECODE_CFSTRING(n, name);
+ return getLoggerLS(n, factory);
}
LoggerPtr LogManager::exists(const CFStringRef& name)
{
- LOG4CXX_DECODE_CFSTRING(n, name);
- return existsLS(n);
+ LOG4CXX_DECODE_CFSTRING(n, name);
+ return existsLS(n);
}
#endif
LoggerPtr LogManager::existsLS(const LogString& name)
{
- return getLoggerRepository()->exists(name);
+ return getLoggerRepository()->exists(name);
}
LoggerList LogManager::getCurrentLoggers()
{
- return getLoggerRepository()->getCurrentLoggers();
+ return getLoggerRepository()->getCurrentLoggers();
}
void LogManager::shutdown()
{
- getLoggerRepository()->shutdown();
+ getLoggerRepository()->shutdown();
}
void LogManager::resetConfiguration()
{
- getLoggerRepository()->resetConfiguration();
+ getLoggerRepository()->resetConfiguration();
}
diff --git a/src/main/cpp/logstream.cpp b/src/main/cpp/logstream.cpp
index 1470389..ca5d045 100644
--- a/src/main/cpp/logstream.cpp
+++ b/src/main/cpp/logstream.cpp
@@ -19,34 +19,34 @@
#include <log4cxx/stream.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
using namespace log4cxx;
logstream_base::logstream_ios_base::logstream_ios_base(std::ios_base::fmtflags initval,
- int initsize)
+ int initsize)
{
#if LOG4CXX_MEMSET_IOS_BASE
- //
- // the destructor for std::ios_base in the MSVC STL
- // releases a pointer that was not initialized in the constructor.
- //
- memset(this, 0, sizeof(*this));
+ //
+ // the destructor for std::ios_base in the MSVC STL
+ // releases a pointer that was not initialized in the constructor.
+ //
+ memset(this, 0, sizeof(*this));
#endif
- flags(initval);
- precision(initsize);
- width(initsize);
+ flags(initval);
+ precision(initsize);
+ width(initsize);
}
logstream_base::logstream_base(const LoggerPtr& log,
- const LevelPtr& lvl) : initset((std::ios_base::fmtflags) - 1, 1),
- initclear((std::ios_base::fmtflags) 0, 0), fillchar(0), fillset(false), logger(log), level(lvl), location()
+ const LevelPtr& lvl) : initset((std::ios_base::fmtflags) - 1, 1),
+ initclear((std::ios_base::fmtflags) 0, 0), fillchar(0), fillset(false), logger(log), level(lvl), location()
{
- enabled = logger->isEnabledFor(level);
+ enabled = logger->isEnabledFor(level);
}
logstream_base::~logstream_base()
@@ -55,328 +55,328 @@
void logstream_base::insert(std::ios_base & (*manip)(std::ios_base&))
{
- get_stream_state(initclear, initset, fillchar, fillset);
- (*manip)(initset);
- (*manip)(initclear);
- refresh_stream_state();
+ get_stream_state(initclear, initset, fillchar, fillset);
+ (*manip)(initset);
+ (*manip)(initclear);
+ refresh_stream_state();
}
bool logstream_base::set_stream_state(std::ios_base& dest, int& dstchar)
{
- std::ios_base::fmtflags setval = initset.flags();
- std::ios_base::fmtflags clrval = initclear.flags();
- std::ios_base::fmtflags mask = setval ^ (~clrval);
- dest.setf(clrval, mask);
+ std::ios_base::fmtflags setval = initset.flags();
+ std::ios_base::fmtflags clrval = initclear.flags();
+ std::ios_base::fmtflags mask = setval ^ (~clrval);
+ dest.setf(clrval, mask);
- if (initset.precision() == initclear.precision())
- {
- dest.precision(initset.precision());
- }
+ if (initset.precision() == initclear.precision())
+ {
+ dest.precision(initset.precision());
+ }
- if (initset.width() == initclear.width())
- {
- dest.width(initset.width());
- }
+ if (initset.width() == initclear.width())
+ {
+ dest.width(initset.width());
+ }
- dstchar = fillchar;
- return fillset;
+ dstchar = fillchar;
+ return fillset;
}
logstream_base& logstream_base::endmsg(logstream_base& stream)
{
- stream.end_message();
- return stream;
+ stream.end_message();
+ return stream;
}
logstream_base& logstream_base::nop(logstream_base& stream)
{
- return stream;
+ return stream;
}
void logstream_base::end_message()
{
- if (isEnabled())
- {
- log(logger, level, location);
- }
+ if (isEnabled())
+ {
+ log(logger, level, location);
+ }
- erase();
+ erase();
}
int log4cxx::logstream_base::precision(int p)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- initset.precision(p);
- int oldVal = initclear.precision(p);
- refresh_stream_state();
- return oldVal;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ initset.precision(p);
+ int oldVal = initclear.precision(p);
+ refresh_stream_state();
+ return oldVal;
}
int log4cxx::logstream_base::precision()
{
- get_stream_state(initclear, initset, fillchar, fillset);
- return initclear.precision();
+ get_stream_state(initclear, initset, fillchar, fillset);
+ return initclear.precision();
}
int log4cxx::logstream_base::width(int w)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- initset.width(w);
- int oldVal = initclear.width(w);
- refresh_stream_state();
- return oldVal;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ initset.width(w);
+ int oldVal = initclear.width(w);
+ refresh_stream_state();
+ return oldVal;
}
int log4cxx::logstream_base::width()
{
- get_stream_state(initclear, initset, fillchar, fillset);
- return initclear.width();
+ get_stream_state(initclear, initset, fillchar, fillset);
+ return initclear.width();
}
int log4cxx::logstream_base::fill(int newfill)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- int oldfill = fillchar;
- fillchar = newfill;
- fillset = true;
- refresh_stream_state();
- return oldfill;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ int oldfill = fillchar;
+ fillchar = newfill;
+ fillset = true;
+ refresh_stream_state();
+ return oldfill;
}
int logstream_base::fill()
{
- get_stream_state(initclear, initset, fillchar, fillset);
- return fillchar;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ return fillchar;
}
std::ios_base::fmtflags logstream_base::flags(std::ios_base::fmtflags newflags)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- initset.flags(newflags);
- std::ios_base::fmtflags oldVal = initclear.flags(newflags);
- refresh_stream_state();
- return oldVal;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ initset.flags(newflags);
+ std::ios_base::fmtflags oldVal = initclear.flags(newflags);
+ refresh_stream_state();
+ return oldVal;
}
std::ios_base::fmtflags logstream_base::setf(std::ios_base::fmtflags newflags, std::ios_base::fmtflags mask)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- initset.setf(newflags, mask);
- std::ios_base::fmtflags oldVal = initclear.setf(newflags, mask);
- refresh_stream_state();
- return oldVal;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ initset.setf(newflags, mask);
+ std::ios_base::fmtflags oldVal = initclear.setf(newflags, mask);
+ refresh_stream_state();
+ return oldVal;
}
std::ios_base::fmtflags logstream_base::setf(std::ios_base::fmtflags newflags)
{
- get_stream_state(initclear, initset, fillchar, fillset);
- initset.setf(newflags);
- std::ios_base::fmtflags oldVal = initclear.setf(newflags);
- refresh_stream_state();
- return oldVal;
+ get_stream_state(initclear, initset, fillchar, fillset);
+ initset.setf(newflags);
+ std::ios_base::fmtflags oldVal = initclear.setf(newflags);
+ refresh_stream_state();
+ return oldVal;
}
void logstream_base::setLevel(const ::log4cxx::LevelPtr& newlevel)
{
- level = newlevel;
- bool oldLevel = enabled;
- enabled = logger->isEnabledFor(level);
+ level = newlevel;
+ bool oldLevel = enabled;
+ enabled = logger->isEnabledFor(level);
- if (oldLevel != enabled)
- {
- erase();
- }
+ if (oldLevel != enabled)
+ {
+ erase();
+ }
}
bool logstream_base::isEnabledFor(const ::log4cxx::LevelPtr& l) const
{
- return logger->isEnabledFor(l);
+ return logger->isEnabledFor(l);
}
void logstream_base::setLocation(const log4cxx::spi::LocationInfo& newlocation)
{
- if (LOG4CXX_UNLIKELY(enabled))
- {
- location = newlocation;
- }
+ if (LOG4CXX_UNLIKELY(enabled))
+ {
+ location = newlocation;
+ }
}
logstream::logstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
{
}
logstream::logstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level)
- : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level)
+ : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
logstream::logstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
logstream::~logstream()
{
- delete stream;
+ delete stream;
}
logstream& logstream::operator<<(logstream_base & (*manip)(logstream_base&))
{
- (*manip)(*this);
- return *this;
+ (*manip)(*this);
+ return *this;
}
logstream& logstream::operator<<(const LevelPtr& l)
{
- setLevel(l);
- return *this;
+ setLevel(l);
+ return *this;
}
logstream& logstream::operator<<(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
logstream& logstream::operator>>(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
logstream& logstream::operator<<(std::ios_base & (*manip)(std::ios_base&))
{
- logstream_base::insert(manip);
- return *this;
+ logstream_base::insert(manip);
+ return *this;
}
logstream::operator std::basic_ostream<char>& ()
{
- if (stream == 0)
- {
- stream = new std::basic_stringstream<Ch>();
- refresh_stream_state();
- }
+ if (stream == 0)
+ {
+ stream = new std::basic_stringstream<Ch>();
+ refresh_stream_state();
+ }
- return *stream;
+ return *stream;
}
void logstream::log(LoggerPtr& log,
- const LevelPtr& lev,
- const log4cxx::spi::LocationInfo& loc)
+ const LevelPtr& lev,
+ const log4cxx::spi::LocationInfo& loc)
{
- if (stream != 0)
- {
- std::basic_string<Ch> msg = stream->str();
+ if (stream != 0)
+ {
+ std::basic_string<Ch> msg = stream->str();
- if (!msg.empty())
- {
- log->log(lev, msg, loc);
- }
- }
+ if (!msg.empty())
+ {
+ log->log(lev, msg, loc);
+ }
+ }
}
void logstream::erase()
{
- if (stream != 0)
- {
- std::basic_string<Ch> emptyStr;
- stream->str(emptyStr);
- }
+ if (stream != 0)
+ {
+ std::basic_string<Ch> emptyStr;
+ stream->str(emptyStr);
+ }
}
void logstream::get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const
{
- if (stream != 0)
- {
- std::ios_base::fmtflags flags = stream->flags();
- base.flags(flags);
- mask.flags(flags);
- int width = stream->width();
- base.width(width);
- mask.width(width);
- int precision = stream->precision();
- base.precision(precision);
- mask.precision(precision);
- fill = stream->fill();
- fillSet = true;
- }
+ if (stream != 0)
+ {
+ std::ios_base::fmtflags flags = stream->flags();
+ base.flags(flags);
+ mask.flags(flags);
+ int width = stream->width();
+ base.width(width);
+ mask.width(width);
+ int precision = stream->precision();
+ base.precision(precision);
+ mask.precision(precision);
+ fill = stream->fill();
+ fillSet = true;
+ }
}
void logstream::refresh_stream_state()
{
- if (stream != 0)
- {
- int ch;
+ if (stream != 0)
+ {
+ int ch;
- if (logstream_base::set_stream_state(*stream, ch))
- {
- stream->fill(ch);
- }
- }
+ if (logstream_base::set_stream_state(*stream, ch))
+ {
+ stream->fill(ch);
+ }
+ }
}
#if LOG4CXX_WCHAR_T_API
wlogstream::wlogstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
{
}
wlogstream::wlogstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level)
- : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level)
+ : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
wlogstream::wlogstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
wlogstream::~wlogstream()
{
- delete stream;
+ delete stream;
}
wlogstream& wlogstream::operator<<(logstream_base & (*manip)(logstream_base&))
{
- (*manip)(*this);
- return *this;
+ (*manip)(*this);
+ return *this;
}
wlogstream& wlogstream::operator<<(const LevelPtr& l)
{
- setLevel(l);
- return *this;
+ setLevel(l);
+ return *this;
}
wlogstream& wlogstream::operator<<(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
wlogstream& wlogstream::operator>>(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
@@ -384,100 +384,100 @@
wlogstream& wlogstream::operator<<(std::ios_base & (*manip)(std::ios_base&))
{
- logstream_base::insert(manip);
- return *this;
+ logstream_base::insert(manip);
+ return *this;
}
wlogstream::operator std::basic_ostream<wchar_t>& ()
{
- if (stream == 0)
- {
- stream = new std::basic_stringstream<Ch>();
- refresh_stream_state();
- }
+ if (stream == 0)
+ {
+ stream = new std::basic_stringstream<Ch>();
+ refresh_stream_state();
+ }
- return *stream;
+ return *stream;
}
void wlogstream::log(LoggerPtr& log,
- const LevelPtr& lev,
- const log4cxx::spi::LocationInfo& loc)
+ const LevelPtr& lev,
+ const log4cxx::spi::LocationInfo& loc)
{
- if (stream != 0)
- {
- std::basic_string<Ch> msg = stream->str();
+ if (stream != 0)
+ {
+ std::basic_string<Ch> msg = stream->str();
- if (!msg.empty())
- {
- log->log(lev, msg, loc);
- }
- }
+ if (!msg.empty())
+ {
+ log->log(lev, msg, loc);
+ }
+ }
}
void wlogstream::erase()
{
- if (stream != 0)
- {
- std::basic_string<Ch> emptyStr;
- stream->str(emptyStr);
- }
+ if (stream != 0)
+ {
+ std::basic_string<Ch> emptyStr;
+ stream->str(emptyStr);
+ }
}
void wlogstream::get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const
{
- if (stream != 0)
- {
- std::ios_base::fmtflags flags = stream->flags();
- base.flags(flags);
- mask.flags(flags);
- int width = stream->width();
- base.width(width);
- mask.width(width);
- int precision = stream->precision();
- base.precision(precision);
- mask.precision(precision);
- fill = stream->fill();
- fillSet = true;
- }
+ if (stream != 0)
+ {
+ std::ios_base::fmtflags flags = stream->flags();
+ base.flags(flags);
+ mask.flags(flags);
+ int width = stream->width();
+ base.width(width);
+ mask.width(width);
+ int precision = stream->precision();
+ base.precision(precision);
+ mask.precision(precision);
+ fill = stream->fill();
+ fillSet = true;
+ }
}
void wlogstream::refresh_stream_state()
{
- if (stream != 0)
- {
- int ch;
+ if (stream != 0)
+ {
+ int ch;
- if (logstream_base::set_stream_state(*stream, ch))
- {
- stream->fill(ch);
- }
- }
+ if (logstream_base::set_stream_state(*stream, ch))
+ {
+ stream->fill(ch);
+ }
+ }
}
#endif
#if LOG4CXX_UNICHAR_API
ulogstream::ulogstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level)
- : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level)
+ : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
ulogstream::ulogstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
#endif
#if LOG4CXX_CFSTRING_API
ulogstream::ulogstream(const CFStringRef& loggerName,
- const log4cxx::LevelPtr& level)
- : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
+ const log4cxx::LevelPtr& level)
+ : logstream_base(log4cxx::Logger::getLogger(loggerName), level), stream(0)
{
}
@@ -487,7 +487,7 @@
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
ulogstream::ulogstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
+ const log4cxx::LevelPtr& level) : logstream_base(logger, level), stream(0)
{
}
@@ -495,31 +495,31 @@
ulogstream::~ulogstream()
{
- delete stream;
+ delete stream;
}
ulogstream& ulogstream::operator<<(logstream_base & (*manip)(logstream_base&))
{
- (*manip)(*this);
- return *this;
+ (*manip)(*this);
+ return *this;
}
ulogstream& ulogstream::operator<<(const LevelPtr& level)
{
- setLevel(level);
- return *this;
+ setLevel(level);
+ return *this;
}
ulogstream& ulogstream::operator<<(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
ulogstream& ulogstream::operator>>(const log4cxx::spi::LocationInfo& newlocation)
{
- setLocation(newlocation);
- return *this;
+ setLocation(newlocation);
+ return *this;
}
@@ -527,80 +527,80 @@
ulogstream& ulogstream::operator<<(std::ios_base & (*manip)(std::ios_base&))
{
- logstream_base::insert(manip);
- return *this;
+ logstream_base::insert(manip);
+ return *this;
}
ulogstream::operator std::basic_ostream<UniChar>& ()
{
- if (stream == 0)
- {
- stream = new std::basic_stringstream<Ch>();
- refresh_stream_state();
- }
+ if (stream == 0)
+ {
+ stream = new std::basic_stringstream<Ch>();
+ refresh_stream_state();
+ }
- return *stream;
+ return *stream;
}
void ulogstream::log(LoggerPtr& logger,
- const LevelPtr& level,
- const log4cxx::spi::LocationInfo& location)
+ const LevelPtr& level,
+ const log4cxx::spi::LocationInfo& location)
{
- if (stream != 0)
- {
- std::basic_string<Ch> msg = stream->str();
+ if (stream != 0)
+ {
+ std::basic_string<Ch> msg = stream->str();
- if (!msg.empty() && logger->isEnabledFor(level))
- {
- LOG4CXX_DECODE_UNICHAR(lsmsg, msg);
- logger->forcedLogLS(level, lsmsg, location);
- }
- }
+ if (!msg.empty() && logger->isEnabledFor(level))
+ {
+ LOG4CXX_DECODE_UNICHAR(lsmsg, msg);
+ logger->forcedLogLS(level, lsmsg, location);
+ }
+ }
}
void ulogstream::erase()
{
- if (stream != 0)
- {
- std::basic_string<Ch> emptyStr;
- stream->str(emptyStr);
- }
+ if (stream != 0)
+ {
+ std::basic_string<Ch> emptyStr;
+ stream->str(emptyStr);
+ }
}
void ulogstream::get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const
{
- if (stream != 0)
- {
- std::ios_base::fmtflags flags = stream->flags();
- base.flags(flags);
- mask.flags(flags);
- int width = stream->width();
- base.width(width);
- mask.width(width);
- int precision = stream->precision();
- base.precision(precision);
- mask.precision(precision);
- fill = stream->fill();
- fillSet = true;
- }
+ if (stream != 0)
+ {
+ std::ios_base::fmtflags flags = stream->flags();
+ base.flags(flags);
+ mask.flags(flags);
+ int width = stream->width();
+ base.width(width);
+ mask.width(width);
+ int precision = stream->precision();
+ base.precision(precision);
+ mask.precision(precision);
+ fill = stream->fill();
+ fillSet = true;
+ }
}
void ulogstream::refresh_stream_state()
{
- if (stream != 0)
- {
- int fillchar;
+ if (stream != 0)
+ {
+ int fillchar;
- if (logstream_base::set_stream_state(*stream, fillchar))
- {
- stream->fill(fillchar);
- }
- }
+ if (logstream_base::set_stream_state(*stream, fillchar))
+ {
+ stream->fill(fillchar);
+ }
+ }
}
#endif
diff --git a/src/main/cpp/manualtriggeringpolicy.cpp b/src/main/cpp/manualtriggeringpolicy.cpp
index b46f64d..79faff9 100644
--- a/src/main/cpp/manualtriggeringpolicy.cpp
+++ b/src/main/cpp/manualtriggeringpolicy.cpp
@@ -30,11 +30,11 @@
}
bool ManualTriggeringPolicy::isTriggeringEvent(Appender* /* appender */,
- const log4cxx::spi::LoggingEventPtr& /* event */,
- const LogString& /* file */,
- size_t /* fileLength */ )
+ const log4cxx::spi::LoggingEventPtr& /* event */,
+ const LogString& /* file */,
+ size_t /* fileLength */ )
{
- return false;
+ return false;
}
void ManualTriggeringPolicy::activateOptions(Pool& /* p */ )
diff --git a/src/main/cpp/mdc.cpp b/src/main/cpp/mdc.cpp
index 79b4c9d..5769bb6 100644
--- a/src/main/cpp/mdc.cpp
+++ b/src/main/cpp/mdc.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/threadspecificdata.h>
#if LOG4CXX_CFSTRING_API
- #include <CoreFoundation/CFString.h>
+ #include <CoreFoundation/CFString.h>
#endif
@@ -29,201 +29,201 @@
MDC::MDC(const std::string& key1, const std::string& value) : key()
{
- Transcoder::decode(key1, key);
- LOG4CXX_DECODE_CHAR(v, value);
- putLS(key, v);
+ Transcoder::decode(key1, key);
+ LOG4CXX_DECODE_CHAR(v, value);
+ putLS(key, v);
}
MDC::~MDC()
{
- LogString prevVal;
- remove(key, prevVal);
+ LogString prevVal;
+ remove(key, prevVal);
}
void MDC::putLS(const LogString& key, const LogString& value)
{
- ThreadSpecificData::put(key, value);
+ ThreadSpecificData::put(key, value);
}
void MDC::put(const std::string& key, const std::string& value)
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LOG4CXX_DECODE_CHAR(lvalue, value);
- putLS(lkey, lvalue);
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LOG4CXX_DECODE_CHAR(lvalue, value);
+ putLS(lkey, lvalue);
}
bool MDC::get(const LogString& key, LogString& value)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Map& map = data->getMap();
+ if (data != 0)
+ {
+ Map& map = data->getMap();
- Map::iterator it = map.find(key);
+ Map::iterator it = map.find(key);
- if (it != map.end())
- {
- value.append(it->second);
- return true;
- }
+ if (it != map.end())
+ {
+ value.append(it->second);
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
std::string MDC::get(const std::string& key)
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LogString lvalue;
- if (get(lkey, lvalue))
- {
- LOG4CXX_ENCODE_CHAR(value, lvalue);
- return value;
- }
+ if (get(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_CHAR(value, lvalue);
+ return value;
+ }
- return std::string();
+ return std::string();
}
bool MDC::remove(const LogString& key, LogString& value)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Map& map = data->getMap();
- Map::iterator it;
+ if (data != 0)
+ {
+ Map& map = data->getMap();
+ Map::iterator it;
- if ((it = map.find(key)) != map.end())
- {
- value = it->second;
- map.erase(it);
- data->recycle();
- return true;
- }
- }
+ if ((it = map.find(key)) != map.end())
+ {
+ value = it->second;
+ map.erase(it);
+ data->recycle();
+ return true;
+ }
+ }
- return false;
+ return false;
}
std::string MDC::remove(const std::string& key)
{
- LOG4CXX_DECODE_CHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_CHAR(lkey, key);
+ LogString lvalue;
- if (remove(lkey, lvalue))
- {
- LOG4CXX_ENCODE_CHAR(value, lvalue);
- return value;
- }
+ if (remove(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_CHAR(value, lvalue);
+ return value;
+ }
- return std::string();
+ return std::string();
}
void MDC::clear()
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Map& map = data->getMap();
- map.erase(map.begin(), map.end());
- data->recycle();
- }
+ if (data != 0)
+ {
+ Map& map = data->getMap();
+ map.erase(map.begin(), map.end());
+ data->recycle();
+ }
}
#if LOG4CXX_WCHAR_T_API
MDC::MDC(const std::wstring& key1, const std::wstring& value) : key()
{
- Transcoder::decode(key1, key);
- LOG4CXX_DECODE_WCHAR(v, value);
- putLS(key, v);
+ Transcoder::decode(key1, key);
+ LOG4CXX_DECODE_WCHAR(v, value);
+ putLS(key, v);
}
std::wstring MDC::get(const std::wstring& key)
{
- LOG4CXX_DECODE_WCHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_WCHAR(lkey, key);
+ LogString lvalue;
- if (get(lkey, lvalue))
- {
- LOG4CXX_ENCODE_WCHAR(value, lvalue);
- return value;
- }
+ if (get(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_WCHAR(value, lvalue);
+ return value;
+ }
- return std::wstring();
+ return std::wstring();
}
void MDC::put(const std::wstring& key, const std::wstring& value)
{
- LOG4CXX_DECODE_WCHAR(lkey, key);
- LOG4CXX_DECODE_WCHAR(lvalue, value);
- putLS(lkey, lvalue);
+ LOG4CXX_DECODE_WCHAR(lkey, key);
+ LOG4CXX_DECODE_WCHAR(lvalue, value);
+ putLS(lkey, lvalue);
}
std::wstring MDC::remove(const std::wstring& key)
{
- LOG4CXX_DECODE_WCHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_WCHAR(lkey, key);
+ LogString lvalue;
- if (remove(lkey, lvalue))
- {
- LOG4CXX_ENCODE_WCHAR(value, lvalue);
- return value;
- }
+ if (remove(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_WCHAR(value, lvalue);
+ return value;
+ }
- return std::wstring();
+ return std::wstring();
}
#endif
#if LOG4CXX_UNICHAR_API
MDC::MDC(const std::basic_string<UniChar>& key1, const std::basic_string<UniChar>& value)
{
- Transcoder::decode(key1, key);
- LOG4CXX_DECODE_UNICHAR(v, value);
- putLS(key, v);
+ Transcoder::decode(key1, key);
+ LOG4CXX_DECODE_UNICHAR(v, value);
+ putLS(key, v);
}
std::basic_string<log4cxx::UniChar> MDC::get(const std::basic_string<log4cxx::UniChar>& key)
{
- LOG4CXX_DECODE_UNICHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_UNICHAR(lkey, key);
+ LogString lvalue;
- if (get(lkey, lvalue))
- {
- LOG4CXX_ENCODE_UNICHAR(value, lvalue);
- return value;
- }
+ if (get(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_UNICHAR(value, lvalue);
+ return value;
+ }
- return std::basic_string<UniChar>();
+ return std::basic_string<UniChar>();
}
void MDC::put(const std::basic_string<UniChar>& key, const std::basic_string<log4cxx::UniChar>& value)
{
- LOG4CXX_DECODE_UNICHAR(lkey, key);
- LOG4CXX_DECODE_UNICHAR(lvalue, value);
- putLS(lkey, lvalue);
+ LOG4CXX_DECODE_UNICHAR(lkey, key);
+ LOG4CXX_DECODE_UNICHAR(lvalue, value);
+ putLS(lkey, lvalue);
}
std::basic_string<log4cxx::UniChar> MDC::remove(const std::basic_string<log4cxx::UniChar>& key)
{
- LOG4CXX_DECODE_UNICHAR(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_UNICHAR(lkey, key);
+ LogString lvalue;
- if (remove(lkey, lvalue))
- {
- LOG4CXX_ENCODE_UNICHAR(value, lvalue);
- return value;
- }
+ if (remove(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_UNICHAR(value, lvalue);
+ return value;
+ }
- return std::basic_string<UniChar>();
+ return std::basic_string<UniChar>();
}
#endif
@@ -231,45 +231,45 @@
MDC::MDC(const CFStringRef& key1, const CFStringRef& value)
{
- Transcoder::decode(key1, key);
- LOG4CXX_DECODE_CFSTRING(v, value);
- putLS(key, v);
+ Transcoder::decode(key1, key);
+ LOG4CXX_DECODE_CFSTRING(v, value);
+ putLS(key, v);
}
CFStringRef MDC::get(const CFStringRef& key)
{
- LOG4CXX_DECODE_CFSTRING(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_CFSTRING(lkey, key);
+ LogString lvalue;
- if (get(lkey, lvalue))
- {
- LOG4CXX_ENCODE_CFSTRING(value, lvalue);
- return value;
- }
+ if (get(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_CFSTRING(value, lvalue);
+ return value;
+ }
- return CFSTR("");
+ return CFSTR("");
}
void MDC::put(const CFStringRef& key, const CFStringRef& value)
{
- LOG4CXX_DECODE_CFSTRING(lkey, key);
- LOG4CXX_DECODE_CFSTRING(lvalue, value);
- putLS(lkey, lvalue);
+ LOG4CXX_DECODE_CFSTRING(lkey, key);
+ LOG4CXX_DECODE_CFSTRING(lvalue, value);
+ putLS(lkey, lvalue);
}
CFStringRef MDC::remove(const CFStringRef& key)
{
- LOG4CXX_DECODE_CFSTRING(lkey, key);
- LogString lvalue;
+ LOG4CXX_DECODE_CFSTRING(lkey, key);
+ LogString lvalue;
- if (remove(lkey, lvalue))
- {
- LOG4CXX_ENCODE_CFSTRING(value, lvalue);
- return value;
- }
+ if (remove(lkey, lvalue))
+ {
+ LOG4CXX_ENCODE_CFSTRING(value, lvalue);
+ return value;
+ }
- return CFSTR("");
+ return CFSTR("");
}
#endif
diff --git a/src/main/cpp/messagebuffer.cpp b/src/main/cpp/messagebuffer.cpp
index 9c2b8b1..a551b13 100644
--- a/src/main/cpp/messagebuffer.cpp
+++ b/src/main/cpp/messagebuffer.cpp
@@ -28,7 +28,7 @@
{
void MessageBufferUseStaticStream()
{
- gMessageBufferUseStaticStream = true;
+ gMessageBufferUseStaticStream = true;
}
}
}
@@ -36,9 +36,9 @@
template <typename T>
void ResetStream(std::basic_ostringstream<T>& stream)
{
- stream.seekp(0);
- stream.str(std::basic_string<T>());
- stream.clear();
+ stream.seekp(0);
+ stream.str(std::basic_string<T>());
+ stream.clear();
}
CharMessageBuffer::CharMessageBuffer() : stream(0)
@@ -46,168 +46,168 @@
#if defined(STATIC_STRINGSTREAM)
- if (gMessageBufferUseStaticStream)
- {
- thread_local static char ossBuf[8192];
- thread_local static std::basic_ostringstream<char> sStream;
- thread_local static bool inited = false;
+ if (gMessageBufferUseStaticStream)
+ {
+ thread_local static char ossBuf[8192];
+ thread_local static std::basic_ostringstream<char> sStream;
+ thread_local static bool inited = false;
- if (!inited)
- {
- inited = true;
- sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
+ if (!inited)
+ {
+ inited = true;
+ sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
- ResetStream(sStream);
- }
+ ResetStream(sStream);
+ }
- stream = &sStream;
- }
+ stream = &sStream;
+ }
#endif
}
CharMessageBuffer::~CharMessageBuffer()
{
- if (!gMessageBufferUseStaticStream)
- {
- delete stream;
- }
+ if (!gMessageBufferUseStaticStream)
+ {
+ delete stream;
+ }
}
CharMessageBuffer& CharMessageBuffer::operator<<(const std::basic_string<char>& msg)
{
- if (stream == 0)
- {
- buf.append(msg);
- }
- else
- {
- *stream << msg;
- }
+ if (stream == 0)
+ {
+ buf.append(msg);
+ }
+ else
+ {
+ *stream << msg;
+ }
- return *this;
+ return *this;
}
CharMessageBuffer& CharMessageBuffer::operator<<(const char* msg)
{
- const char* actualMsg = msg;
+ const char* actualMsg = msg;
- if (actualMsg == 0)
- {
- actualMsg = "null";
- }
+ if (actualMsg == 0)
+ {
+ actualMsg = "null";
+ }
- if (stream == 0)
- {
- buf.append(actualMsg);
- }
- else
- {
- *stream << actualMsg;
- }
+ if (stream == 0)
+ {
+ buf.append(actualMsg);
+ }
+ else
+ {
+ *stream << actualMsg;
+ }
- return *this;
+ return *this;
}
CharMessageBuffer& CharMessageBuffer::operator<<(char* msg)
{
- return operator<<((const char*) msg);
+ return operator<<((const char*) msg);
}
CharMessageBuffer& CharMessageBuffer::operator<<(const char msg)
{
- if (stream == 0)
- {
- buf.append(1, msg);
- }
- else
- {
- buf.assign(1, msg);
- *stream << buf;
- }
+ if (stream == 0)
+ {
+ buf.append(1, msg);
+ }
+ else
+ {
+ buf.assign(1, msg);
+ *stream << buf;
+ }
- return *this;
+ return *this;
}
CharMessageBuffer::operator std::basic_ostream<char>& ()
{
- if (stream == 0)
- {
- stream = new std::basic_ostringstream<char>();
+ if (stream == 0)
+ {
+ stream = new std::basic_ostringstream<char>();
- if (!buf.empty())
- {
- *stream << buf;
- }
- }
+ if (!buf.empty())
+ {
+ *stream << buf;
+ }
+ }
- return *stream;
+ return *stream;
}
const std::basic_string<char>& CharMessageBuffer::str(std::basic_ostream<char>&)
{
- buf = stream->str();
+ buf = stream->str();
- ResetStream(*stream);
+ ResetStream(*stream);
- return buf;
+ return buf;
}
const std::basic_string<char>& CharMessageBuffer::str(CharMessageBuffer&)
{
- return buf;
+ return buf;
}
bool CharMessageBuffer::hasStream() const
{
- return (stream != 0);
+ return (stream != 0);
}
std::ostream& CharMessageBuffer::operator<<(ios_base_manip manip)
{
- std::ostream& s = *this;
- (*manip)(s);
- return s;
+ std::ostream& s = *this;
+ (*manip)(s);
+ return s;
}
std::ostream& CharMessageBuffer::operator<<(bool val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(short val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(int val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(unsigned int val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(long val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(unsigned long val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(float val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(double val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(long double val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
std::ostream& CharMessageBuffer::operator<<(void* val)
{
- return ((std::ostream&) * this).operator << (val);
+ return ((std::ostream&) * this).operator << (val);
}
@@ -217,309 +217,309 @@
#if defined(STATIC_STRINGSTREAM)
- if (gMessageBufferUseStaticStream)
- {
- thread_local static wchar_t ossBuf[8192];
- thread_local static std::basic_ostringstream<wchar_t> sStream;
- thread_local static bool inited = false;
+ if (gMessageBufferUseStaticStream)
+ {
+ thread_local static wchar_t ossBuf[8192];
+ thread_local static std::basic_ostringstream<wchar_t> sStream;
+ thread_local static bool inited = false;
- if (!inited)
- {
- inited = true;
- sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
+ if (!inited)
+ {
+ inited = true;
+ sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
- ResetStream(sStream);
- }
+ ResetStream(sStream);
+ }
- stream = &sStream;
- }
+ stream = &sStream;
+ }
#endif
}
WideMessageBuffer::~WideMessageBuffer()
{
- if (!gMessageBufferUseStaticStream)
- {
- delete stream;
- }
+ if (!gMessageBufferUseStaticStream)
+ {
+ delete stream;
+ }
}
WideMessageBuffer& WideMessageBuffer::operator<<(const std::basic_string<wchar_t>& msg)
{
- if (stream == 0)
- {
- buf.append(msg);
- }
- else
- {
- *stream << msg;
- }
+ if (stream == 0)
+ {
+ buf.append(msg);
+ }
+ else
+ {
+ *stream << msg;
+ }
- return *this;
+ return *this;
}
WideMessageBuffer& WideMessageBuffer::operator<<(const wchar_t* msg)
{
- const wchar_t* actualMsg = msg;
+ const wchar_t* actualMsg = msg;
- if (actualMsg == 0)
- {
- actualMsg = L"null";
- }
+ if (actualMsg == 0)
+ {
+ actualMsg = L"null";
+ }
- if (stream == 0)
- {
- buf.append(actualMsg);
- }
- else
- {
- *stream << actualMsg;
- }
+ if (stream == 0)
+ {
+ buf.append(actualMsg);
+ }
+ else
+ {
+ *stream << actualMsg;
+ }
- return *this;
+ return *this;
}
WideMessageBuffer& WideMessageBuffer::operator<<(wchar_t* msg)
{
- return operator<<((const wchar_t*) msg);
+ return operator<<((const wchar_t*) msg);
}
WideMessageBuffer& WideMessageBuffer::operator<<(const wchar_t msg)
{
- if (stream == 0)
- {
- buf.append(1, msg);
- }
- else
- {
- buf.assign(1, msg);
- *stream << buf;
- }
+ if (stream == 0)
+ {
+ buf.append(1, msg);
+ }
+ else
+ {
+ buf.assign(1, msg);
+ *stream << buf;
+ }
- return *this;
+ return *this;
}
WideMessageBuffer::operator std::basic_ostream<wchar_t>& ()
{
- if (stream == 0)
- {
- stream = new std::basic_ostringstream<wchar_t>();
+ if (stream == 0)
+ {
+ stream = new std::basic_ostringstream<wchar_t>();
- if (!buf.empty())
- {
- *stream << buf;
- }
- }
+ if (!buf.empty())
+ {
+ *stream << buf;
+ }
+ }
- return *stream;
+ return *stream;
}
const std::basic_string<wchar_t>& WideMessageBuffer::str(std::basic_ostream<wchar_t>&)
{
- buf = stream->str();
+ buf = stream->str();
- ResetStream(*stream);
+ ResetStream(*stream);
- return buf;
+ return buf;
}
const std::basic_string<wchar_t>& WideMessageBuffer::str(WideMessageBuffer&)
{
- return buf;
+ return buf;
}
bool WideMessageBuffer::hasStream() const
{
- return (stream != 0);
+ return (stream != 0);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(ios_base_manip manip)
{
- std::basic_ostream<wchar_t>& s = *this;
- (*manip)(s);
- return s;
+ std::basic_ostream<wchar_t>& s = *this;
+ (*manip)(s);
+ return s;
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(bool val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(short val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(int val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(unsigned int val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(long val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(unsigned long val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(float val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(double val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(long double val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
std::basic_ostream<wchar_t>& WideMessageBuffer::operator<<(void* val)
{
- return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
+ return ((std::basic_ostream<wchar_t>&) * this).operator << (val);
}
MessageBuffer::MessageBuffer() : wbuf(0)
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- , ubuf(0)
+ , ubuf(0)
#endif
{
}
MessageBuffer::~MessageBuffer()
{
- delete wbuf;
+ delete wbuf;
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- delete ubuf;
+ delete ubuf;
#endif
}
bool MessageBuffer::hasStream() const
{
- bool retval = cbuf.hasStream() || (wbuf != 0 && wbuf->hasStream());
+ bool retval = cbuf.hasStream() || (wbuf != 0 && wbuf->hasStream());
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- retval = retval || (ubuf != 0 && ubuf->hasStream());
+ retval = retval || (ubuf != 0 && ubuf->hasStream());
#endif
- return retval;
+ return retval;
}
std::ostream& MessageBuffer::operator<<(ios_base_manip manip)
{
- std::ostream& s = *this;
- (*manip)(s);
- return s;
+ std::ostream& s = *this;
+ (*manip)(s);
+ return s;
}
MessageBuffer::operator std::ostream& ()
{
- return (std::ostream&) cbuf;
+ return (std::ostream&) cbuf;
}
CharMessageBuffer& MessageBuffer::operator<<(const std::string& msg)
{
- return cbuf.operator << (msg);
+ return cbuf.operator << (msg);
}
CharMessageBuffer& MessageBuffer::operator<<(const char* msg)
{
- return cbuf.operator << (msg);
+ return cbuf.operator << (msg);
}
CharMessageBuffer& MessageBuffer::operator<<(char* msg)
{
- return cbuf.operator << ((const char*) msg);
+ return cbuf.operator << ((const char*) msg);
}
CharMessageBuffer& MessageBuffer::operator<<(const char msg)
{
- return cbuf.operator << (msg);
+ return cbuf.operator << (msg);
}
const std::string& MessageBuffer::str(CharMessageBuffer& buf)
{
- return cbuf.str(buf);
+ return cbuf.str(buf);
}
const std::string& MessageBuffer::str(std::ostream& os)
{
- return cbuf.str(os);
+ return cbuf.str(os);
}
WideMessageBuffer& MessageBuffer::operator<<(const std::wstring& msg)
{
- wbuf = new WideMessageBuffer();
- return (*wbuf) << msg;
+ wbuf = new WideMessageBuffer();
+ return (*wbuf) << msg;
}
WideMessageBuffer& MessageBuffer::operator<<(const wchar_t* msg)
{
- wbuf = new WideMessageBuffer();
- return (*wbuf) << msg;
+ wbuf = new WideMessageBuffer();
+ return (*wbuf) << msg;
}
WideMessageBuffer& MessageBuffer::operator<<(wchar_t* msg)
{
- wbuf = new WideMessageBuffer();
- return (*wbuf) << (const wchar_t*) msg;
+ wbuf = new WideMessageBuffer();
+ return (*wbuf) << (const wchar_t*) msg;
}
WideMessageBuffer& MessageBuffer::operator<<(const wchar_t msg)
{
- wbuf = new WideMessageBuffer();
- return (*wbuf) << msg;
+ wbuf = new WideMessageBuffer();
+ return (*wbuf) << msg;
}
const std::wstring& MessageBuffer::str(WideMessageBuffer& buf)
{
- return wbuf->str(buf);
+ return wbuf->str(buf);
}
const std::wstring& MessageBuffer::str(std::basic_ostream<wchar_t>& os)
{
- return wbuf->str(os);
+ return wbuf->str(os);
}
std::ostream& MessageBuffer::operator<<(bool val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(short val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(int val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(unsigned int val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(long val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(unsigned long val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(float val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(double val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(long double val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
std::ostream& MessageBuffer::operator<<(void* val)
{
- return cbuf.operator << (val);
+ return cbuf.operator << (val);
}
@@ -529,35 +529,35 @@
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
UniCharMessageBuffer& MessageBuffer::operator<<(const std::basic_string<log4cxx::UniChar>& msg)
{
- ubuf = new UniCharMessageBuffer();
- return (*ubuf) << msg;
+ ubuf = new UniCharMessageBuffer();
+ return (*ubuf) << msg;
}
UniCharMessageBuffer& MessageBuffer::operator<<(const log4cxx::UniChar* msg)
{
- ubuf = new UniCharMessageBuffer();
- return (*ubuf) << msg;
+ ubuf = new UniCharMessageBuffer();
+ return (*ubuf) << msg;
}
UniCharMessageBuffer& MessageBuffer::operator<<(log4cxx::UniChar* msg)
{
- ubuf = new UniCharMessageBuffer();
- return (*ubuf) << (const log4cxx::UniChar*) msg;
+ ubuf = new UniCharMessageBuffer();
+ return (*ubuf) << (const log4cxx::UniChar*) msg;
}
UniCharMessageBuffer& MessageBuffer::operator<<(const log4cxx::UniChar msg)
{
- ubuf = new UniCharMessageBuffer();
- return (*ubuf) << msg;
+ ubuf = new UniCharMessageBuffer();
+ return (*ubuf) << msg;
}
const std::basic_string<log4cxx::UniChar>& MessageBuffer::str(UniCharMessageBuffer& buf)
{
- return ubuf->str(buf);
+ return ubuf->str(buf);
}
const std::basic_string<log4cxx::UniChar>& MessageBuffer::str(std::basic_ostream<log4cxx::UniChar>& os)
{
- return ubuf->str(os);
+ return ubuf->str(os);
}
@@ -566,168 +566,168 @@
#if defined(STATIC_STRINGSTREAM)
- if (gMessageBufferUseStaticStream)
- {
- thread_local static log4cxx::UniChar ossBuf[8192];
- thread_local static std::basic_ostringstream<log4cxx::UniChar> sStream;
- thread_local static bool inited = false;
+ if (gMessageBufferUseStaticStream)
+ {
+ thread_local static log4cxx::UniChar ossBuf[8192];
+ thread_local static std::basic_ostringstream<log4cxx::UniChar> sStream;
+ thread_local static bool inited = false;
- if (!inited)
- {
- inited = true;
- sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
+ if (!inited)
+ {
+ inited = true;
+ sStream.rdbuf()->pubsetbuf(ossBuf, 8192);
- ResetStream(sStream);
- }
+ ResetStream(sStream);
+ }
- stream = &sStream;
- }
+ stream = &sStream;
+ }
#endif
}
UniCharMessageBuffer::~UniCharMessageBuffer()
{
- if (!gMessageBufferUseStaticStream)
- {
- delete stream;
- }
+ if (!gMessageBufferUseStaticStream)
+ {
+ delete stream;
+ }
}
UniCharMessageBuffer& UniCharMessageBuffer::operator<<(const std::basic_string<log4cxx::UniChar>& msg)
{
- if (stream == 0)
- {
- buf.append(msg);
- }
- else
- {
- *stream << buf;
- }
+ if (stream == 0)
+ {
+ buf.append(msg);
+ }
+ else
+ {
+ *stream << buf;
+ }
- return *this;
+ return *this;
}
UniCharMessageBuffer& UniCharMessageBuffer::operator<<(const log4cxx::UniChar* msg)
{
- const log4cxx::UniChar* actualMsg = msg;
- static log4cxx::UniChar nullLiteral[] = { 0x6E, 0x75, 0x6C, 0x6C, 0};
+ const log4cxx::UniChar* actualMsg = msg;
+ static log4cxx::UniChar nullLiteral[] = { 0x6E, 0x75, 0x6C, 0x6C, 0};
- if (actualMsg == 0)
- {
- actualMsg = nullLiteral;
- }
+ if (actualMsg == 0)
+ {
+ actualMsg = nullLiteral;
+ }
- if (stream == 0)
- {
- buf.append(actualMsg);
- }
- else
- {
- *stream << actualMsg;
- }
+ if (stream == 0)
+ {
+ buf.append(actualMsg);
+ }
+ else
+ {
+ *stream << actualMsg;
+ }
- return *this;
+ return *this;
}
UniCharMessageBuffer& UniCharMessageBuffer::operator<<(log4cxx::UniChar* msg)
{
- return operator<<((const log4cxx::UniChar*) msg);
+ return operator<<((const log4cxx::UniChar*) msg);
}
UniCharMessageBuffer& UniCharMessageBuffer::operator<<(const log4cxx::UniChar msg)
{
- if (stream == 0)
- {
- buf.append(1, msg);
- }
- else
- {
- *stream << msg;
- }
+ if (stream == 0)
+ {
+ buf.append(1, msg);
+ }
+ else
+ {
+ *stream << msg;
+ }
- return *this;
+ return *this;
}
UniCharMessageBuffer::operator UniCharMessageBuffer::uostream& ()
{
- if (stream == 0)
- {
- stream = new std::basic_ostringstream<UniChar>();
+ if (stream == 0)
+ {
+ stream = new std::basic_ostringstream<UniChar>();
- if (!buf.empty())
- {
- *stream << buf;
- }
- }
+ if (!buf.empty())
+ {
+ *stream << buf;
+ }
+ }
- return *stream;
+ return *stream;
}
const std::basic_string<log4cxx::UniChar>& UniCharMessageBuffer::str(UniCharMessageBuffer::uostream&)
{
- buf = stream->str();
- ResetStream(*stream);
- return buf;
+ buf = stream->str();
+ ResetStream(*stream);
+ return buf;
}
const std::basic_string<log4cxx::UniChar>& UniCharMessageBuffer::str(UniCharMessageBuffer&)
{
- return buf;
+ return buf;
}
bool UniCharMessageBuffer::hasStream() const
{
- return (stream != 0);
+ return (stream != 0);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(ios_base_manip manip)
{
- UniCharMessageBuffer::uostream& s = *this;
- (*manip)(s);
- return s;
+ UniCharMessageBuffer::uostream& s = *this;
+ (*manip)(s);
+ return s;
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(bool val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(short val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(int val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(unsigned int val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(long val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(unsigned long val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(float val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(double val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(long double val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
UniCharMessageBuffer::uostream& UniCharMessageBuffer::operator<<(void* val)
{
- return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
+ return ((UniCharMessageBuffer::uostream&) * this).operator << (val);
}
@@ -740,37 +740,37 @@
UniCharMessageBuffer& UniCharMessageBuffer::operator<<(const CFStringRef& msg)
{
- const log4cxx::UniChar* chars = CFStringGetCharactersPtr(msg);
+ const log4cxx::UniChar* chars = CFStringGetCharactersPtr(msg);
- if (chars != 0)
- {
- return operator<<(chars);
- }
- else
- {
- size_t length = CFStringGetLength(msg);
- std::vector<log4cxx::UniChar> tmp(length);
- CFStringGetCharacters(msg, CFRangeMake(0, length), &tmp[0]);
+ if (chars != 0)
+ {
+ return operator<<(chars);
+ }
+ else
+ {
+ size_t length = CFStringGetLength(msg);
+ std::vector<log4cxx::UniChar> tmp(length);
+ CFStringGetCharacters(msg, CFRangeMake(0, length), &tmp[0]);
- if (stream)
- {
- std::basic_string<UniChar> s(&tmp[0], tmp.size());
- *stream << s;
- }
- else
- {
- buf.append(&tmp[0], tmp.size());
- }
- }
+ if (stream)
+ {
+ std::basic_string<UniChar> s(&tmp[0], tmp.size());
+ *stream << s;
+ }
+ else
+ {
+ buf.append(&tmp[0], tmp.size());
+ }
+ }
- return *this;
+ return *this;
}
UniCharMessageBuffer& MessageBuffer::operator<<(const CFStringRef& msg)
{
- ubuf = new UniCharMessageBuffer();
- return (*ubuf) << msg;
+ ubuf = new UniCharMessageBuffer();
+ return (*ubuf) << msg;
}
#endif
diff --git a/src/main/cpp/messagepatternconverter.cpp b/src/main/cpp/messagepatternconverter.cpp
index 238a26f..fa0ecda 100644
--- a/src/main/cpp/messagepatternconverter.cpp
+++ b/src/main/cpp/messagepatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -33,23 +33,23 @@
IMPLEMENT_LOG4CXX_OBJECT(MessagePatternConverter)
MessagePatternConverter::MessagePatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Message"),
- LOG4CXX_STR("message"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Message"),
+ LOG4CXX_STR("message"))
{
}
PatternConverterPtr MessagePatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr def(new MessagePatternConverter());
- return def;
+ static PatternConverterPtr def(new MessagePatternConverter());
+ return def;
}
void MessagePatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(event->getRenderedMessage());
+ toAppendTo.append(event->getRenderedMessage());
}
diff --git a/src/main/cpp/methodlocationpatternconverter.cpp b/src/main/cpp/methodlocationpatternconverter.cpp
index 116b321..280e4b8 100644
--- a/src/main/cpp/methodlocationpatternconverter.cpp
+++ b/src/main/cpp/methodlocationpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -33,22 +33,22 @@
IMPLEMENT_LOG4CXX_OBJECT(MethodLocationPatternConverter)
MethodLocationPatternConverter::MethodLocationPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Method"),
- LOG4CXX_STR("method"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Method"),
+ LOG4CXX_STR("method"))
{
}
PatternConverterPtr MethodLocationPatternConverter::newInstance(
- const std::vector<LogString>& /* options */ )
+ const std::vector<LogString>& /* options */ )
{
- static PatternConverterPtr def(new MethodLocationPatternConverter());
- return def;
+ static PatternConverterPtr def(new MethodLocationPatternConverter());
+ return def;
}
void MethodLocationPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */ ) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */ ) const
{
- append(toAppendTo, event->getLocationInformation().getMethodName());
+ append(toAppendTo, event->getLocationInformation().getMethodName());
}
diff --git a/src/main/cpp/mutex.cpp b/src/main/cpp/mutex.cpp
index c3a4d25..25344a7 100755
--- a/src/main/cpp/mutex.cpp
+++ b/src/main/cpp/mutex.cpp
@@ -23,18 +23,18 @@
#include <apr_thread_rwlock.h>
#include <assert.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
#if defined(NON_BLOCKING)
- #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
- #include <windows.h>
- #else
- // POSIX
- #include <semaphore.h>
- #endif
+ #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
+ #include <windows.h>
+ #else
+ // POSIX
+ #include <semaphore.h>
+ #endif
#endif // NON_BLOCKING
@@ -45,13 +45,13 @@
Mutex::Mutex(Pool& p)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_mutex_create(&mutex,
- APR_THREAD_MUTEX_NESTED, p.getAPRPool());
+ apr_status_t stat = apr_thread_mutex_create(&mutex,
+ APR_THREAD_MUTEX_NESTED, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -59,13 +59,13 @@
Mutex::Mutex(apr_pool_t* p)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_mutex_create(&mutex,
- APR_THREAD_MUTEX_NESTED, p);
+ apr_status_t stat = apr_thread_mutex_create(&mutex,
+ APR_THREAD_MUTEX_NESTED, p);
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -75,50 +75,50 @@
{
#if APR_HAS_THREADS
- // LOGCXX-322
- if (APRInitializer::isDestructed)
- {
- return;
- }
+ // LOGCXX-322
+ if (APRInitializer::isDestructed)
+ {
+ return;
+ }
- apr_thread_mutex_destroy(mutex);
+ apr_thread_mutex_destroy(mutex);
#endif
}
apr_thread_mutex_t* Mutex::getAPRMutex() const
{
- return mutex;
+ return mutex;
}
#if defined(RW_MUTEX)
RWMutex::RWMutex(Pool& p)
- : id((apr_os_thread_t) -1)
- , count(0)
+ : id((apr_os_thread_t) -1)
+ , count(0)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_rwlock_create(&mutex,
- p.getAPRPool());
+ apr_status_t stat = apr_thread_rwlock_create(&mutex,
+ p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
RWMutex::RWMutex(apr_pool_t* p)
- : id((apr_os_thread_t) -1)
- , count(0)
+ : id((apr_os_thread_t) -1)
+ , count(0)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_rwlock_create(&mutex, p);
+ apr_status_t stat = apr_thread_rwlock_create(&mutex, p);
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -127,39 +127,39 @@
RWMutex::~RWMutex()
{
#if APR_HAS_THREADS
- apr_thread_rwlock_destroy(mutex);
+ apr_thread_rwlock_destroy(mutex);
#endif
}
void RWMutex::rdLock() const
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_rwlock_rdlock(mutex);
+ apr_status_t stat = apr_thread_rwlock_rdlock(mutex);
#endif
}
void RWMutex::rdUnlock() const
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_rwlock_unlock(mutex);
+ apr_status_t stat = apr_thread_rwlock_unlock(mutex);
#endif
}
void RWMutex::wrLock() const
{
#if APR_HAS_THREADS
- apr_os_thread_t self = apr_os_thread_current();
+ apr_os_thread_t self = apr_os_thread_current();
- if (id == self)
- {
- ++count;
- }
- else
- {
- apr_status_t stat = apr_thread_rwlock_wrlock(mutex);
- id = self;
- count = 1;
- }
+ if (id == self)
+ {
+ ++count;
+ }
+ else
+ {
+ apr_status_t stat = apr_thread_rwlock_wrlock(mutex);
+ id = self;
+ count = 1;
+ }
#endif
}
@@ -168,14 +168,14 @@
{
#if APR_HAS_THREADS
- if (--count == 0)
- {
- id = (apr_os_thread_t) -1; // id_ = "not a thread"
- apr_status_t stat = apr_thread_rwlock_unlock(mutex);
- }
- else
- {
- }
+ if (--count == 0)
+ {
+ id = (apr_os_thread_t) -1; // id_ = "not a thread"
+ apr_status_t stat = apr_thread_rwlock_unlock(mutex);
+ }
+ else
+ {
+ }
#endif
}
@@ -192,7 +192,7 @@
{
struct SemaphoreImpl
{
- HANDLE semaphore;
+ HANDLE semaphore;
};
}
}
@@ -200,26 +200,26 @@
static const LONG cMax = 10000; // arbitrary high value
Semaphore::Semaphore(log4cxx::helpers::Pool& p)
- : impl(nullptr)
+ : impl(nullptr)
{
#if APR_HAS_THREADS
- impl = (SemaphoreImpl*)p.palloc(sizeof(SemaphoreImpl));
+ impl = (SemaphoreImpl*)p.palloc(sizeof(SemaphoreImpl));
- if (nullptr == impl)
- {
- throw MutexException(APR_ENOMEM);
- }
+ if (nullptr == impl)
+ {
+ throw MutexException(APR_ENOMEM);
+ }
- impl->semaphore = CreateSemaphore(
- NULL, // default security attributes
- 0, // initial count
- cMax, // maximum count
- NULL); // unnamed semaphore
+ impl->semaphore = CreateSemaphore(
+ NULL, // default security attributes
+ 0, // initial count
+ cMax, // maximum count
+ NULL); // unnamed semaphore
- if (impl->semaphore == NULL)
- {
- throw MutexException(APR_ENOSHMAVAIL);
- }
+ if (impl->semaphore == NULL)
+ {
+ throw MutexException(APR_ENOSHMAVAIL);
+ }
#endif
}
@@ -228,10 +228,10 @@
{
#if APR_HAS_THREADS
- if (impl && impl->semaphore)
- {
- CloseHandle(impl->semaphore);
- }
+ if (impl && impl->semaphore)
+ {
+ CloseHandle(impl->semaphore);
+ }
#endif
}
@@ -239,12 +239,12 @@
void Semaphore::await() const
{
#if APR_HAS_THREADS
- DWORD dwWaitResult = WaitForSingleObject(impl->semaphore, INFINITE);
+ DWORD dwWaitResult = WaitForSingleObject(impl->semaphore, INFINITE);
- if (stat != 0)
- {
- throw MutexException(1);
- }
+ if (stat != 0)
+ {
+ throw MutexException(1);
+ }
#endif
}
@@ -252,12 +252,12 @@
void Semaphore::signalAll() const
{
#if APR_HAS_THREADS
- BOOL stat = ReleaseSemaphore(impl->semaphore, 1, NULL);
+ BOOL stat = ReleaseSemaphore(impl->semaphore, 1, NULL);
- if (!stat)
- {
- throw MutexException(stat);
- }
+ if (!stat)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -271,28 +271,28 @@
{
struct SemaphoreImpl
{
- sem_t semaphore;
+ sem_t semaphore;
};
}
}
Semaphore::Semaphore(log4cxx::helpers::Pool& p)
- : impl(nullptr)
+ : impl(nullptr)
{
#if APR_HAS_THREADS
- impl = (SemaphoreImpl*)p.palloc(sizeof(SemaphoreImpl));
+ impl = (SemaphoreImpl*)p.palloc(sizeof(SemaphoreImpl));
- if (nullptr == impl)
- {
- throw MutexException(APR_ENOMEM);
- }
+ if (nullptr == impl)
+ {
+ throw MutexException(APR_ENOMEM);
+ }
- int stat = sem_init(&impl->semaphore, 0, 0);
+ int stat = sem_init(&impl->semaphore, 0, 0);
- if (stat != 0)
- {
- throw MutexException(APR_ENOSHMAVAIL);
- }
+ if (stat != 0)
+ {
+ throw MutexException(APR_ENOSHMAVAIL);
+ }
#endif
}
@@ -301,10 +301,10 @@
{
#if APR_HAS_THREADS
- if (impl)
- {
- int stat = sem_destroy(&impl->semaphore);
- }
+ if (impl)
+ {
+ int stat = sem_destroy(&impl->semaphore);
+ }
#endif
}
@@ -312,12 +312,12 @@
void Semaphore::await() const
{
#if APR_HAS_THREADS
- int stat = sem_wait(&impl->semaphore);
+ int stat = sem_wait(&impl->semaphore);
- if (stat != 0)
- {
- throw MutexException(stat);
- }
+ if (stat != 0)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -325,12 +325,12 @@
void Semaphore::signalAll() const
{
#if APR_HAS_THREADS
- int stat = sem_post(&impl->semaphore);
+ int stat = sem_post(&impl->semaphore);
- if (stat != 0)
- {
- throw MutexException(stat);
- }
+ if (stat != 0)
+ {
+ throw MutexException(stat);
+ }
#endif
}
diff --git a/src/main/cpp/nameabbreviator.cpp b/src/main/cpp/nameabbreviator.cpp
index 182a423..02f56fc 100644
--- a/src/main/cpp/nameabbreviator.cpp
+++ b/src/main/cpp/nameabbreviator.cpp
@@ -44,26 +44,26 @@
*/
class NOPAbbreviator : public NameAbbreviator
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(NOPAbbreviator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(NOPAbbreviator)
- LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(NOPAbbreviator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(NOPAbbreviator)
+ LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Constructor.
- */
- NOPAbbreviator()
- {
- }
+ /**
+ * Constructor.
+ */
+ NOPAbbreviator()
+ {
+ }
- /**
- * {@inheritDoc}
- */
- void abbreviate(LogString::size_type /* nameStart */, LogString& /* buf */) const
- {
- }
+ /**
+ * {@inheritDoc}
+ */
+ void abbreviate(LogString::size_type /* nameStart */, LogString& /* buf */) const
+ {
+ }
};
@@ -72,49 +72,49 @@
*/
class MaxElementAbbreviator : public NameAbbreviator
{
- /**
- * Maximum number of path elements to output.
- */
- const int count;
+ /**
+ * Maximum number of path elements to output.
+ */
+ const int count;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(MaxElementAbbreviator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(MaxElementAbbreviator)
- LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
- END_LOG4CXX_CAST_MAP()
- /**
- * Create new instance.
- * @param count maximum number of path elements to output.
- */
- MaxElementAbbreviator(const int count1) : count(count1)
- {
- }
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(MaxElementAbbreviator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(MaxElementAbbreviator)
+ LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
+ END_LOG4CXX_CAST_MAP()
+ /**
+ * Create new instance.
+ * @param count maximum number of path elements to output.
+ */
+ MaxElementAbbreviator(const int count1) : count(count1)
+ {
+ }
- /**
- * Abbreviate name.
- * @param buf buffer to append abbreviation.
- * @param nameStart start of name to abbreviate.
- */
- void abbreviate(LogString::size_type nameStart, LogString& buf) const
- {
- // We substract 1 from 'len' when assigning to 'end' to avoid out of
- // bounds exception in return r.substring(end+1, len). This can happen if
- // precision is 1 and the logger name ends with a dot.
- LogString::size_type end = buf.length() - 1;
+ /**
+ * Abbreviate name.
+ * @param buf buffer to append abbreviation.
+ * @param nameStart start of name to abbreviate.
+ */
+ void abbreviate(LogString::size_type nameStart, LogString& buf) const
+ {
+ // We substract 1 from 'len' when assigning to 'end' to avoid out of
+ // bounds exception in return r.substring(end+1, len). This can happen if
+ // precision is 1 and the logger name ends with a dot.
+ LogString::size_type end = buf.length() - 1;
- for (LogString::size_type i = count; i > 0; i--)
- {
- end = buf.rfind(0x2E /* '.' */, end - 1);
+ for (LogString::size_type i = count; i > 0; i--)
+ {
+ end = buf.rfind(0x2E /* '.' */, end - 1);
- if ((end == LogString::npos) || (end < nameStart))
- {
- return;
- }
- }
+ if ((end == LogString::npos) || (end < nameStart))
+ {
+ return;
+ }
+ }
- buf.erase(buf.begin() + nameStart, buf.begin() + (end + 1));
- }
+ buf.erase(buf.begin() + nameStart, buf.begin() + (end + 1));
+ }
};
/**
@@ -123,74 +123,74 @@
*/
class PatternAbbreviatorFragment
{
- /**
- * Count of initial characters of element to output.
- */
- LogString::size_type charCount;
+ /**
+ * Count of initial characters of element to output.
+ */
+ LogString::size_type charCount;
- /**
- * Character used to represent dropped characters.
- * '\0' indicates no representation of dropped characters.
- */
- logchar ellipsis;
+ /**
+ * Character used to represent dropped characters.
+ * '\0' indicates no representation of dropped characters.
+ */
+ logchar ellipsis;
- public:
- /**
- * Creates a PatternAbbreviatorFragment.
- * @param charCount number of initial characters to preserve.
- * @param ellipsis character to represent elimination of characters,
- * '\0' if no ellipsis is desired.
- */
- PatternAbbreviatorFragment(
- const int charCount1, const logchar ellipsis1)
- : charCount(charCount1), ellipsis(ellipsis1)
- {
- }
- PatternAbbreviatorFragment() : charCount(0), ellipsis(0)
- {
- }
+ public:
+ /**
+ * Creates a PatternAbbreviatorFragment.
+ * @param charCount number of initial characters to preserve.
+ * @param ellipsis character to represent elimination of characters,
+ * '\0' if no ellipsis is desired.
+ */
+ PatternAbbreviatorFragment(
+ const int charCount1, const logchar ellipsis1)
+ : charCount(charCount1), ellipsis(ellipsis1)
+ {
+ }
+ PatternAbbreviatorFragment() : charCount(0), ellipsis(0)
+ {
+ }
- PatternAbbreviatorFragment(const PatternAbbreviatorFragment& src)
- : charCount(src.charCount), ellipsis(src.ellipsis)
- {
- }
+ PatternAbbreviatorFragment(const PatternAbbreviatorFragment& src)
+ : charCount(src.charCount), ellipsis(src.ellipsis)
+ {
+ }
- PatternAbbreviatorFragment& operator=(const PatternAbbreviatorFragment& src)
- {
- charCount = src.charCount;
- ellipsis = src.ellipsis;
- return *this;
- }
+ PatternAbbreviatorFragment& operator=(const PatternAbbreviatorFragment& src)
+ {
+ charCount = src.charCount;
+ ellipsis = src.ellipsis;
+ return *this;
+ }
- /**
- * Abbreviate element of name.
- * @param buf buffer to receive element.
- * @param startPos starting index of name element.
- * @return starting index of next element.
- */
- LogString::size_type abbreviate(LogString& buf, LogString::size_type startPos) const
- {
- LogString::size_type nextDot = buf.find(0x2E /* '.' */, startPos);
+ /**
+ * Abbreviate element of name.
+ * @param buf buffer to receive element.
+ * @param startPos starting index of name element.
+ * @return starting index of next element.
+ */
+ LogString::size_type abbreviate(LogString& buf, LogString::size_type startPos) const
+ {
+ LogString::size_type nextDot = buf.find(0x2E /* '.' */, startPos);
- if (nextDot != LogString::npos)
- {
- if ((nextDot - startPos) > charCount)
- {
- buf.erase(buf.begin() + (startPos + charCount), buf.begin() + nextDot);
- nextDot = startPos + charCount;
+ if (nextDot != LogString::npos)
+ {
+ if ((nextDot - startPos) > charCount)
+ {
+ buf.erase(buf.begin() + (startPos + charCount), buf.begin() + nextDot);
+ nextDot = startPos + charCount;
- if (ellipsis != 0x00)
- {
- buf.insert(nextDot, 1, ellipsis);
- nextDot++;
- }
- }
+ if (ellipsis != 0x00)
+ {
+ buf.insert(nextDot, 1, ellipsis);
+ nextDot++;
+ }
+ }
- nextDot++;
- }
+ nextDot++;
+ }
- return nextDot;
- }
+ return nextDot;
+ }
};
/**
@@ -200,60 +200,60 @@
*/
class PatternAbbreviator : public NameAbbreviator
{
- /**
- * Element abbreviation patterns.
- */
- std::vector<PatternAbbreviatorFragment> fragments;
+ /**
+ * Element abbreviation patterns.
+ */
+ std::vector<PatternAbbreviatorFragment> fragments;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(PatternAbbreviator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(PatternAbbreviator)
- LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
- END_LOG4CXX_CAST_MAP()
- /**
- * Create PatternAbbreviator.
- *
- * @param fragments element abbreviation patterns.
- */
- PatternAbbreviator(const std::vector<PatternAbbreviatorFragment>& fragments1) :
- fragments(fragments1)
- {
- if (fragments1.size() == 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("fragments parameter must contain at least one element"));
- }
- }
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(PatternAbbreviator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(PatternAbbreviator)
+ LOG4CXX_CAST_ENTRY_CHAIN(NameAbbreviator)
+ END_LOG4CXX_CAST_MAP()
+ /**
+ * Create PatternAbbreviator.
+ *
+ * @param fragments element abbreviation patterns.
+ */
+ PatternAbbreviator(const std::vector<PatternAbbreviatorFragment>& fragments1) :
+ fragments(fragments1)
+ {
+ if (fragments1.size() == 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("fragments parameter must contain at least one element"));
+ }
+ }
- /**
- * Abbreviate name.
- * @param buf buffer that abbreviated name is appended.
- * @param nameStart start of name.
- */
- void abbreviate(LogString::size_type nameStart, LogString& buf) const
- {
- //
- // all non-terminal patterns are executed once
- //
- LogString::size_type pos = nameStart;
+ /**
+ * Abbreviate name.
+ * @param buf buffer that abbreviated name is appended.
+ * @param nameStart start of name.
+ */
+ void abbreviate(LogString::size_type nameStart, LogString& buf) const
+ {
+ //
+ // all non-terminal patterns are executed once
+ //
+ LogString::size_type pos = nameStart;
- for (LogString::size_type i = 0; (i < (fragments.size() - 1)) && (pos < buf.length());
- i++)
- {
- pos = fragments[i].abbreviate(buf, pos);
- }
+ for (LogString::size_type i = 0; (i < (fragments.size() - 1)) && (pos < buf.length());
+ i++)
+ {
+ pos = fragments[i].abbreviate(buf, pos);
+ }
- //
- // last pattern in executed repeatedly
- //
- PatternAbbreviatorFragment terminalFragment =
- fragments[fragments.size() - 1];
+ //
+ // last pattern in executed repeatedly
+ //
+ PatternAbbreviatorFragment terminalFragment =
+ fragments[fragments.size() - 1];
- while (pos < buf.length())
- {
- pos = terminalFragment.abbreviate(buf, pos);
- }
- }
+ while (pos < buf.length())
+ {
+ pos = terminalFragment.abbreviate(buf, pos);
+ }
+ }
};
}
}
@@ -266,93 +266,93 @@
NameAbbreviatorPtr NameAbbreviator::getAbbreviator(const LogString& pattern)
{
- if (pattern.length() > 0)
- {
- // if pattern is just spaces and numbers then
- // use MaxElementAbbreviator
- LogString trimmed(StringHelper::trim(pattern));
+ if (pattern.length() > 0)
+ {
+ // if pattern is just spaces and numbers then
+ // use MaxElementAbbreviator
+ LogString trimmed(StringHelper::trim(pattern));
- if (trimmed.length() == 0)
- {
- return getDefaultAbbreviator();
- }
+ if (trimmed.length() == 0)
+ {
+ return getDefaultAbbreviator();
+ }
- LogString::size_type i = 0;
+ LogString::size_type i = 0;
- while (
- (i < trimmed.length()) && (trimmed[i] >= 0x30 /* '0' */)
- && (trimmed[i] <= 0x39 /* '9' */))
- {
- i++;
- }
+ while (
+ (i < trimmed.length()) && (trimmed[i] >= 0x30 /* '0' */)
+ && (trimmed[i] <= 0x39 /* '9' */))
+ {
+ i++;
+ }
- //
- // if all blanks and digits
- //
- if (i == trimmed.length())
- {
- return new MaxElementAbbreviator(StringHelper::toInt(trimmed));
- }
+ //
+ // if all blanks and digits
+ //
+ if (i == trimmed.length())
+ {
+ return new MaxElementAbbreviator(StringHelper::toInt(trimmed));
+ }
- std::vector<PatternAbbreviatorFragment> fragments;
- logchar ellipsis;
- int charCount;
- LogString::size_type pos = 0;
+ std::vector<PatternAbbreviatorFragment> fragments;
+ logchar ellipsis;
+ int charCount;
+ LogString::size_type pos = 0;
- while (pos < trimmed.length())
- {
- LogString::size_type ellipsisPos = pos;
+ while (pos < trimmed.length())
+ {
+ LogString::size_type ellipsisPos = pos;
- if (trimmed[pos] == 0x2A /* '*' */)
- {
- charCount = INT_MAX;
- ellipsisPos++;
- }
- else
- {
- if ((trimmed[pos] >= 0x30 /* '0' */)
- && (trimmed[pos] <= 0x39 /* '9' */))
- {
- charCount = trimmed[pos] - 0x30 /* '0' */;
- ellipsisPos++;
- }
- else
- {
- charCount = 0;
- }
- }
+ if (trimmed[pos] == 0x2A /* '*' */)
+ {
+ charCount = INT_MAX;
+ ellipsisPos++;
+ }
+ else
+ {
+ if ((trimmed[pos] >= 0x30 /* '0' */)
+ && (trimmed[pos] <= 0x39 /* '9' */))
+ {
+ charCount = trimmed[pos] - 0x30 /* '0' */;
+ ellipsisPos++;
+ }
+ else
+ {
+ charCount = 0;
+ }
+ }
- ellipsis = 0;
+ ellipsis = 0;
- if (ellipsisPos < trimmed.length())
- {
- ellipsis = trimmed[ellipsisPos];
+ if (ellipsisPos < trimmed.length())
+ {
+ ellipsis = trimmed[ellipsisPos];
- if (ellipsis == 0x2E /* '.' */)
- {
- ellipsis = 0;
- }
- }
+ if (ellipsis == 0x2E /* '.' */)
+ {
+ ellipsis = 0;
+ }
+ }
- fragments.push_back(PatternAbbreviatorFragment(charCount, ellipsis));
- pos = trimmed.find(0x2E /* '.' */, pos);
+ fragments.push_back(PatternAbbreviatorFragment(charCount, ellipsis));
+ pos = trimmed.find(0x2E /* '.' */, pos);
- if (pos == LogString::npos)
- {
- break;
- }
+ if (pos == LogString::npos)
+ {
+ break;
+ }
- pos++;
- }
+ pos++;
+ }
- NameAbbreviatorPtr abbrev(new PatternAbbreviator(fragments));
- return abbrev;
- }
+ NameAbbreviatorPtr abbrev(new PatternAbbreviator(fragments));
+ return abbrev;
+ }
- //
- // no matching abbreviation, return defaultAbbreviator
- //
- return getDefaultAbbreviator();
+ //
+ // no matching abbreviation, return defaultAbbreviator
+ //
+ return getDefaultAbbreviator();
}
/**
@@ -362,7 +362,7 @@
*/
NameAbbreviatorPtr NameAbbreviator::getDefaultAbbreviator()
{
- static NameAbbreviatorPtr def(new NOPAbbreviator());
- return def;
+ static NameAbbreviatorPtr def(new NOPAbbreviator());
+ return def;
}
diff --git a/src/main/cpp/namepatternconverter.cpp b/src/main/cpp/namepatternconverter.cpp
index 11fa630..08ef1f2 100644
--- a/src/main/cpp/namepatternconverter.cpp
+++ b/src/main/cpp/namepatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -31,23 +31,23 @@
IMPLEMENT_LOG4CXX_OBJECT(NamePatternConverter)
NamePatternConverter::NamePatternConverter(
- const LogString& name1,
- const LogString& style1,
- const std::vector<LogString>& options) :
- LoggingEventPatternConverter(name1, style1),
- abbreviator(getAbbreviator(options))
+ const LogString& name1,
+ const LogString& style1,
+ const std::vector<LogString>& options) :
+ LoggingEventPatternConverter(name1, style1),
+ abbreviator(getAbbreviator(options))
{
}
NameAbbreviatorPtr NamePatternConverter::getAbbreviator(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() > 0)
- {
- return NameAbbreviator::getAbbreviator(options[0]);
- }
+ if (options.size() > 0)
+ {
+ return NameAbbreviator::getAbbreviator(options[0]);
+ }
- return NameAbbreviator::getDefaultAbbreviator();
+ return NameAbbreviator::getDefaultAbbreviator();
}
/**
@@ -57,5 +57,5 @@
*/
void NamePatternConverter::abbreviate(int nameStart, LogString& buf) const
{
- abbreviator->abbreviate(nameStart, buf);
+ abbreviator->abbreviate(nameStart, buf);
}
diff --git a/src/main/cpp/ndc.cpp b/src/main/cpp/ndc.cpp
index 1dec630..87dfece 100644
--- a/src/main/cpp/ndc.cpp
+++ b/src/main/cpp/ndc.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -29,277 +29,277 @@
NDC::NDC(const std::string& message)
{
- push(message);
+ push(message);
}
NDC::~NDC()
{
- pop();
+ pop();
}
LogString& NDC::getMessage(NDC::DiagnosticContext& ctx)
{
- return ctx.first;
+ return ctx.first;
}
LogString& NDC::getFullMessage(NDC::DiagnosticContext& ctx)
{
- return ctx.second;
+ return ctx.second;
}
void NDC::clear()
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- while (!stack.empty())
- {
- stack.pop();
- }
+ while (!stack.empty())
+ {
+ stack.pop();
+ }
- data->recycle();
- }
+ data->recycle();
+ }
}
NDC::Stack* NDC::cloneStack()
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- return new Stack(stack);
- }
- }
+ if (!stack.empty())
+ {
+ return new Stack(stack);
+ }
+ }
- return new Stack();
+ return new Stack();
}
void NDC::inherit(NDC::Stack* stack)
{
- if (stack != NULL)
- {
- ThreadSpecificData::inherit(*stack);
- delete stack;
- }
+ if (stack != NULL)
+ {
+ ThreadSpecificData::inherit(*stack);
+ delete stack;
+ }
}
bool NDC::get(LogString& dest)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- dest.append(getFullMessage(stack.top()));
- return true;
- }
+ if (!stack.empty())
+ {
+ dest.append(getFullMessage(stack.top()));
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
int NDC::getDepth()
{
- int size = 0;
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ int size = 0;
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- size = data->getStack().size();
+ if (data != 0)
+ {
+ size = data->getStack().size();
- if (size == 0)
- {
- data->recycle();
- }
- }
+ if (size == 0)
+ {
+ data->recycle();
+ }
+ }
- return size;
+ return size;
}
LogString NDC::pop()
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- LogString value(getMessage(stack.top()));
- stack.pop();
- data->recycle();
- return value;
- }
+ if (!stack.empty())
+ {
+ LogString value(getMessage(stack.top()));
+ stack.pop();
+ data->recycle();
+ return value;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return LogString();
+ return LogString();
}
bool NDC::pop(std::string& dst)
{
- bool retval = false;
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ bool retval = false;
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(getMessage(stack.top()), dst);
- stack.pop();
- retval = true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(getMessage(stack.top()), dst);
+ stack.pop();
+ retval = true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return retval;
+ return retval;
}
LogString NDC::peek()
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- return getMessage(stack.top());
- }
+ if (!stack.empty())
+ {
+ return getMessage(stack.top());
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return LogString();
+ return LogString();
}
bool NDC::peek(std::string& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(getMessage(stack.top()), dst);
- return true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(getMessage(stack.top()), dst);
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
void NDC::pushLS(const LogString& message)
{
- ThreadSpecificData::push(message);
+ ThreadSpecificData::push(message);
}
void NDC::push(const std::string& message)
{
- LOG4CXX_DECODE_CHAR(msg, message);
- pushLS(msg);
+ LOG4CXX_DECODE_CHAR(msg, message);
+ pushLS(msg);
}
void NDC::remove()
{
- clear();
+ clear();
}
bool NDC::empty()
{
- bool empty = true;
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ bool empty = true;
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
- empty = stack.empty();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
+ empty = stack.empty();
- if (empty)
- {
- data->recycle();
- }
- }
+ if (empty)
+ {
+ data->recycle();
+ }
+ }
- return empty;
+ return empty;
}
#if LOG4CXX_WCHAR_T_API
NDC::NDC(const std::wstring& message)
{
- push(message);
+ push(message);
}
void NDC::push(const std::wstring& message)
{
- LOG4CXX_DECODE_WCHAR(msg, message);
- pushLS(msg);
+ LOG4CXX_DECODE_WCHAR(msg, message);
+ pushLS(msg);
}
bool NDC::pop(std::wstring& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(getMessage(stack.top()), dst);
- stack.pop();
- data->recycle();
- return true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(getMessage(stack.top()), dst);
+ stack.pop();
+ data->recycle();
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
bool NDC::peek(std::wstring& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(getMessage(stack.top()), dst);
- return true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(getMessage(stack.top()), dst);
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
#endif
@@ -308,55 +308,55 @@
#if LOG4CXX_UNICHAR_API
NDC::NDC(const std::basic_string<UniChar>& message)
{
- push(message);
+ push(message);
}
void NDC::push(const std::basic_string<UniChar>& message)
{
- LOG4CXX_DECODE_UNICHAR(msg, message);
- pushLS(msg);
+ LOG4CXX_DECODE_UNICHAR(msg, message);
+ pushLS(msg);
}
bool NDC::pop(std::basic_string<UniChar>& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(stack.top().message, dst);
- stack.pop();
- data->recycle();
- return true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(stack.top().message, dst);
+ stack.pop();
+ data->recycle();
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
bool NDC::peek(std::basic_string<UniChar>& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- Transcoder::encode(stack.top().message, dst);
- return true;
- }
+ if (!stack.empty())
+ {
+ Transcoder::encode(stack.top().message, dst);
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
#endif
@@ -365,55 +365,55 @@
#if LOG4CXX_CFSTRING_API
NDC::NDC(const CFStringRef& message)
{
- push(message);
+ push(message);
}
void NDC::push(const CFStringRef& message)
{
- LOG4CXX_DECODE_CFSTRING(msg, message);
- pushLS(msg);
+ LOG4CXX_DECODE_CFSTRING(msg, message);
+ pushLS(msg);
}
bool NDC::pop(CFStringRef& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- dst = Transcoder::encode(getMessage(stack.top()));
- stack.pop();
- data->recycle();
- return true;
- }
+ if (!stack.empty())
+ {
+ dst = Transcoder::encode(getMessage(stack.top()));
+ stack.pop();
+ data->recycle();
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
bool NDC::peek(CFStringRef& dst)
{
- ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+ ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
- if (data != 0)
- {
- Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ Stack& stack = data->getStack();
- if (!stack.empty())
- {
- dst = Transcoder::encode(getMessage(stack.top()));
- return true;
- }
+ if (!stack.empty())
+ {
+ dst = Transcoder::encode(getMessage(stack.top()));
+ return true;
+ }
- data->recycle();
- }
+ data->recycle();
+ }
- return false;
+ return false;
}
#endif
diff --git a/src/main/cpp/ndcpatternconverter.cpp b/src/main/cpp/ndcpatternconverter.cpp
index 5057c66..e6acb15 100644
--- a/src/main/cpp/ndcpatternconverter.cpp
+++ b/src/main/cpp/ndcpatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -34,25 +34,25 @@
IMPLEMENT_LOG4CXX_OBJECT(NDCPatternConverter)
NDCPatternConverter::NDCPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("NDC"),
- LOG4CXX_STR("ndc"))
+ LoggingEventPatternConverter(LOG4CXX_STR("NDC"),
+ LOG4CXX_STR("ndc"))
{
}
PatternConverterPtr NDCPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr def(new NDCPatternConverter());
- return def;
+ static PatternConverterPtr def(new NDCPatternConverter());
+ return def;
}
void NDCPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- if (!event->getNDC(toAppendTo))
- {
- toAppendTo.append(LOG4CXX_STR("null"));
- }
+ if (!event->getNDC(toAppendTo))
+ {
+ toAppendTo.append(LOG4CXX_STR("null"));
+ }
}
diff --git a/src/main/cpp/nteventlogappender.cpp b/src/main/cpp/nteventlogappender.cpp
index 5bcab69..cce5f91 100644
--- a/src/main/cpp/nteventlogappender.cpp
+++ b/src/main/cpp/nteventlogappender.cpp
@@ -34,58 +34,58 @@
class CCtUserSIDHelper
{
- public:
- static bool FreeSid(SID* pSid)
- {
- return ::HeapFree(GetProcessHeap(), 0, (LPVOID)pSid) != 0;
- }
+ public:
+ static bool FreeSid(SID* pSid)
+ {
+ return ::HeapFree(GetProcessHeap(), 0, (LPVOID)pSid) != 0;
+ }
- static bool CopySid(SID * * ppDstSid, SID* pSrcSid)
- {
- bool bSuccess = false;
+ static bool CopySid(SID * * ppDstSid, SID* pSrcSid)
+ {
+ bool bSuccess = false;
- DWORD dwLength = ::GetLengthSid(pSrcSid);
- *ppDstSid = (SID*) ::HeapAlloc(GetProcessHeap(),
- HEAP_ZERO_MEMORY, dwLength);
+ DWORD dwLength = ::GetLengthSid(pSrcSid);
+ *ppDstSid = (SID*) ::HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY, dwLength);
- if (::CopySid(dwLength, *ppDstSid, pSrcSid))
- {
- bSuccess = true;
- }
- else
- {
- FreeSid(*ppDstSid);
- }
+ if (::CopySid(dwLength, *ppDstSid, pSrcSid))
+ {
+ bSuccess = true;
+ }
+ else
+ {
+ FreeSid(*ppDstSid);
+ }
- return bSuccess;
- }
+ return bSuccess;
+ }
- static bool GetCurrentUserSID(SID * * ppSid)
- {
- bool bSuccess = false;
+ static bool GetCurrentUserSID(SID * * ppSid)
+ {
+ bool bSuccess = false;
- // Pseudohandle so don't need to close it
- HANDLE hProcess = ::GetCurrentProcess();
- HANDLE hToken = NULL;
+ // Pseudohandle so don't need to close it
+ HANDLE hProcess = ::GetCurrentProcess();
+ HANDLE hToken = NULL;
- if (::OpenProcessToken(hProcess, TOKEN_QUERY, &hToken))
- {
- // Get the required size
- DWORD tusize = 0;
- GetTokenInformation(hToken, TokenUser, NULL, 0, &tusize);
- TOKEN_USER* ptu = (TOKEN_USER*)new BYTE[tusize];
+ if (::OpenProcessToken(hProcess, TOKEN_QUERY, &hToken))
+ {
+ // Get the required size
+ DWORD tusize = 0;
+ GetTokenInformation(hToken, TokenUser, NULL, 0, &tusize);
+ TOKEN_USER* ptu = (TOKEN_USER*)new BYTE[tusize];
- if (GetTokenInformation(hToken, TokenUser, (LPVOID)ptu, tusize, &tusize))
- {
- bSuccess = CopySid(ppSid, (SID*)ptu->User.Sid);
- }
+ if (GetTokenInformation(hToken, TokenUser, (LPVOID)ptu, tusize, &tusize))
+ {
+ bSuccess = CopySid(ppSid, (SID*)ptu->User.Sid);
+ }
- CloseHandle(hToken);
- delete [] ptu;
- }
+ CloseHandle(hToken);
+ delete [] ptu;
+ }
- return bSuccess;
- }
+ return bSuccess;
+ }
};
IMPLEMENT_LOG4CXX_OBJECT(NTEventLogAppender)
@@ -95,119 +95,119 @@
}
NTEventLogAppender::NTEventLogAppender(const LogString& server, const LogString& log, const LogString& source, const LayoutPtr& layout)
- : server(server), log(log), source(source), hEventLog(NULL), pCurrentUserSID(NULL)
+ : server(server), log(log), source(source), hEventLog(NULL), pCurrentUserSID(NULL)
{
- this->layout = layout;
- Pool pool;
- activateOptions(pool);
+ this->layout = layout;
+ Pool pool;
+ activateOptions(pool);
}
NTEventLogAppender::~NTEventLogAppender()
{
- finalize();
+ finalize();
}
void NTEventLogAppender::close()
{
- if (hEventLog != NULL)
- {
- ::DeregisterEventSource(hEventLog);
- hEventLog = NULL;
- }
+ if (hEventLog != NULL)
+ {
+ ::DeregisterEventSource(hEventLog);
+ hEventLog = NULL;
+ }
- if (pCurrentUserSID != NULL)
- {
- CCtUserSIDHelper::FreeSid((::SID*) pCurrentUserSID);
- pCurrentUserSID = NULL;
- }
+ if (pCurrentUserSID != NULL)
+ {
+ CCtUserSIDHelper::FreeSid((::SID*) pCurrentUserSID);
+ pCurrentUserSID = NULL;
+ }
}
void NTEventLogAppender::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SERVER"), LOG4CXX_STR("server")))
- {
- server = value;
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOG"), LOG4CXX_STR("log")))
- {
- log = value;
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SOURCE"), LOG4CXX_STR("source")))
- {
- source = value;
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SERVER"), LOG4CXX_STR("server")))
+ {
+ server = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOG"), LOG4CXX_STR("log")))
+ {
+ log = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SOURCE"), LOG4CXX_STR("source")))
+ {
+ source = value;
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void NTEventLogAppender::activateOptions(Pool&)
{
- if (source.empty())
- {
- LogLog::warn(
- ((LogString) LOG4CXX_STR("Source option not set for appender ["))
- + name + LOG4CXX_STR("]."));
- return;
- }
+ if (source.empty())
+ {
+ LogLog::warn(
+ ((LogString) LOG4CXX_STR("Source option not set for appender ["))
+ + name + LOG4CXX_STR("]."));
+ return;
+ }
- if (log.empty())
- {
- log = LOG4CXX_STR("Application");
- }
+ if (log.empty())
+ {
+ log = LOG4CXX_STR("Application");
+ }
- close();
+ close();
- // current user security identifier
- CCtUserSIDHelper::GetCurrentUserSID((::SID**) &pCurrentUserSID);
+ // current user security identifier
+ CCtUserSIDHelper::GetCurrentUserSID((::SID**) &pCurrentUserSID);
- addRegistryInfo();
+ addRegistryInfo();
- LOG4CXX_ENCODE_WCHAR(wsource, source);
- LOG4CXX_ENCODE_WCHAR(wserver, server);
- hEventLog = ::RegisterEventSourceW(
- wserver.empty() ? NULL : wserver.c_str(),
- wsource.c_str());
+ LOG4CXX_ENCODE_WCHAR(wsource, source);
+ LOG4CXX_ENCODE_WCHAR(wserver, server);
+ hEventLog = ::RegisterEventSourceW(
+ wserver.empty() ? NULL : wserver.c_str(),
+ wsource.c_str());
- if (hEventLog == NULL)
- {
- LogString msg(LOG4CXX_STR("Cannot register NT EventLog -- server: '"));
- msg.append(server);
- msg.append(LOG4CXX_STR("' source: '"));
- msg.append(source);
- LogLog::error(msg);
- LogLog::error(getErrorString(LOG4CXX_STR("RegisterEventSource")));
- }
+ if (hEventLog == NULL)
+ {
+ LogString msg(LOG4CXX_STR("Cannot register NT EventLog -- server: '"));
+ msg.append(server);
+ msg.append(LOG4CXX_STR("' source: '"));
+ msg.append(source);
+ LogLog::error(msg);
+ LogLog::error(getErrorString(LOG4CXX_STR("RegisterEventSource")));
+ }
}
void NTEventLogAppender::append(const LoggingEventPtr& event, Pool& p)
{
- if (hEventLog == NULL)
- {
- LogLog::warn(LOG4CXX_STR("NT EventLog not opened."));
- return;
- }
+ if (hEventLog == NULL)
+ {
+ LogLog::warn(LOG4CXX_STR("NT EventLog not opened."));
+ return;
+ }
- LogString oss;
- layout->format(oss, event, p);
- wchar_t* msgs = Transcoder::wencode(oss, p);
- BOOL bSuccess = ::ReportEventW(
- hEventLog,
- getEventType(event),
- getEventCategory(event),
- 0x1000,
- pCurrentUserSID,
- 1,
- 0,
- (LPCWSTR*) &msgs,
- NULL);
+ LogString oss;
+ layout->format(oss, event, p);
+ wchar_t* msgs = Transcoder::wencode(oss, p);
+ BOOL bSuccess = ::ReportEventW(
+ hEventLog,
+ getEventType(event),
+ getEventCategory(event),
+ 0x1000,
+ pCurrentUserSID,
+ 1,
+ 0,
+ (LPCWSTR*) &msgs,
+ NULL);
- if (!bSuccess)
- {
- LogLog::error(getErrorString(LOG4CXX_STR("ReportEvent")));
- }
+ if (!bSuccess)
+ {
+ LogLog::error(getErrorString(LOG4CXX_STR("ReportEvent")));
+ }
}
/*
@@ -215,129 +215,129 @@
*/
void NTEventLogAppender::addRegistryInfo()
{
- DWORD disposition = 0;
- ::HKEY hkey = 0;
- LogString subkey(LOG4CXX_STR("SYSTEM\\CurrentControlSet\\Services\\EventLog\\"));
- subkey.append(log);
- subkey.append(1, (logchar) 0x5C /* '\\' */);
- subkey.append(source);
- LOG4CXX_ENCODE_WCHAR(wsubkey, subkey);
+ DWORD disposition = 0;
+ ::HKEY hkey = 0;
+ LogString subkey(LOG4CXX_STR("SYSTEM\\CurrentControlSet\\Services\\EventLog\\"));
+ subkey.append(log);
+ subkey.append(1, (logchar) 0x5C /* '\\' */);
+ subkey.append(source);
+ LOG4CXX_ENCODE_WCHAR(wsubkey, subkey);
- long stat = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wsubkey.c_str(), 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
- &hkey, &disposition);
+ long stat = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wsubkey.c_str(), 0, NULL,
+ REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
+ &hkey, &disposition);
- if (stat == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY)
- {
- HMODULE hmodule = GetModuleHandleW(L"log4cxx");
+ if (stat == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY)
+ {
+ HMODULE hmodule = GetModuleHandleW(L"log4cxx");
- if (hmodule == NULL)
- {
- hmodule = GetModuleHandleW(0);
- }
+ if (hmodule == NULL)
+ {
+ hmodule = GetModuleHandleW(0);
+ }
- wchar_t modpath[_MAX_PATH];
- DWORD modlen = GetModuleFileNameW(hmodule, modpath, _MAX_PATH - 1);
+ wchar_t modpath[_MAX_PATH];
+ DWORD modlen = GetModuleFileNameW(hmodule, modpath, _MAX_PATH - 1);
- if (modlen > 0)
- {
- modpath[modlen] = 0;
- RegSetValueExW(hkey, L"EventMessageFile", 0, REG_SZ,
- (LPBYTE) modpath, wcslen(modpath) * sizeof(wchar_t));
- RegSetValueExW(hkey, L"CategoryMessageFile", 0, REG_SZ,
- (LPBYTE) modpath, wcslen(modpath) * sizeof(wchar_t));
- DWORD typesSupported = 7;
- DWORD categoryCount = 6;
- RegSetValueExW(hkey, L"TypesSupported", 0, REG_DWORD,
- (LPBYTE)&typesSupported, sizeof(DWORD));
- RegSetValueExW(hkey, L"CategoryCount", 0, REG_DWORD,
- (LPBYTE)&categoryCount, sizeof(DWORD));
- }
- }
+ if (modlen > 0)
+ {
+ modpath[modlen] = 0;
+ RegSetValueExW(hkey, L"EventMessageFile", 0, REG_SZ,
+ (LPBYTE) modpath, wcslen(modpath) * sizeof(wchar_t));
+ RegSetValueExW(hkey, L"CategoryMessageFile", 0, REG_SZ,
+ (LPBYTE) modpath, wcslen(modpath) * sizeof(wchar_t));
+ DWORD typesSupported = 7;
+ DWORD categoryCount = 6;
+ RegSetValueExW(hkey, L"TypesSupported", 0, REG_DWORD,
+ (LPBYTE)&typesSupported, sizeof(DWORD));
+ RegSetValueExW(hkey, L"CategoryCount", 0, REG_DWORD,
+ (LPBYTE)&categoryCount, sizeof(DWORD));
+ }
+ }
- RegCloseKey(hkey);
- return;
+ RegCloseKey(hkey);
+ return;
}
WORD NTEventLogAppender::getEventType(const LoggingEventPtr& event)
{
- int priority = event->getLevel()->toInt();
- WORD type = EVENTLOG_SUCCESS;
+ int priority = event->getLevel()->toInt();
+ WORD type = EVENTLOG_SUCCESS;
- if (priority >= Level::INFO_INT)
- {
- type = EVENTLOG_INFORMATION_TYPE;
+ if (priority >= Level::INFO_INT)
+ {
+ type = EVENTLOG_INFORMATION_TYPE;
- if (priority >= Level::WARN_INT)
- {
- type = EVENTLOG_WARNING_TYPE;
+ if (priority >= Level::WARN_INT)
+ {
+ type = EVENTLOG_WARNING_TYPE;
- if (priority >= Level::ERROR_INT)
- {
- type = EVENTLOG_ERROR_TYPE;
- }
- }
- }
+ if (priority >= Level::ERROR_INT)
+ {
+ type = EVENTLOG_ERROR_TYPE;
+ }
+ }
+ }
- return type;
+ return type;
}
WORD NTEventLogAppender::getEventCategory(const LoggingEventPtr& event)
{
- int priority = event->getLevel()->toInt();
- WORD category = 1;
+ int priority = event->getLevel()->toInt();
+ WORD category = 1;
- if (priority >= Level::DEBUG_INT)
- {
- category = 2;
+ if (priority >= Level::DEBUG_INT)
+ {
+ category = 2;
- if (priority >= Level::INFO_INT)
- {
- category = 3;
+ if (priority >= Level::INFO_INT)
+ {
+ category = 3;
- if (priority >= Level::WARN_INT)
- {
- category = 4;
+ if (priority >= Level::WARN_INT)
+ {
+ category = 4;
- if (priority >= Level::ERROR_INT)
- {
- category = 5;
+ if (priority >= Level::ERROR_INT)
+ {
+ category = 5;
- if (priority >= Level::FATAL_INT)
- {
- category = 6;
- }
- }
- }
- }
- }
+ if (priority >= Level::FATAL_INT)
+ {
+ category = 6;
+ }
+ }
+ }
+ }
+ }
- return category;
+ return category;
}
LogString NTEventLogAppender::getErrorString(const LogString& function)
{
- Pool p;
- enum { MSGSIZE = 5000 };
+ Pool p;
+ enum { MSGSIZE = 5000 };
- wchar_t* lpMsgBuf = (wchar_t*) p.palloc(MSGSIZE * sizeof(wchar_t));
- DWORD dw = GetLastError();
+ wchar_t* lpMsgBuf = (wchar_t*) p.palloc(MSGSIZE * sizeof(wchar_t));
+ DWORD dw = GetLastError();
- FormatMessageW(
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- dw,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- lpMsgBuf,
- MSGSIZE, NULL );
+ FormatMessageW(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ dw,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ lpMsgBuf,
+ MSGSIZE, NULL );
- LogString msg(function);
- msg.append(LOG4CXX_STR(" failed with error "));
- StringHelper::toString((size_t) dw, p, msg);
- msg.append(LOG4CXX_STR(": "));
- Transcoder::decode(lpMsgBuf, msg);
+ LogString msg(function);
+ msg.append(LOG4CXX_STR(" failed with error "));
+ StringHelper::toString((size_t) dw, p, msg);
+ msg.append(LOG4CXX_STR(": "));
+ Transcoder::decode(lpMsgBuf, msg);
- return msg;
+ return msg;
}
#endif // WIN32
diff --git a/src/main/cpp/objectimpl.cpp b/src/main/cpp/objectimpl.cpp
index bc2e978..47515a4 100644
--- a/src/main/cpp/objectimpl.cpp
+++ b/src/main/cpp/objectimpl.cpp
@@ -19,7 +19,7 @@
#include <log4cxx/helpers/objectimpl.h>
#include <apr_atomic.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -27,7 +27,7 @@
ObjectImpl::ObjectImpl() : ref( 0 )
{
- log4cxx::helpers::APRInitializer::initialize();
+ log4cxx::helpers::APRInitializer::initialize();
}
ObjectImpl::~ObjectImpl()
@@ -36,13 +36,13 @@
void ObjectImpl::addRef() const
{
- apr_atomic_inc32( & ref );
+ apr_atomic_inc32( & ref );
}
void ObjectImpl::releaseRef() const
{
- if ( apr_atomic_dec32( & ref ) == 0 )
- {
- delete this;
- }
+ if ( apr_atomic_dec32( & ref ) == 0 )
+ {
+ delete this;
+ }
}
diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
index e119569..017ad12 100644
--- a/src/main/cpp/objectoutputstream.cpp
+++ b/src/main/cpp/objectoutputstream.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -31,209 +31,209 @@
IMPLEMENT_LOG4CXX_OBJECT(ObjectOutputStream)
ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
- : os(outputStream),
- utf8Encoder(CharsetEncoder::getUTF8Encoder()),
- objectHandleDefault(0x7E0000),
- objectHandle(objectHandleDefault),
- classDescriptions(new ClassDescriptionMap())
+ : os(outputStream),
+ utf8Encoder(CharsetEncoder::getUTF8Encoder()),
+ objectHandleDefault(0x7E0000),
+ objectHandle(objectHandleDefault),
+ classDescriptions(new ClassDescriptionMap())
{
- unsigned char start[] = { 0xAC, 0xED, 0x00, 0x05 };
- ByteBuffer buf((char*) start, sizeof(start));
- os->write(buf, p);
+ unsigned char start[] = { 0xAC, 0xED, 0x00, 0x05 };
+ ByteBuffer buf((char*) start, sizeof(start));
+ os->write(buf, p);
}
ObjectOutputStream::~ObjectOutputStream()
{
- delete classDescriptions;
+ delete classDescriptions;
}
void ObjectOutputStream::close(Pool& p)
{
- os->close(p);
+ os->close(p);
}
void ObjectOutputStream::flush(Pool& p)
{
- os->flush(p);
+ os->flush(p);
}
void ObjectOutputStream::reset(Pool& p)
{
- os->flush(p);
- writeByte(TC_RESET, p);
- os->flush(p);
+ os->flush(p);
+ writeByte(TC_RESET, p);
+ os->flush(p);
- objectHandle = objectHandleDefault;
- classDescriptions->clear();
+ objectHandle = objectHandleDefault;
+ classDescriptions->clear();
}
void ObjectOutputStream::writeObject(const LogString& val, Pool& p)
{
- objectHandle++;
- writeByte(TC_STRING, p);
- char bytes[2];
+ objectHandle++;
+ writeByte(TC_STRING, p);
+ char bytes[2];
#if LOG4CXX_LOGCHAR_IS_UTF8
- size_t len = val.size();
- ByteBuffer dataBuf(const_cast<char*>(val.data()), val.size());
+ size_t len = val.size();
+ ByteBuffer dataBuf(const_cast<char*>(val.data()), val.size());
#else
- size_t maxSize = 6 * val.size();
- char* data = p.pstralloc(maxSize);
- ByteBuffer dataBuf(data, maxSize);
- LogString::const_iterator iter(val.begin());
- utf8Encoder->encode(val, iter, dataBuf);
- dataBuf.flip();
- size_t len = dataBuf.limit();
+ size_t maxSize = 6 * val.size();
+ char* data = p.pstralloc(maxSize);
+ ByteBuffer dataBuf(data, maxSize);
+ LogString::const_iterator iter(val.begin());
+ utf8Encoder->encode(val, iter, dataBuf);
+ dataBuf.flip();
+ size_t len = dataBuf.limit();
#endif
- bytes[1] = (char) (len & 0xFF);
- bytes[0] = (char) ((len >> 8) & 0xFF);
- ByteBuffer lenBuf(bytes, sizeof(bytes));
+ bytes[1] = (char) (len & 0xFF);
+ bytes[0] = (char) ((len >> 8) & 0xFF);
+ ByteBuffer lenBuf(bytes, sizeof(bytes));
- os->write(lenBuf, p);
- os->write(dataBuf, p);
+ os->write(lenBuf, p);
+ os->write(dataBuf, p);
}
void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p)
{
- //
- // TC_OBJECT and the classDesc for java.util.Hashtable
- //
- unsigned char prolog[] =
- {
- 0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
- 0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
- 0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
- 0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
- 0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61,
- 0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
- 0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
- 0x6F, 0x6C, 0x64, 0x78, 0x70
- };
- writeProlog("java.util.Hashtable", 1, (char*) prolog, sizeof(prolog), p);
+ //
+ // TC_OBJECT and the classDesc for java.util.Hashtable
+ //
+ unsigned char prolog[] =
+ {
+ 0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
+ 0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
+ 0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
+ 0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
+ 0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61,
+ 0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
+ 0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
+ 0x6F, 0x6C, 0x64, 0x78, 0x70
+ };
+ writeProlog("java.util.Hashtable", 1, (char*) prolog, sizeof(prolog), p);
- // loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
- char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
- TC_BLOCKDATA, 0x08, 0x00, 0x00, 0x00, 0x07
- };
- ByteBuffer dataBuf(data, sizeof(data));
- os->write(dataBuf, p);
+ // loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
+ char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+ TC_BLOCKDATA, 0x08, 0x00, 0x00, 0x00, 0x07
+ };
+ ByteBuffer dataBuf(data, sizeof(data));
+ os->write(dataBuf, p);
- char size[4];
- size_t sz = val.size();
+ char size[4];
+ size_t sz = val.size();
- size[3] = (char) (sz & 0xFF);
- size[2] = (char) ((sz >> 8) & 0xFF);
- size[1] = (char) ((sz >> 16) & 0xFF);
- size[0] = (char) ((sz >> 24) & 0xFF);
+ size[3] = (char) (sz & 0xFF);
+ size[2] = (char) ((sz >> 8) & 0xFF);
+ size[1] = (char) ((sz >> 16) & 0xFF);
+ size[0] = (char) ((sz >> 24) & 0xFF);
- ByteBuffer sizeBuf(size, sizeof(size));
- os->write(sizeBuf, p);
+ ByteBuffer sizeBuf(size, sizeof(size));
+ os->write(sizeBuf, p);
- for (MDC::Map::const_iterator iter = val.begin();
- iter != val.end();
- iter++)
- {
- writeObject(iter->first, p);
- writeObject(iter->second, p);
- }
+ for (MDC::Map::const_iterator iter = val.begin();
+ iter != val.end();
+ iter++)
+ {
+ writeObject(iter->first, p);
+ writeObject(iter->second, p);
+ }
- writeByte(TC_ENDBLOCKDATA, p);
+ writeByte(TC_ENDBLOCKDATA, p);
}
void ObjectOutputStream::writeUTFString(const std::string& val, Pool& p)
{
- char bytes[3];
- size_t len = val.size();
- ByteBuffer dataBuf(const_cast<char*>(val.data()), val.size());
- objectHandle++;
+ char bytes[3];
+ size_t len = val.size();
+ ByteBuffer dataBuf(const_cast<char*>(val.data()), val.size());
+ objectHandle++;
- bytes[0] = 0x74;
- bytes[1] = (char) ((len >> 8) & 0xFF);
- bytes[2] = (char) (len & 0xFF);
+ bytes[0] = 0x74;
+ bytes[1] = (char) ((len >> 8) & 0xFF);
+ bytes[2] = (char) (len & 0xFF);
- ByteBuffer lenBuf(bytes, sizeof(bytes));
- os->write(lenBuf, p);
- os->write(dataBuf, p);
+ ByteBuffer lenBuf(bytes, sizeof(bytes));
+ os->write(lenBuf, p);
+ os->write(dataBuf, p);
}
void ObjectOutputStream::writeByte(char val, Pool& p)
{
- ByteBuffer buf(&val, 1);
- os->write(buf, p);
+ ByteBuffer buf(&val, 1);
+ os->write(buf, p);
}
void ObjectOutputStream::writeInt(int val, Pool& p)
{
- char bytes[4];
+ char bytes[4];
- bytes[3] = (char) (val & 0xFF);
- bytes[2] = (char) ((val >> 8) & 0xFF);
- bytes[1] = (char) ((val >> 16) & 0xFF);
- bytes[0] = (char) ((val >> 24) & 0xFF);
+ bytes[3] = (char) (val & 0xFF);
+ bytes[2] = (char) ((val >> 8) & 0xFF);
+ bytes[1] = (char) ((val >> 16) & 0xFF);
+ bytes[0] = (char) ((val >> 24) & 0xFF);
- ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ ByteBuffer buf(bytes, sizeof(bytes));
+ os->write(buf, p);
}
void ObjectOutputStream::writeLong(log4cxx_time_t val, Pool& p)
{
- char bytes[8];
+ char bytes[8];
- bytes[7] = (char) (val & 0xFF);
- bytes[6] = (char) ((val >> 8) & 0xFF);
- bytes[5] = (char) ((val >> 16) & 0xFF);
- bytes[4] = (char) ((val >> 24) & 0xFF);
- bytes[3] = (char) ((val >> 32) & 0xFF);
- bytes[2] = (char) ((val >> 40) & 0xFF);
- bytes[1] = (char) ((val >> 48) & 0xFF);
- bytes[0] = (char) ((val >> 56) & 0xFF);
+ bytes[7] = (char) (val & 0xFF);
+ bytes[6] = (char) ((val >> 8) & 0xFF);
+ bytes[5] = (char) ((val >> 16) & 0xFF);
+ bytes[4] = (char) ((val >> 24) & 0xFF);
+ bytes[3] = (char) ((val >> 32) & 0xFF);
+ bytes[2] = (char) ((val >> 40) & 0xFF);
+ bytes[1] = (char) ((val >> 48) & 0xFF);
+ bytes[0] = (char) ((val >> 56) & 0xFF);
- ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ ByteBuffer buf(bytes, sizeof(bytes));
+ os->write(buf, p);
}
void ObjectOutputStream::writeBytes(const char* bytes, size_t len, Pool& p)
{
- ByteBuffer buf(const_cast<char*>(bytes), len);
- os->write(buf, p);
+ ByteBuffer buf(const_cast<char*>(bytes), len);
+ os->write(buf, p);
}
void ObjectOutputStream::writeNull(Pool& p)
{
- writeByte(TC_NULL, p);
+ writeByte(TC_NULL, p);
}
void ObjectOutputStream::writeProlog(const char* className,
- int classDescIncrement,
- char* classDesc,
- size_t len,
- Pool& p)
+ int classDescIncrement,
+ char* classDesc,
+ size_t len,
+ Pool& p)
{
- ClassDescriptionMap::const_iterator match = classDescriptions->find(className);
+ ClassDescriptionMap::const_iterator match = classDescriptions->find(className);
- if (match != classDescriptions->end())
- {
- char bytes[6];
+ if (match != classDescriptions->end())
+ {
+ char bytes[6];
- bytes[0] = TC_OBJECT;
- bytes[1] = TC_REFERENCE;
- bytes[2] = (char) ((match->second >> 24) & 0xFF);
- bytes[3] = (char) ((match->second >> 16) & 0xFF);
- bytes[4] = (char) ((match->second >> 8) & 0xFF);
- bytes[5] = (char) (match->second & 0xFF);
+ bytes[0] = TC_OBJECT;
+ bytes[1] = TC_REFERENCE;
+ bytes[2] = (char) ((match->second >> 24) & 0xFF);
+ bytes[3] = (char) ((match->second >> 16) & 0xFF);
+ bytes[4] = (char) ((match->second >> 8) & 0xFF);
+ bytes[5] = (char) (match->second & 0xFF);
- ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ ByteBuffer buf(bytes, sizeof(bytes));
+ os->write(buf, p);
- objectHandle++;
- }
- else
- {
- classDescriptions->insert(ClassDescriptionMap::value_type(className, objectHandle));
- writeByte(TC_OBJECT, p);
+ objectHandle++;
+ }
+ else
+ {
+ classDescriptions->insert(ClassDescriptionMap::value_type(className, objectHandle));
+ writeByte(TC_OBJECT, p);
- ByteBuffer buf(classDesc, len);
- os->write(buf, p);
+ ByteBuffer buf(classDesc, len);
+ os->write(buf, p);
- objectHandle += (classDescIncrement + 1);
- }
+ objectHandle += (classDescIncrement + 1);
+ }
}
diff --git a/src/main/cpp/objectptr.cpp b/src/main/cpp/objectptr.cpp
index bc3e8b9..09e57e4 100644
--- a/src/main/cpp/objectptr.cpp
+++ b/src/main/cpp/objectptr.cpp
@@ -31,22 +31,22 @@
void ObjectPtrBase::checkNull(const int& null)
{
- if (null != 0)
- {
- throw IllegalArgumentException(LOG4CXX_STR("Attempt to set pointer to a non-zero numeric value."));
- }
+ if (null != 0)
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("Attempt to set pointer to a non-zero numeric value."));
+ }
}
void* ObjectPtrBase::exchange(void** destination, void* newValue)
{
#if _WIN32 && (!defined(_MSC_VER) || _MSC_VER >= 1300)
- return InterlockedExchangePointer(destination, newValue);
+ return InterlockedExchangePointer(destination, newValue);
#elif APR_SIZEOF_VOIDP == 4
- return (void*) apr_atomic_xchg32((volatile apr_uint32_t*) destination,
- (apr_uint32_t) newValue);
+ return (void*) apr_atomic_xchg32((volatile apr_uint32_t*) destination,
+ (apr_uint32_t) newValue);
#else
- void* oldValue = *destination;
- *destination = newValue;
- return oldValue;
+ void* oldValue = *destination;
+ *destination = newValue;
+ return oldValue;
#endif
}
diff --git a/src/main/cpp/obsoleterollingfileappender.cpp b/src/main/cpp/obsoleterollingfileappender.cpp
index 2e48008..f069115 100644
--- a/src/main/cpp/obsoleterollingfileappender.cpp
+++ b/src/main/cpp/obsoleterollingfileappender.cpp
@@ -33,70 +33,70 @@
{
class ClassRollingFileAppender : public Class
{
- public:
- ClassRollingFileAppender() : helpers::Class() {}
- virtual LogString getName() const
- {
- return LOG4CXX_STR("org.apache.log4j.RollingFileAppender");
- }
- virtual ObjectPtr newInstance() const
- {
- return new RollingFileAppender();
- }
+ public:
+ ClassRollingFileAppender() : helpers::Class() {}
+ virtual LogString getName() const
+ {
+ return LOG4CXX_STR("org.apache.log4j.RollingFileAppender");
+ }
+ virtual ObjectPtr newInstance() const
+ {
+ return new RollingFileAppender();
+ }
};
}
const log4cxx::helpers::Class& RollingFileAppender::getClass() const
{
- return getStaticClass();
+ return getStaticClass();
}
const log4cxx::helpers::Class& RollingFileAppender::getStaticClass()
{
- static ClassRollingFileAppender theClass;
- return theClass;
+ static ClassRollingFileAppender theClass;
+ return theClass;
}
const log4cxx::helpers::ClassRegistration& RollingFileAppender::registerClass()
{
- static log4cxx::helpers::ClassRegistration classReg(RollingFileAppender::getStaticClass);
- return classReg;
+ static log4cxx::helpers::ClassRegistration classReg(RollingFileAppender::getStaticClass);
+ return classReg;
}
namespace log4cxx
{
namespace classes
{
const log4cxx::helpers::ClassRegistration& ObsoleteRollingFileAppenderRegistration =
- RollingFileAppender::registerClass();
+ RollingFileAppender::registerClass();
}
}
RollingFileAppender::RollingFileAppender()
- : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
+ : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
{
}
RollingFileAppender::RollingFileAppender(
- const LayoutPtr& newLayout,
- const LogString& filename,
- bool append)
- : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
+ const LayoutPtr& newLayout,
+ const LogString& filename,
+ bool append)
+ : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
{
- setLayout(newLayout);
- setFile(filename);
- setAppend(append);
- Pool p;
- activateOptions(p);
+ setLayout(newLayout);
+ setFile(filename);
+ setAppend(append);
+ Pool p;
+ activateOptions(p);
}
RollingFileAppender::RollingFileAppender(const LayoutPtr& newLayout,
- const LogString& filename)
- : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
+ const LogString& filename)
+ : maxFileSize(10 * 1024 * 1024), maxBackupIndex(1)
{
- setLayout(newLayout);
- setFile(filename);
- Pool p;
- activateOptions(p);
+ setLayout(newLayout);
+ setFile(filename);
+ Pool p;
+ activateOptions(p);
}
RollingFileAppender::~RollingFileAppender()
@@ -105,73 +105,73 @@
void RollingFileAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXFILESIZE"), LOG4CXX_STR("maxfilesize"))
- || StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXIMUMFILESIZE"), LOG4CXX_STR("maximumfilesize")))
- {
- setMaxFileSize(value);
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXBACKUPINDEX"), LOG4CXX_STR("maxbackupindex"))
- || StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXIMUMBACKUPINDEX"), LOG4CXX_STR("maximumbackupindex")))
- {
- maxBackupIndex = StringHelper::toInt(value);
- }
- else
- {
- using namespace log4cxx::rolling;
- RollingFileAppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXFILESIZE"), LOG4CXX_STR("maxfilesize"))
+ || StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXIMUMFILESIZE"), LOG4CXX_STR("maximumfilesize")))
+ {
+ setMaxFileSize(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXBACKUPINDEX"), LOG4CXX_STR("maxbackupindex"))
+ || StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXIMUMBACKUPINDEX"), LOG4CXX_STR("maximumbackupindex")))
+ {
+ maxBackupIndex = StringHelper::toInt(value);
+ }
+ else
+ {
+ using namespace log4cxx::rolling;
+ RollingFileAppenderSkeleton::setOption(option, value);
+ }
}
int RollingFileAppender::getMaxBackupIndex() const
{
- return maxBackupIndex;
+ return maxBackupIndex;
}
long RollingFileAppender::getMaximumFileSize() const
{
- return maxFileSize;
+ return maxFileSize;
}
void RollingFileAppender::setMaxBackupIndex(int maxBackups)
{
- maxBackupIndex = maxBackups;
+ maxBackupIndex = maxBackups;
}
void RollingFileAppender::setMaximumFileSize(int maxFileSize1)
{
- maxFileSize = maxFileSize1;
+ maxFileSize = maxFileSize1;
}
void RollingFileAppender::setMaxFileSize(const LogString& value)
{
- maxFileSize = OptionConverter::toFileSize(value, maxFileSize + 1);
+ maxFileSize = OptionConverter::toFileSize(value, maxFileSize + 1);
}
void RollingFileAppender::activateOptions(Pool& p)
{
- log4cxx::rolling::SizeBasedTriggeringPolicyPtr trigger(
- new log4cxx::rolling::SizeBasedTriggeringPolicy());
- trigger->setMaxFileSize(maxFileSize);
- trigger->activateOptions(p);
- setTriggeringPolicy(trigger);
+ log4cxx::rolling::SizeBasedTriggeringPolicyPtr trigger(
+ new log4cxx::rolling::SizeBasedTriggeringPolicy());
+ trigger->setMaxFileSize(maxFileSize);
+ trigger->activateOptions(p);
+ setTriggeringPolicy(trigger);
- log4cxx::rolling::FixedWindowRollingPolicyPtr rolling(
- new log4cxx::rolling::FixedWindowRollingPolicy());
- rolling->setMinIndex(1);
- rolling->setMaxIndex(maxBackupIndex);
- rolling->setFileNamePattern(getFile() + LOG4CXX_STR(".%i"));
- rolling->activateOptions(p);
- setRollingPolicy(rolling);
+ log4cxx::rolling::FixedWindowRollingPolicyPtr rolling(
+ new log4cxx::rolling::FixedWindowRollingPolicy());
+ rolling->setMinIndex(1);
+ rolling->setMaxIndex(maxBackupIndex);
+ rolling->setFileNamePattern(getFile() + LOG4CXX_STR(".%i"));
+ rolling->activateOptions(p);
+ setRollingPolicy(rolling);
- using namespace log4cxx::rolling;
- RollingFileAppenderSkeleton::activateOptions(p);
+ using namespace log4cxx::rolling;
+ RollingFileAppenderSkeleton::activateOptions(p);
}
diff --git a/src/main/cpp/odbcappender.cpp b/src/main/cpp/odbcappender.cpp
index a739d33..7832762 100644
--- a/src/main/cpp/odbcappender.cpp
+++ b/src/main/cpp/odbcappender.cpp
@@ -23,14 +23,14 @@
#include <apr_strings.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#if LOG4CXX_HAVE_ODBC
- #if defined(WIN32) || defined(_WIN32)
- #include <windows.h>
- #endif
- #include <sqlext.h>
+ #if defined(WIN32) || defined(_WIN32)
+ #include <windows.h>
+ #endif
+ #include <sqlext.h>
#endif
@@ -40,51 +40,51 @@
using namespace log4cxx::spi;
SQLException::SQLException(short fHandleType,
- void* hInput, const char* prolog,
- log4cxx::helpers::Pool& p)
- : Exception(formatMessage(fHandleType, hInput, prolog, p))
+ void* hInput, const char* prolog,
+ log4cxx::helpers::Pool& p)
+ : Exception(formatMessage(fHandleType, hInput, prolog, p))
{
}
SQLException::SQLException(const char* msg)
- : Exception(msg)
+ : Exception(msg)
{
}
SQLException::SQLException(const SQLException& src)
- : Exception(src)
+ : Exception(src)
{
}
const char* SQLException::formatMessage(short fHandleType,
- void* hInput, const char* prolog, log4cxx::helpers::Pool& p)
+ void* hInput, const char* prolog, log4cxx::helpers::Pool& p)
{
- std::string strReturn(prolog);
- strReturn.append(" - ");
+ std::string strReturn(prolog);
+ strReturn.append(" - ");
#if LOG4CXX_HAVE_ODBC
- SQLCHAR SqlState[6];
- SQLCHAR Msg[SQL_MAX_MESSAGE_LENGTH];
- SQLINTEGER NativeError;
- SQLSMALLINT i;
- SQLSMALLINT MsgLen;
- SQLRETURN rc2;
+ SQLCHAR SqlState[6];
+ SQLCHAR Msg[SQL_MAX_MESSAGE_LENGTH];
+ SQLINTEGER NativeError;
+ SQLSMALLINT i;
+ SQLSMALLINT MsgLen;
+ SQLRETURN rc2;
- // Get the status records.
- i = 1;
+ // Get the status records.
+ i = 1;
- while ((rc2 = SQLGetDiagRecA(fHandleType, hInput, i, SqlState, &NativeError,
- Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA)
- {
- strReturn.append((char*) Msg);
- i++;
- }
+ while ((rc2 = SQLGetDiagRecA(fHandleType, hInput, i, SqlState, &NativeError,
+ Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA)
+ {
+ strReturn.append((char*) Msg);
+ i++;
+ }
#else
- strReturn.append("log4cxx built without ODBC support");
+ strReturn.append("log4cxx built without ODBC support");
#endif
- return apr_pstrdup((apr_pool_t*) p.getAPRPool(), strReturn.c_str());
+ return apr_pstrdup((apr_pool_t*) p.getAPRPool(), strReturn.c_str());
}
@@ -93,49 +93,49 @@
ODBCAppender::ODBCAppender()
- : connection(0), env(0), bufferSize(1)
+ : connection(0), env(0), bufferSize(1)
{
}
ODBCAppender::~ODBCAppender()
{
- finalize();
+ finalize();
}
void ODBCAppender::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- setBufferSize((size_t)OptionConverter::toInt(value, 1));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PASSWORD"), LOG4CXX_STR("password")))
- {
- setPassword(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SQL"), LOG4CXX_STR("sql")))
- {
- setSql(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("URL"), LOG4CXX_STR("url"))
- || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("DSN"), LOG4CXX_STR("dsn"))
- || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("CONNECTIONSTRING"), LOG4CXX_STR("connectionstring")) )
- {
- setURL(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("USER"), LOG4CXX_STR("user")))
- {
- setUser(value);
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ setBufferSize((size_t)OptionConverter::toInt(value, 1));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PASSWORD"), LOG4CXX_STR("password")))
+ {
+ setPassword(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SQL"), LOG4CXX_STR("sql")))
+ {
+ setSql(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("URL"), LOG4CXX_STR("url"))
+ || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("DSN"), LOG4CXX_STR("dsn"))
+ || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("CONNECTIONSTRING"), LOG4CXX_STR("connectionstring")) )
+ {
+ setURL(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("USER"), LOG4CXX_STR("user")))
+ {
+ setUser(value);
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void ODBCAppender::activateOptions(log4cxx::helpers::Pool&)
{
#if !LOG4CXX_HAVE_ODBC
- LogLog::error(LOG4CXX_STR("Can not activate ODBCAppender unless compiled with ODBC support."));
+ LogLog::error(LOG4CXX_STR("Can not activate ODBCAppender unless compiled with ODBC support."));
#endif
}
@@ -143,64 +143,64 @@
void ODBCAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p)
{
#if LOG4CXX_HAVE_ODBC
- buffer.push_back(event);
+ buffer.push_back(event);
- if (buffer.size() >= bufferSize)
- {
- flushBuffer(p);
- }
+ if (buffer.size() >= bufferSize)
+ {
+ flushBuffer(p);
+ }
#endif
}
LogString ODBCAppender::getLogStatement(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const
{
- LogString sbuf;
- getLayout()->format(sbuf, event, p);
- return sbuf;
+ LogString sbuf;
+ getLayout()->format(sbuf, event, p);
+ return sbuf;
}
void ODBCAppender::execute(const LogString& sql, log4cxx::helpers::Pool& p)
{
#if LOG4CXX_HAVE_ODBC
- SQLRETURN ret;
- SQLHDBC con = SQL_NULL_HDBC;
- SQLHSTMT stmt = SQL_NULL_HSTMT;
+ SQLRETURN ret;
+ SQLHDBC con = SQL_NULL_HDBC;
+ SQLHSTMT stmt = SQL_NULL_HSTMT;
- try
- {
- con = getConnection(p);
+ try
+ {
+ con = getConnection(p);
- ret = SQLAllocHandle( SQL_HANDLE_STMT, con, &stmt);
+ ret = SQLAllocHandle( SQL_HANDLE_STMT, con, &stmt);
- if (ret < 0)
- {
- throw SQLException( SQL_HANDLE_DBC, con, "Failed to allocate sql handle.", p);
- }
+ if (ret < 0)
+ {
+ throw SQLException( SQL_HANDLE_DBC, con, "Failed to allocate sql handle.", p);
+ }
- SQLWCHAR* wsql;
- encode(&wsql, sql, p);
- ret = SQLExecDirectW(stmt, wsql, SQL_NTS);
+ SQLWCHAR* wsql;
+ encode(&wsql, sql, p);
+ ret = SQLExecDirectW(stmt, wsql, SQL_NTS);
- if (ret < 0)
- {
- throw SQLException(SQL_HANDLE_STMT, stmt, "Failed to execute sql statement.", p);
- }
- }
- catch (SQLException& e)
- {
- if (stmt != SQL_NULL_HSTMT)
- {
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- }
+ if (ret < 0)
+ {
+ throw SQLException(SQL_HANDLE_STMT, stmt, "Failed to execute sql statement.", p);
+ }
+ }
+ catch (SQLException& e)
+ {
+ if (stmt != SQL_NULL_HSTMT)
+ {
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ }
- throw;
- }
+ throw;
+ }
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- closeConnection(con);
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ closeConnection(con);
#else
- throw SQLException("log4cxx build without ODBC support");
+ throw SQLException("log4cxx build without ODBC support");
#endif
}
@@ -217,179 +217,179 @@
ODBCAppender::SQLHDBC ODBCAppender::getConnection(log4cxx::helpers::Pool& p)
{
#if LOG4CXX_HAVE_ODBC
- SQLRETURN ret;
+ SQLRETURN ret;
- if (env == SQL_NULL_HENV)
- {
- ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+ if (env == SQL_NULL_HENV)
+ {
+ ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
- if (ret < 0)
- {
- SQLException ex(SQL_HANDLE_ENV, env, "Failed to allocate SQL handle.", p);
- env = SQL_NULL_HENV;
- throw ex;
- }
+ if (ret < 0)
+ {
+ SQLException ex(SQL_HANDLE_ENV, env, "Failed to allocate SQL handle.", p);
+ env = SQL_NULL_HENV;
+ throw ex;
+ }
- ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
+ ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
- if (ret < 0)
- {
- SQLException ex(SQL_HANDLE_ENV, env, "Failed to set odbc version.", p);
- SQLFreeHandle(SQL_HANDLE_ENV, env);
- env = SQL_NULL_HENV;
- throw ex;
- }
- }
+ if (ret < 0)
+ {
+ SQLException ex(SQL_HANDLE_ENV, env, "Failed to set odbc version.", p);
+ SQLFreeHandle(SQL_HANDLE_ENV, env);
+ env = SQL_NULL_HENV;
+ throw ex;
+ }
+ }
- if (connection == SQL_NULL_HDBC)
- {
- ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &connection);
+ if (connection == SQL_NULL_HDBC)
+ {
+ ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &connection);
- if (ret < 0)
- {
- SQLException ex(SQL_HANDLE_DBC, connection, "Failed to allocate sql handle.", p);
- connection = SQL_NULL_HDBC;
- throw ex;
- }
+ if (ret < 0)
+ {
+ SQLException ex(SQL_HANDLE_DBC, connection, "Failed to allocate sql handle.", p);
+ connection = SQL_NULL_HDBC;
+ throw ex;
+ }
- SQLWCHAR* wURL, *wUser, *wPwd;
- encode(&wURL, databaseURL, p);
- encode(&wUser, databaseUser, p);
- encode(&wPwd, databasePassword, p);
+ SQLWCHAR* wURL, *wUser, *wPwd;
+ encode(&wURL, databaseURL, p);
+ encode(&wUser, databaseUser, p);
+ encode(&wPwd, databasePassword, p);
- ret = SQLConnectW( connection,
- wURL, SQL_NTS,
- wUser, SQL_NTS,
- wPwd, SQL_NTS);
+ ret = SQLConnectW( connection,
+ wURL, SQL_NTS,
+ wUser, SQL_NTS,
+ wPwd, SQL_NTS);
- if (ret < 0)
- {
- SQLException ex(SQL_HANDLE_DBC, connection, "Failed to connect to database.", p);
- SQLFreeHandle(SQL_HANDLE_DBC, connection);
- connection = SQL_NULL_HDBC;
- throw ex;
- }
- }
+ if (ret < 0)
+ {
+ SQLException ex(SQL_HANDLE_DBC, connection, "Failed to connect to database.", p);
+ SQLFreeHandle(SQL_HANDLE_DBC, connection);
+ connection = SQL_NULL_HDBC;
+ throw ex;
+ }
+ }
- return connection;
+ return connection;
#else
- return 0;
+ return 0;
#endif
}
void ODBCAppender::close()
{
- if (closed)
- {
- return;
- }
+ if (closed)
+ {
+ return;
+ }
- Pool p;
+ Pool p;
- try
- {
- flushBuffer(p);
- }
- catch (SQLException& e)
- {
- errorHandler->error(LOG4CXX_STR("Error closing connection"),
- e, ErrorCode::GENERIC_FAILURE);
- }
+ try
+ {
+ flushBuffer(p);
+ }
+ catch (SQLException& e)
+ {
+ errorHandler->error(LOG4CXX_STR("Error closing connection"),
+ e, ErrorCode::GENERIC_FAILURE);
+ }
#if LOG4CXX_HAVE_ODBC
- if (connection != SQL_NULL_HDBC)
- {
- SQLDisconnect(connection);
- SQLFreeHandle(SQL_HANDLE_DBC, connection);
- }
+ if (connection != SQL_NULL_HDBC)
+ {
+ SQLDisconnect(connection);
+ SQLFreeHandle(SQL_HANDLE_DBC, connection);
+ }
- if (env != SQL_NULL_HENV)
- {
- SQLFreeHandle(SQL_HANDLE_ENV, env);
- }
+ if (env != SQL_NULL_HENV)
+ {
+ SQLFreeHandle(SQL_HANDLE_ENV, env);
+ }
#endif
- this->closed = true;
+ this->closed = true;
}
void ODBCAppender::flushBuffer(Pool& p)
{
- std::list<spi::LoggingEventPtr>::iterator i;
+ std::list<spi::LoggingEventPtr>::iterator i;
- for (i = buffer.begin(); i != buffer.end(); i++)
- {
- try
- {
- const LoggingEventPtr& logEvent = *i;
- LogString sql = getLogStatement(logEvent, p);
- execute(sql, p);
- }
- catch (SQLException& e)
- {
- errorHandler->error(LOG4CXX_STR("Failed to execute sql"), e,
- ErrorCode::FLUSH_FAILURE);
- }
- }
+ for (i = buffer.begin(); i != buffer.end(); i++)
+ {
+ try
+ {
+ const LoggingEventPtr& logEvent = *i;
+ LogString sql = getLogStatement(logEvent, p);
+ execute(sql, p);
+ }
+ catch (SQLException& e)
+ {
+ errorHandler->error(LOG4CXX_STR("Failed to execute sql"), e,
+ ErrorCode::FLUSH_FAILURE);
+ }
+ }
- // clear the buffer of reported events
- buffer.clear();
+ // clear the buffer of reported events
+ buffer.clear();
}
void ODBCAppender::setSql(const LogString& s)
{
- sqlStatement = s;
+ sqlStatement = s;
- if (getLayout() == 0)
- {
- this->setLayout(new PatternLayout(s));
- }
- else
- {
- PatternLayoutPtr patternLayout = this->getLayout();
+ if (getLayout() == 0)
+ {
+ this->setLayout(new PatternLayout(s));
+ }
+ else
+ {
+ PatternLayoutPtr patternLayout = this->getLayout();
- if (patternLayout != 0)
- {
- patternLayout->setConversionPattern(s);
- }
- }
+ if (patternLayout != 0)
+ {
+ patternLayout->setConversionPattern(s);
+ }
+ }
}
void ODBCAppender::encode(wchar_t** dest, const LogString& src, Pool& p)
{
- *dest = Transcoder::wencode(src, p);
+ *dest = Transcoder::wencode(src, p);
}
void ODBCAppender::encode(unsigned short** dest,
- const LogString& src, Pool& p)
+ const LogString& src, Pool& p)
{
- // worst case double number of characters from UTF-8 or wchar_t
- *dest = (unsigned short*)
- p.palloc((src.size() + 1) * 2 * sizeof(unsigned short));
- unsigned short* current = *dest;
+ // worst case double number of characters from UTF-8 or wchar_t
+ *dest = (unsigned short*)
+ p.palloc((src.size() + 1) * 2 * sizeof(unsigned short));
+ unsigned short* current = *dest;
- for (LogString::const_iterator i = src.begin();
- i != src.end();)
- {
- unsigned int sv = Transcoder::decode(src, i);
+ for (LogString::const_iterator i = src.begin();
+ i != src.end();)
+ {
+ unsigned int sv = Transcoder::decode(src, i);
- if (sv < 0x10000)
- {
- *current++ = (unsigned short) sv;
- }
- else
- {
- unsigned char u = (unsigned char) (sv >> 16);
- unsigned char w = (unsigned char) (u - 1);
- unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10));
- unsigned short ls = (0xDC00 + (sv & 0x3FF));
- *current++ = (unsigned short) hs;
- *current++ = (unsigned short) ls;
- }
- }
+ if (sv < 0x10000)
+ {
+ *current++ = (unsigned short) sv;
+ }
+ else
+ {
+ unsigned char u = (unsigned char) (sv >> 16);
+ unsigned char w = (unsigned char) (u - 1);
+ unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10));
+ unsigned short ls = (0xDC00 + (sv & 0x3FF));
+ *current++ = (unsigned short) hs;
+ *current++ = (unsigned short) ls;
+ }
+ }
- *current = 0;
+ *current = 0;
}
diff --git a/src/main/cpp/onlyonceerrorhandler.cpp b/src/main/cpp/onlyonceerrorhandler.cpp
index 52dddf2..96e73e1 100644
--- a/src/main/cpp/onlyonceerrorhandler.cpp
+++ b/src/main/cpp/onlyonceerrorhandler.cpp
@@ -27,19 +27,19 @@
IMPLEMENT_LOG4CXX_OBJECT(OnlyOnceErrorHandler)
OnlyOnceErrorHandler::OnlyOnceErrorHandler() :
- WARN_PREFIX(LOG4CXX_STR("log4cxx warning: ")),
- ERROR_PREFIX(LOG4CXX_STR("log4cxx error: ")), firstTime(true)
+ WARN_PREFIX(LOG4CXX_STR("log4cxx warning: ")),
+ ERROR_PREFIX(LOG4CXX_STR("log4cxx error: ")), firstTime(true)
{
}
void OnlyOnceErrorHandler::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void OnlyOnceErrorHandler::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void OnlyOnceErrorHandler::setLogger(const LoggerPtr&)
@@ -55,29 +55,29 @@
}
void OnlyOnceErrorHandler::error(const LogString& message, const std::exception& e,
- int) const
+ int) const
{
- if (firstTime)
- {
- LogLog::error(message, e);
- firstTime = false;
- }
+ if (firstTime)
+ {
+ LogLog::error(message, e);
+ firstTime = false;
+ }
}
void OnlyOnceErrorHandler::error(const LogString& message, const std::exception& e,
- int errorCode, const log4cxx::spi::LoggingEventPtr&) const
+ int errorCode, const log4cxx::spi::LoggingEventPtr&) const
{
- error(message, e, errorCode);
+ error(message, e, errorCode);
}
void OnlyOnceErrorHandler::error(const LogString& message) const
{
- if (firstTime)
- {
- LogLog::error(message);
- firstTime = false;
- }
+ if (firstTime)
+ {
+ LogLog::error(message);
+ firstTime = false;
+ }
}
diff --git a/src/main/cpp/optionconverter.cpp b/src/main/cpp/optionconverter.cpp
index f2e79fa..3325cc2 100644
--- a/src/main/cpp/optionconverter.cpp
+++ b/src/main/cpp/optionconverter.cpp
@@ -44,372 +44,372 @@
LogString OptionConverter::convertSpecialChars(const LogString& s)
{
- logchar c;
- LogString sbuf;
+ logchar c;
+ LogString sbuf;
- LogString::const_iterator i = s.begin();
+ LogString::const_iterator i = s.begin();
- while (i != s.end())
- {
- c = *i++;
+ while (i != s.end())
+ {
+ c = *i++;
- if (c == 0x5C /* '\\' */)
- {
- c = *i++;
+ if (c == 0x5C /* '\\' */)
+ {
+ c = *i++;
- switch (c)
- {
- case 0x6E: //'n'
- c = 0x0A;
- break;
+ switch (c)
+ {
+ case 0x6E: //'n'
+ c = 0x0A;
+ break;
- case 0x72: //'r'
- c = 0x0D;
- break;
+ case 0x72: //'r'
+ c = 0x0D;
+ break;
- case 0x74: //'t'
- c = 0x09;
- break;
+ case 0x74: //'t'
+ c = 0x09;
+ break;
- case 0x66: //'f'
- c = 0x0C;
- break;
+ case 0x66: //'f'
+ c = 0x0C;
+ break;
- default:
- break;
- }
- }
+ default:
+ break;
+ }
+ }
- sbuf.append(1, c);
- }
+ sbuf.append(1, c);
+ }
- return sbuf;
+ return sbuf;
}
bool OptionConverter::toBoolean(const LogString& value, bool dEfault)
{
- if (value.length() >= 4)
- {
- if (StringHelper::equalsIgnoreCase(value.substr(0, 4),
- LOG4CXX_STR("TRUE"), LOG4CXX_STR("true")))
- {
- return true;
- }
- }
+ if (value.length() >= 4)
+ {
+ if (StringHelper::equalsIgnoreCase(value.substr(0, 4),
+ LOG4CXX_STR("TRUE"), LOG4CXX_STR("true")))
+ {
+ return true;
+ }
+ }
- if (dEfault && value.length() >= 5)
- {
- if (StringHelper::equalsIgnoreCase(value.substr(0, 5),
- LOG4CXX_STR("FALSE"), LOG4CXX_STR("false")))
- {
- return false;
- }
- }
+ if (dEfault && value.length() >= 5)
+ {
+ if (StringHelper::equalsIgnoreCase(value.substr(0, 5),
+ LOG4CXX_STR("FALSE"), LOG4CXX_STR("false")))
+ {
+ return false;
+ }
+ }
- return dEfault;
+ return dEfault;
}
int OptionConverter::toInt(const LogString& value, int dEfault)
{
- LogString trimmed(StringHelper::trim(value));
+ LogString trimmed(StringHelper::trim(value));
- if (trimmed.empty())
- {
- return dEfault;
- }
+ if (trimmed.empty())
+ {
+ return dEfault;
+ }
- LOG4CXX_ENCODE_CHAR(cvalue, trimmed);
+ LOG4CXX_ENCODE_CHAR(cvalue, trimmed);
- return (int) atol(cvalue.c_str());
+ return (int) atol(cvalue.c_str());
}
long OptionConverter::toFileSize(const LogString& s, long dEfault)
{
- if (s.empty())
- {
- return dEfault;
- }
+ if (s.empty())
+ {
+ return dEfault;
+ }
- size_t index = s.find_first_of(LOG4CXX_STR("bB"));
+ size_t index = s.find_first_of(LOG4CXX_STR("bB"));
- if (index != LogString::npos && index > 0)
- {
- long multiplier = 1;
- index--;
+ if (index != LogString::npos && index > 0)
+ {
+ long multiplier = 1;
+ index--;
- if (s[index] == 0x6B /* 'k' */ || s[index] == 0x4B /* 'K' */)
- {
- multiplier = 1024;
- }
- else if (s[index] == 0x6D /* 'm' */ || s[index] == 0x4D /* 'M' */)
- {
- multiplier = 1024 * 1024;
- }
- else if (s[index] == 0x67 /* 'g'*/ || s[index] == 0x47 /* 'G' */)
- {
- multiplier = 1024 * 1024 * 1024;
- }
+ if (s[index] == 0x6B /* 'k' */ || s[index] == 0x4B /* 'K' */)
+ {
+ multiplier = 1024;
+ }
+ else if (s[index] == 0x6D /* 'm' */ || s[index] == 0x4D /* 'M' */)
+ {
+ multiplier = 1024 * 1024;
+ }
+ else if (s[index] == 0x67 /* 'g'*/ || s[index] == 0x47 /* 'G' */)
+ {
+ multiplier = 1024 * 1024 * 1024;
+ }
- return toInt(s.substr(0, index), 1) * multiplier;
- }
+ return toInt(s.substr(0, index), 1) * multiplier;
+ }
- return toInt(s, 1);
+ return toInt(s, 1);
}
LogString OptionConverter::findAndSubst(const LogString& key, Properties& props)
{
- LogString value(props.getProperty(key));
+ LogString value(props.getProperty(key));
- if (value.empty())
- {
- return value;
- }
+ if (value.empty())
+ {
+ return value;
+ }
- try
- {
- return substVars(value, props);
- }
- catch (IllegalArgumentException& e)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Bad option value ["))
- + value + LOG4CXX_STR("]."), e);
- return value;
- }
+ try
+ {
+ return substVars(value, props);
+ }
+ catch (IllegalArgumentException& e)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Bad option value ["))
+ + value + LOG4CXX_STR("]."), e);
+ return value;
+ }
}
LogString OptionConverter::substVars(const LogString& val, Properties& props)
{
- LogString sbuf;
- const logchar delimStartArray[] = { 0x24, 0x7B, 0 };
- const LogString delimStart(delimStartArray);
- const logchar delimStop = 0x7D; // '}';
- const size_t DELIM_START_LEN = 2;
- const size_t DELIM_STOP_LEN = 1;
+ LogString sbuf;
+ const logchar delimStartArray[] = { 0x24, 0x7B, 0 };
+ const LogString delimStart(delimStartArray);
+ const logchar delimStop = 0x7D; // '}';
+ const size_t DELIM_START_LEN = 2;
+ const size_t DELIM_STOP_LEN = 1;
- int i = 0;
- int j, k;
+ int i = 0;
+ int j, k;
- while (true)
- {
- j = val.find(delimStart, i);
+ while (true)
+ {
+ j = val.find(delimStart, i);
- if (j == -1)
- {
- // no more variables
- if (i == 0)
- {
- // this is a simple string
- return val;
- }
- else
- {
- // add the tail string which contails no variables and return the result.
- sbuf.append(val.substr(i, val.length() - i));
- return sbuf;
- }
- }
- else
- {
- sbuf.append(val.substr(i, j - i));
- k = val.find(delimStop, j);
+ if (j == -1)
+ {
+ // no more variables
+ if (i == 0)
+ {
+ // this is a simple string
+ return val;
+ }
+ else
+ {
+ // add the tail string which contails no variables and return the result.
+ sbuf.append(val.substr(i, val.length() - i));
+ return sbuf;
+ }
+ }
+ else
+ {
+ sbuf.append(val.substr(i, j - i));
+ k = val.find(delimStop, j);
- if (k == -1)
- {
- LogString msg(1, (logchar) 0x22 /* '\"' */);
- msg.append(val);
- msg.append(LOG4CXX_STR("\" has no closing brace. Opening brace at position "));
- Pool p;
- StringHelper::toString(j, p, msg);
- msg.append(1, (logchar) 0x2E /* '.' */);
- throw IllegalArgumentException(msg);
- }
- else
- {
- j += DELIM_START_LEN;
- LogString key = val.substr(j, k - j);
- // first try in System properties
- LogString replacement(getSystemProperty(key, LogString()));
+ if (k == -1)
+ {
+ LogString msg(1, (logchar) 0x22 /* '\"' */);
+ msg.append(val);
+ msg.append(LOG4CXX_STR("\" has no closing brace. Opening brace at position "));
+ Pool p;
+ StringHelper::toString(j, p, msg);
+ msg.append(1, (logchar) 0x2E /* '.' */);
+ throw IllegalArgumentException(msg);
+ }
+ else
+ {
+ j += DELIM_START_LEN;
+ LogString key = val.substr(j, k - j);
+ // first try in System properties
+ LogString replacement(getSystemProperty(key, LogString()));
- // then try props parameter
- if (replacement.empty())
- {
- replacement = props.getProperty(key);
- }
+ // then try props parameter
+ if (replacement.empty())
+ {
+ replacement = props.getProperty(key);
+ }
- if (!replacement.empty())
- {
- // Do variable substitution on the replacement string
- // such that we can solve "Hello ${x2}" as "Hello p1"
- // the where the properties are
- // x1=p1
- // x2=${x1}
- LogString recursiveReplacement = substVars(replacement, props);
- sbuf.append(recursiveReplacement);
- }
+ if (!replacement.empty())
+ {
+ // Do variable substitution on the replacement string
+ // such that we can solve "Hello ${x2}" as "Hello p1"
+ // the where the properties are
+ // x1=p1
+ // x2=${x1}
+ LogString recursiveReplacement = substVars(replacement, props);
+ sbuf.append(recursiveReplacement);
+ }
- i = k + DELIM_STOP_LEN;
- }
- }
- }
+ i = k + DELIM_STOP_LEN;
+ }
+ }
+ }
}
LogString OptionConverter::getSystemProperty(const LogString& key, const LogString& def)
{
- if (!key.empty())
- {
- LogString value(System::getProperty(key));
+ if (!key.empty())
+ {
+ LogString value(System::getProperty(key));
- if (!value.empty())
- {
- return value;
- }
- }
+ if (!value.empty())
+ {
+ return value;
+ }
+ }
- return def;
+ return def;
}
LevelPtr OptionConverter::toLevel(const LogString& value,
- const LevelPtr& defaultValue)
+ const LevelPtr& defaultValue)
{
- size_t hashIndex = value.find(LOG4CXX_STR("#"));
+ size_t hashIndex = value.find(LOG4CXX_STR("#"));
- if (hashIndex == LogString::npos)
- {
- if (value.empty())
- {
- return defaultValue;
- }
- else
- {
- LogLog::debug(
- ((LogString) LOG4CXX_STR("OptionConverter::toLevel: no class name specified, level=["))
- + value
- + LOG4CXX_STR("]"));
- // no class name specified : use standard Level class
- return Level::toLevelLS(value, defaultValue);
- }
- }
+ if (hashIndex == LogString::npos)
+ {
+ if (value.empty())
+ {
+ return defaultValue;
+ }
+ else
+ {
+ LogLog::debug(
+ ((LogString) LOG4CXX_STR("OptionConverter::toLevel: no class name specified, level=["))
+ + value
+ + LOG4CXX_STR("]"));
+ // no class name specified : use standard Level class
+ return Level::toLevelLS(value, defaultValue);
+ }
+ }
- LogString clazz = value.substr(hashIndex + 1);
- LogString levelName = value.substr(0, hashIndex);
- LogLog::debug(((LogString) LOG4CXX_STR("OptionConverter::toLevel: class=["))
- + clazz + LOG4CXX_STR("], level=[") + levelName + LOG4CXX_STR("]"));
+ LogString clazz = value.substr(hashIndex + 1);
+ LogString levelName = value.substr(0, hashIndex);
+ LogLog::debug(((LogString) LOG4CXX_STR("OptionConverter::toLevel: class=["))
+ + clazz + LOG4CXX_STR("], level=[") + levelName + LOG4CXX_STR("]"));
- // This is degenerate case but you never know.
- if (levelName.empty())
- {
- return Level::toLevelLS(value, defaultValue);
- }
+ // This is degenerate case but you never know.
+ if (levelName.empty())
+ {
+ return Level::toLevelLS(value, defaultValue);
+ }
- try
- {
- Level::LevelClass& levelClass =
- (Level::LevelClass&)Loader::loadClass(clazz);
- return levelClass.toLevel(levelName);
- }
- catch (ClassNotFoundException&)
- {
- LogLog::warn(((LogString) LOG4CXX_STR("custom level class ["))
- + clazz + LOG4CXX_STR("] not found."));
- }
- catch (Exception& oops)
- {
- LogLog::warn(
- LOG4CXX_STR("class [") + clazz + LOG4CXX_STR("], level [") + levelName +
- LOG4CXX_STR("] conversion) failed."), oops);
- }
- catch (...)
- {
- LogLog::warn(
- LOG4CXX_STR("class [") + clazz + LOG4CXX_STR("], level [") + levelName +
- LOG4CXX_STR("] conversion) failed."));
- }
+ try
+ {
+ Level::LevelClass& levelClass =
+ (Level::LevelClass&)Loader::loadClass(clazz);
+ return levelClass.toLevel(levelName);
+ }
+ catch (ClassNotFoundException&)
+ {
+ LogLog::warn(((LogString) LOG4CXX_STR("custom level class ["))
+ + clazz + LOG4CXX_STR("] not found."));
+ }
+ catch (Exception& oops)
+ {
+ LogLog::warn(
+ LOG4CXX_STR("class [") + clazz + LOG4CXX_STR("], level [") + levelName +
+ LOG4CXX_STR("] conversion) failed."), oops);
+ }
+ catch (...)
+ {
+ LogLog::warn(
+ LOG4CXX_STR("class [") + clazz + LOG4CXX_STR("], level [") + levelName +
+ LOG4CXX_STR("] conversion) failed."));
+ }
- return defaultValue;
+ return defaultValue;
}
ObjectPtr OptionConverter::instantiateByKey(Properties& props, const LogString& key,
- const Class& superClass, const ObjectPtr& defaultValue)
+ const Class& superClass, const ObjectPtr& defaultValue)
{
- // Get the value of the property in string form
- LogString className(findAndSubst(key, props));
+ // Get the value of the property in string form
+ LogString className(findAndSubst(key, props));
- if (className.empty())
- {
- LogLog::error(
- ((LogString) LOG4CXX_STR("Could not find value for key ")) + key);
- return defaultValue;
- }
+ if (className.empty())
+ {
+ LogLog::error(
+ ((LogString) LOG4CXX_STR("Could not find value for key ")) + key);
+ return defaultValue;
+ }
- // Trim className to avoid trailing spaces that cause problems.
- return OptionConverter::instantiateByClassName(
- StringHelper::trim(className), superClass, defaultValue);
+ // Trim className to avoid trailing spaces that cause problems.
+ return OptionConverter::instantiateByClassName(
+ StringHelper::trim(className), superClass, defaultValue);
}
ObjectPtr OptionConverter::instantiateByClassName(const LogString& className,
- const Class& superClass, const ObjectPtr& defaultValue)
+ const Class& superClass, const ObjectPtr& defaultValue)
{
- if (!className.empty())
- {
- try
- {
- const Class& classObj = Loader::loadClass(className);
- ObjectPtr newObject = classObj.newInstance();
+ if (!className.empty())
+ {
+ try
+ {
+ const Class& classObj = Loader::loadClass(className);
+ ObjectPtr newObject = classObj.newInstance();
- if (!newObject->instanceof(superClass))
- {
- return defaultValue;
- }
+ if (!newObject->instanceof(superClass))
+ {
+ return defaultValue;
+ }
- return newObject;
- }
- catch (Exception& e)
- {
- LogLog::error(LOG4CXX_STR("Could not instantiate class [") +
- className + LOG4CXX_STR("]."), e);
- }
- }
+ return newObject;
+ }
+ catch (Exception& e)
+ {
+ LogLog::error(LOG4CXX_STR("Could not instantiate class [") +
+ className + LOG4CXX_STR("]."), e);
+ }
+ }
- return defaultValue;
+ return defaultValue;
}
void OptionConverter::selectAndConfigure(const File& configFileName,
- const LogString& _clazz, spi::LoggerRepositoryPtr& hierarchy)
+ const LogString& _clazz, spi::LoggerRepositoryPtr& hierarchy)
{
- ConfiguratorPtr configurator;
- LogString clazz = _clazz;
+ ConfiguratorPtr configurator;
+ LogString clazz = _clazz;
- LogString filename(configFileName.getPath());
+ LogString filename(configFileName.getPath());
- if (clazz.empty()
- && filename.length() > 4
- && StringHelper::equalsIgnoreCase(
- filename.substr(filename.length() - 4),
- LOG4CXX_STR(".XML"), LOG4CXX_STR(".xml")))
- {
- clazz = log4cxx::xml::DOMConfigurator::getStaticClass().toString();
- }
+ if (clazz.empty()
+ && filename.length() > 4
+ && StringHelper::equalsIgnoreCase(
+ filename.substr(filename.length() - 4),
+ LOG4CXX_STR(".XML"), LOG4CXX_STR(".xml")))
+ {
+ clazz = log4cxx::xml::DOMConfigurator::getStaticClass().toString();
+ }
- if (!clazz.empty())
- {
- LogLog::debug(LOG4CXX_STR("Preferred configurator class: ") + clazz);
- configurator = instantiateByClassName(clazz,
- Configurator::getStaticClass(),
- 0);
+ if (!clazz.empty())
+ {
+ LogLog::debug(LOG4CXX_STR("Preferred configurator class: ") + clazz);
+ configurator = instantiateByClassName(clazz,
+ Configurator::getStaticClass(),
+ 0);
- if (configurator == 0)
- {
- LogLog::error(LOG4CXX_STR("Could not instantiate configurator [")
- + clazz + LOG4CXX_STR("]."));
- return;
- }
- }
- else
- {
- configurator = new PropertyConfigurator();
- }
+ if (configurator == 0)
+ {
+ LogLog::error(LOG4CXX_STR("Could not instantiate configurator [")
+ + clazz + LOG4CXX_STR("]."));
+ return;
+ }
+ }
+ else
+ {
+ configurator = new PropertyConfigurator();
+ }
- configurator->doConfigure(configFileName, hierarchy);
+ configurator->doConfigure(configFileName, hierarchy);
}
diff --git a/src/main/cpp/outputdebugstringappender.cpp b/src/main/cpp/outputdebugstringappender.cpp
index 9e22677..a394b8a 100644
--- a/src/main/cpp/outputdebugstringappender.cpp
+++ b/src/main/cpp/outputdebugstringappender.cpp
@@ -33,14 +33,14 @@
void OutputDebugStringAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
- LogString buf;
- layout->format(buf, event, p);
+ LogString buf;
+ layout->format(buf, event, p);
#if LOG4CXX_WCHAR_T_API
- LOG4CXX_ENCODE_WCHAR(wstr, buf);
- ::OutputDebugStringW(wstr.c_str());
+ LOG4CXX_ENCODE_WCHAR(wstr, buf);
+ ::OutputDebugStringW(wstr.c_str());
#else
- LOG4CXX_ENCODE_CHAR(str, buf);
- ::OutputDebugStringA(str.c_str());
+ LOG4CXX_ENCODE_CHAR(str, buf);
+ ::OutputDebugStringA(str.c_str());
#endif
}
diff --git a/src/main/cpp/outputstream.cpp b/src/main/cpp/outputstream.cpp
index 89526d8..2175744 100644
--- a/src/main/cpp/outputstream.cpp
+++ b/src/main/cpp/outputstream.cpp
@@ -35,11 +35,11 @@
#ifdef LOG4CXX_MULTI_PROCESS
apr_file_t* OutputStream::getFilePtr()
{
- throw std::logic_error("getFilePtr must be implemented in the derived class that you are using");
+ throw std::logic_error("getFilePtr must be implemented in the derived class that you are using");
}
OutputStream& OutputStream::getFileOutPutStreamPtr()
{
- throw std::logic_error("getFileOutPutStreamPtr must be implemented in the derived class that you are using");
+ throw std::logic_error("getFileOutPutStreamPtr must be implemented in the derived class that you are using");
}
#endif
diff --git a/src/main/cpp/outputstreamwriter.cpp b/src/main/cpp/outputstreamwriter.cpp
index 88c21c9..35d7f38 100644
--- a/src/main/cpp/outputstreamwriter.cpp
+++ b/src/main/cpp/outputstreamwriter.cpp
@@ -28,27 +28,27 @@
IMPLEMENT_LOG4CXX_OBJECT(OutputStreamWriter)
OutputStreamWriter::OutputStreamWriter(OutputStreamPtr& out1)
- : out(out1), enc(CharsetEncoder::getDefaultEncoder())
+ : out(out1), enc(CharsetEncoder::getDefaultEncoder())
{
- if (out1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("out parameter may not be null."));
- }
+ if (out1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("out parameter may not be null."));
+ }
}
OutputStreamWriter::OutputStreamWriter(OutputStreamPtr& out1,
- CharsetEncoderPtr& enc1)
- : out(out1), enc(enc1)
+ CharsetEncoderPtr& enc1)
+ : out(out1), enc(enc1)
{
- if (out1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("out parameter may not be null."));
- }
+ if (out1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("out parameter may not be null."));
+ }
- if (enc1 == 0)
- {
- throw NullPointerException(LOG4CXX_STR("enc parameter may not be null."));
- }
+ if (enc1 == 0)
+ {
+ throw NullPointerException(LOG4CXX_STR("enc parameter may not be null."));
+ }
}
OutputStreamWriter::~OutputStreamWriter()
@@ -57,45 +57,45 @@
void OutputStreamWriter::close(Pool& p)
{
- out->close(p);
+ out->close(p);
}
void OutputStreamWriter::flush(Pool& p)
{
- out->flush(p);
+ out->flush(p);
}
void OutputStreamWriter::write(const LogString& str, Pool& p)
{
- if (str.length() > 0)
- {
+ if (str.length() > 0)
+ {
#ifdef LOG4CXX_MULTI_PROCESS
- size_t bufSize = str.length() * 2;
- char* rawbuf = new char[bufSize];
- ByteBuffer buf(rawbuf, (size_t) bufSize);
+ size_t bufSize = str.length() * 2;
+ char* rawbuf = new char[bufSize];
+ ByteBuffer buf(rawbuf, (size_t) bufSize);
#else
- enum { BUFSIZE = 1024 };
- char rawbuf[BUFSIZE];
- ByteBuffer buf(rawbuf, (size_t) BUFSIZE);
+ enum { BUFSIZE = 1024 };
+ char rawbuf[BUFSIZE];
+ ByteBuffer buf(rawbuf, (size_t) BUFSIZE);
#endif
- enc->reset();
- LogString::const_iterator iter = str.begin();
+ enc->reset();
+ LogString::const_iterator iter = str.begin();
- while (iter != str.end())
- {
- CharsetEncoder::encode(enc, str, iter, buf);
- buf.flip();
- out->write(buf, p);
- buf.clear();
- }
+ while (iter != str.end())
+ {
+ CharsetEncoder::encode(enc, str, iter, buf);
+ buf.flip();
+ out->write(buf, p);
+ buf.clear();
+ }
- CharsetEncoder::encode(enc, str, iter, buf);
- enc->flush(buf);
- buf.flip();
- out->write(buf, p);
+ CharsetEncoder::encode(enc, str, iter, buf);
+ enc->flush(buf);
+ buf.flip();
+ out->write(buf, p);
#ifdef LOG4CXX_MULTI_PROCESS
- delete []rawbuf;
+ delete []rawbuf;
#endif
- }
+ }
}
diff --git a/src/main/cpp/patternconverter.cpp b/src/main/cpp/patternconverter.cpp
index c3ee3e9..d0add75 100644
--- a/src/main/cpp/patternconverter.cpp
+++ b/src/main/cpp/patternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -28,8 +28,8 @@
IMPLEMENT_LOG4CXX_OBJECT(PatternConverter)
PatternConverter::PatternConverter(
- const LogString& name1, const LogString& style1) :
- name(name1), style(style1)
+ const LogString& name1, const LogString& style1) :
+ name(name1), style(style1)
{
}
@@ -39,17 +39,17 @@
LogString PatternConverter::getName() const
{
- return name;
+ return name;
}
LogString PatternConverter::getStyleClass(const log4cxx::helpers::ObjectPtr& /* e */) const
{
- return style;
+ return style;
}
void PatternConverter::append(LogString& toAppendTo, const std::string& src)
{
- LOG4CXX_DECODE_CHAR(decoded, src);
- toAppendTo.append(decoded);
+ LOG4CXX_DECODE_CHAR(decoded, src);
+ toAppendTo.append(decoded);
}
diff --git a/src/main/cpp/patternlayout.cpp b/src/main/cpp/patternlayout.cpp
index 8b6de3c..1ba79ec 100644
--- a/src/main/cpp/patternlayout.cpp
+++ b/src/main/cpp/patternlayout.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -64,131 +64,131 @@
Constructs a PatternLayout using the supplied conversion pattern.
*/
PatternLayout::PatternLayout(const LogString& pattern)
- : conversionPattern(pattern)
+ : conversionPattern(pattern)
{
- Pool pool;
- activateOptions(pool);
+ Pool pool;
+ activateOptions(pool);
}
void PatternLayout::setConversionPattern(const LogString& pattern)
{
- conversionPattern = pattern;
- Pool pool;
- activateOptions(pool);
+ conversionPattern = pattern;
+ Pool pool;
+ activateOptions(pool);
}
void PatternLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- Pool& pool) const
+ const spi::LoggingEventPtr& event,
+ Pool& pool) const
{
- std::vector<FormattingInfoPtr>::const_iterator formatterIter =
- patternFields.begin();
+ std::vector<FormattingInfoPtr>::const_iterator formatterIter =
+ patternFields.begin();
- for (std::vector<LoggingEventPatternConverterPtr>::const_iterator
- converterIter = patternConverters.begin();
- converterIter != patternConverters.end();
- converterIter++, formatterIter++)
- {
- int startField = output.length();
- (*converterIter)->format(event, output, pool);
- (*formatterIter)->format(startField, output);
- }
+ for (std::vector<LoggingEventPatternConverterPtr>::const_iterator
+ converterIter = patternConverters.begin();
+ converterIter != patternConverters.end();
+ converterIter++, formatterIter++)
+ {
+ int startField = output.length();
+ (*converterIter)->format(event, output, pool);
+ (*formatterIter)->format(startField, output);
+ }
}
void PatternLayout::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("CONVERSIONPATTERN"),
- LOG4CXX_STR("conversionpattern")))
- {
- conversionPattern = OptionConverter::convertSpecialChars(value);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("CONVERSIONPATTERN"),
+ LOG4CXX_STR("conversionpattern")))
+ {
+ conversionPattern = OptionConverter::convertSpecialChars(value);
+ }
}
void PatternLayout::activateOptions(Pool&)
{
- LogString pat(conversionPattern);
+ LogString pat(conversionPattern);
- if (pat.empty())
- {
- pat = LOG4CXX_STR("%m%n");
- }
+ if (pat.empty())
+ {
+ pat = LOG4CXX_STR("%m%n");
+ }
- patternConverters.erase(patternConverters.begin(), patternConverters.end());
- patternFields.erase(patternFields.begin(), patternFields.end());
- std::vector<PatternConverterPtr> converters;
- PatternParser::parse(pat,
- converters,
- patternFields,
- getFormatSpecifiers());
+ patternConverters.erase(patternConverters.begin(), patternConverters.end());
+ patternFields.erase(patternFields.begin(), patternFields.end());
+ std::vector<PatternConverterPtr> converters;
+ PatternParser::parse(pat,
+ converters,
+ patternFields,
+ getFormatSpecifiers());
- //
- // strip out any pattern converters that don't handle LoggingEvents
- //
- //
- for (std::vector<PatternConverterPtr>::const_iterator converterIter = converters.begin();
- converterIter != converters.end();
- converterIter++)
- {
- LoggingEventPatternConverterPtr eventConverter(*converterIter);
+ //
+ // strip out any pattern converters that don't handle LoggingEvents
+ //
+ //
+ for (std::vector<PatternConverterPtr>::const_iterator converterIter = converters.begin();
+ converterIter != converters.end();
+ converterIter++)
+ {
+ LoggingEventPatternConverterPtr eventConverter(*converterIter);
- if (eventConverter != NULL)
- {
- patternConverters.push_back(eventConverter);
- }
- }
+ if (eventConverter != NULL)
+ {
+ patternConverters.push_back(eventConverter);
+ }
+ }
}
#define RULES_PUT(spec, cls) \
- specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
+ specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
log4cxx::pattern::PatternMap PatternLayout::getFormatSpecifiers()
{
- PatternMap specs;
- RULES_PUT("c", LoggerPatternConverter);
- RULES_PUT("logger", LoggerPatternConverter);
+ PatternMap specs;
+ RULES_PUT("c", LoggerPatternConverter);
+ RULES_PUT("logger", LoggerPatternConverter);
- RULES_PUT("C", ClassNamePatternConverter);
- RULES_PUT("class", ClassNamePatternConverter);
+ RULES_PUT("C", ClassNamePatternConverter);
+ RULES_PUT("class", ClassNamePatternConverter);
- RULES_PUT("d", DatePatternConverter);
- RULES_PUT("date", DatePatternConverter);
+ RULES_PUT("d", DatePatternConverter);
+ RULES_PUT("date", DatePatternConverter);
- RULES_PUT("F", FileLocationPatternConverter);
- RULES_PUT("file", FileLocationPatternConverter);
+ RULES_PUT("F", FileLocationPatternConverter);
+ RULES_PUT("file", FileLocationPatternConverter);
- RULES_PUT("l", FullLocationPatternConverter);
+ RULES_PUT("l", FullLocationPatternConverter);
- RULES_PUT("L", LineLocationPatternConverter);
- RULES_PUT("line", LineLocationPatternConverter);
+ RULES_PUT("L", LineLocationPatternConverter);
+ RULES_PUT("line", LineLocationPatternConverter);
- RULES_PUT("m", MessagePatternConverter);
- RULES_PUT("message", MessagePatternConverter);
+ RULES_PUT("m", MessagePatternConverter);
+ RULES_PUT("message", MessagePatternConverter);
- RULES_PUT("n", LineSeparatorPatternConverter);
+ RULES_PUT("n", LineSeparatorPatternConverter);
- RULES_PUT("M", MethodLocationPatternConverter);
- RULES_PUT("method", MethodLocationPatternConverter);
+ RULES_PUT("M", MethodLocationPatternConverter);
+ RULES_PUT("method", MethodLocationPatternConverter);
- RULES_PUT("p", LevelPatternConverter);
- RULES_PUT("level", LevelPatternConverter);
+ RULES_PUT("p", LevelPatternConverter);
+ RULES_PUT("level", LevelPatternConverter);
- RULES_PUT("r", RelativeTimePatternConverter);
- RULES_PUT("relative", RelativeTimePatternConverter);
+ RULES_PUT("r", RelativeTimePatternConverter);
+ RULES_PUT("relative", RelativeTimePatternConverter);
- RULES_PUT("t", ThreadPatternConverter);
- RULES_PUT("thread", ThreadPatternConverter);
+ RULES_PUT("t", ThreadPatternConverter);
+ RULES_PUT("thread", ThreadPatternConverter);
- RULES_PUT("x", NDCPatternConverter);
- RULES_PUT("ndc", NDCPatternConverter);
+ RULES_PUT("x", NDCPatternConverter);
+ RULES_PUT("ndc", NDCPatternConverter);
- RULES_PUT("X", PropertiesPatternConverter);
- RULES_PUT("properties", PropertiesPatternConverter);
+ RULES_PUT("X", PropertiesPatternConverter);
+ RULES_PUT("properties", PropertiesPatternConverter);
- RULES_PUT("throwable", ThrowableInformationPatternConverter);
- return specs;
+ RULES_PUT("throwable", ThrowableInformationPatternConverter);
+ return specs;
}
diff --git a/src/main/cpp/patternparser.cpp b/src/main/cpp/patternparser.cpp
index 9181dcd..121e2b3 100644
--- a/src/main/cpp/patternparser.cpp
+++ b/src/main/cpp/patternparser.cpp
@@ -36,363 +36,363 @@
bool PatternParser::isUnicodeIdentifierStart(logchar ch)
{
- //
- // greatly simplified version checks if
- // character is USACII alpha or number
- //
- return (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
- (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
- (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
+ //
+ // greatly simplified version checks if
+ // character is USACII alpha or number
+ //
+ return (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
+ (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
+ (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
}
bool PatternParser::isUnicodeIdentifierPart(logchar ch)
{
- //
- // greatly simplified version checks if
- // character is USACII alpha or number
- //
- return isUnicodeIdentifierStart(ch)
- || (ch == 0x5F /* '_' */);
+ //
+ // greatly simplified version checks if
+ // character is USACII alpha or number
+ //
+ return isUnicodeIdentifierStart(ch)
+ || (ch == 0x5F /* '_' */);
}
int PatternParser::extractConverter(
- logchar lastChar, const LogString& pattern,
- LogString::size_type i, LogString& convBuf,
- LogString& currentLiteral)
+ logchar lastChar, const LogString& pattern,
+ LogString::size_type i, LogString& convBuf,
+ LogString& currentLiteral)
{
- if (!convBuf.empty())
- {
- convBuf.erase(convBuf.begin(), convBuf.end());
- }
+ if (!convBuf.empty())
+ {
+ convBuf.erase(convBuf.begin(), convBuf.end());
+ }
- // When this method is called, lastChar points to the first character of the
- // conversion word. For example:
- // For "%hello" lastChar = 'h'
- // For "%-5hello" lastChar = 'h'
- //System.out.println("lastchar is "+lastChar);
- if (!isUnicodeIdentifierStart(lastChar))
- {
- return i;
- }
+ // When this method is called, lastChar points to the first character of the
+ // conversion word. For example:
+ // For "%hello" lastChar = 'h'
+ // For "%-5hello" lastChar = 'h'
+ //System.out.println("lastchar is "+lastChar);
+ if (!isUnicodeIdentifierStart(lastChar))
+ {
+ return i;
+ }
- convBuf.append(1, lastChar);
+ convBuf.append(1, lastChar);
- while (
- (i < pattern.length())
- && isUnicodeIdentifierPart(pattern[i]))
- {
- convBuf.append(1, pattern[i]);
- currentLiteral.append(1, pattern[i]);
+ while (
+ (i < pattern.length())
+ && isUnicodeIdentifierPart(pattern[i]))
+ {
+ convBuf.append(1, pattern[i]);
+ currentLiteral.append(1, pattern[i]);
- //System.out.println("conv buffer is now ["+convBuf+"].");
- i++;
- }
+ //System.out.println("conv buffer is now ["+convBuf+"].");
+ i++;
+ }
- return i;
+ return i;
}
int PatternParser::extractOptions(const LogString& pattern, LogString::size_type i,
- std::vector<LogString>& options)
+ std::vector<LogString>& options)
{
- while ((i < pattern.length()) && (pattern[i] == 0x7B /* '{' */))
- {
- int end = pattern.find(0x7D /* '}' */, i);
+ while ((i < pattern.length()) && (pattern[i] == 0x7B /* '{' */))
+ {
+ int end = pattern.find(0x7D /* '}' */, i);
- if (end == -1)
- {
- break;
- }
+ if (end == -1)
+ {
+ break;
+ }
- LogString r(pattern.substr(i + 1, end - i - 1));
- options.push_back(r);
- i = end + 1;
- }
+ LogString r(pattern.substr(i + 1, end - i - 1));
+ options.push_back(r);
+ i = end + 1;
+ }
- return i;
+ return i;
}
void PatternParser::parse(
- const LogString& pattern,
- std::vector<PatternConverterPtr>& patternConverters,
- std::vector<FormattingInfoPtr>& formattingInfos,
- const PatternMap& rules)
+ const LogString& pattern,
+ std::vector<PatternConverterPtr>& patternConverters,
+ std::vector<FormattingInfoPtr>& formattingInfos,
+ const PatternMap& rules)
{
- LogString currentLiteral;
+ LogString currentLiteral;
- int patternLength = pattern.length();
- int state = LITERAL_STATE;
- logchar c;
- int i = 0;
- FormattingInfoPtr formattingInfo(FormattingInfo::getDefault());
+ int patternLength = pattern.length();
+ int state = LITERAL_STATE;
+ logchar c;
+ int i = 0;
+ FormattingInfoPtr formattingInfo(FormattingInfo::getDefault());
- while (i < patternLength)
- {
- c = pattern[i++];
+ while (i < patternLength)
+ {
+ c = pattern[i++];
- switch (state)
- {
- case LITERAL_STATE:
+ switch (state)
+ {
+ case LITERAL_STATE:
- // In literal state, the last char is always a literal.
- if (i == patternLength)
- {
- currentLiteral.append(1, c);
+ // In literal state, the last char is always a literal.
+ if (i == patternLength)
+ {
+ currentLiteral.append(1, c);
- continue;
- }
+ continue;
+ }
- if (c == ESCAPE_CHAR)
- {
- // peek at the next char.
- if (pattern[i] == ESCAPE_CHAR)
- {
- currentLiteral.append(1, c);
- i++; // move pointer
- }
- else
- {
- if (!currentLiteral.empty())
- {
- patternConverters.push_back(
- LiteralPatternConverter::newInstance(currentLiteral));
- formattingInfos.push_back(FormattingInfo::getDefault());
- currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
- }
+ if (c == ESCAPE_CHAR)
+ {
+ // peek at the next char.
+ if (pattern[i] == ESCAPE_CHAR)
+ {
+ currentLiteral.append(1, c);
+ i++; // move pointer
+ }
+ else
+ {
+ if (!currentLiteral.empty())
+ {
+ patternConverters.push_back(
+ LiteralPatternConverter::newInstance(currentLiteral));
+ formattingInfos.push_back(FormattingInfo::getDefault());
+ currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
+ }
- currentLiteral.append(1, c); // append %
- state = CONVERTER_STATE;
- formattingInfo = FormattingInfo::getDefault();
- }
- }
- else
- {
- currentLiteral.append(1, c);
- }
+ currentLiteral.append(1, c); // append %
+ state = CONVERTER_STATE;
+ formattingInfo = FormattingInfo::getDefault();
+ }
+ }
+ else
+ {
+ currentLiteral.append(1, c);
+ }
- break;
+ break;
- case CONVERTER_STATE:
- currentLiteral.append(1, c);
+ case CONVERTER_STATE:
+ currentLiteral.append(1, c);
- switch (c)
- {
- case 0x2D: // '-'
- formattingInfo =
- new FormattingInfo(
- true, formattingInfo->getMinLength(),
- formattingInfo->getMaxLength());
+ switch (c)
+ {
+ case 0x2D: // '-'
+ formattingInfo =
+ new FormattingInfo(
+ true, formattingInfo->getMinLength(),
+ formattingInfo->getMaxLength());
- break;
+ break;
- case 0x2E: // '.'
- state = DOT_STATE;
+ case 0x2E: // '.'
+ state = DOT_STATE;
- break;
+ break;
- default:
+ default:
- if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
- {
- formattingInfo =
- new FormattingInfo(
- formattingInfo->isLeftAligned(), c - 0x30 /* '0' */,
- formattingInfo->getMaxLength());
- state = MIN_STATE;
- }
- else
- {
- i = finalizeConverter(
- c, pattern, i, currentLiteral, formattingInfo,
- rules, patternConverters, formattingInfos);
+ if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
+ {
+ formattingInfo =
+ new FormattingInfo(
+ formattingInfo->isLeftAligned(), c - 0x30 /* '0' */,
+ formattingInfo->getMaxLength());
+ state = MIN_STATE;
+ }
+ else
+ {
+ i = finalizeConverter(
+ c, pattern, i, currentLiteral, formattingInfo,
+ rules, patternConverters, formattingInfos);
- // Next pattern is assumed to be a literal.
- state = LITERAL_STATE;
- formattingInfo = FormattingInfo::getDefault();
+ // Next pattern is assumed to be a literal.
+ state = LITERAL_STATE;
+ formattingInfo = FormattingInfo::getDefault();
- if (!currentLiteral.empty())
- {
- currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
- }
- }
- } // switch
+ if (!currentLiteral.empty())
+ {
+ currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
+ }
+ }
+ } // switch
- break;
+ break;
- case MIN_STATE:
- currentLiteral.append(1, c);
+ case MIN_STATE:
+ currentLiteral.append(1, c);
- if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
- {
- formattingInfo =
- new FormattingInfo(
- formattingInfo->isLeftAligned(),
- (formattingInfo->getMinLength() * 10) + (c - 0x30 /* '0' */),
- formattingInfo->getMaxLength());
- }
- else if (c == 0x2E /* '.' */)
- {
- state = DOT_STATE;
- }
- else
- {
- i = finalizeConverter(
- c, pattern, i, currentLiteral, formattingInfo,
- rules, patternConverters, formattingInfos);
- state = LITERAL_STATE;
- formattingInfo = FormattingInfo::getDefault();
+ if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
+ {
+ formattingInfo =
+ new FormattingInfo(
+ formattingInfo->isLeftAligned(),
+ (formattingInfo->getMinLength() * 10) + (c - 0x30 /* '0' */),
+ formattingInfo->getMaxLength());
+ }
+ else if (c == 0x2E /* '.' */)
+ {
+ state = DOT_STATE;
+ }
+ else
+ {
+ i = finalizeConverter(
+ c, pattern, i, currentLiteral, formattingInfo,
+ rules, patternConverters, formattingInfos);
+ state = LITERAL_STATE;
+ formattingInfo = FormattingInfo::getDefault();
- if (!currentLiteral.empty())
- {
- currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
- }
- }
+ if (!currentLiteral.empty())
+ {
+ currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
+ }
+ }
- break;
+ break;
- case DOT_STATE:
- currentLiteral.append(1, c);
+ case DOT_STATE:
+ currentLiteral.append(1, c);
- if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
- {
- formattingInfo =
- new FormattingInfo(
- formattingInfo->isLeftAligned(), formattingInfo->getMinLength(),
- c - 0x30 /* '0' */);
- state = MAX_STATE;
- }
- else
- {
- LogLog::error(LOG4CXX_STR("Error in pattern, was expecting digit."));
+ if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
+ {
+ formattingInfo =
+ new FormattingInfo(
+ formattingInfo->isLeftAligned(), formattingInfo->getMinLength(),
+ c - 0x30 /* '0' */);
+ state = MAX_STATE;
+ }
+ else
+ {
+ LogLog::error(LOG4CXX_STR("Error in pattern, was expecting digit."));
- state = LITERAL_STATE;
- }
+ state = LITERAL_STATE;
+ }
- break;
+ break;
- case MAX_STATE:
- currentLiteral.append(1, c);
+ case MAX_STATE:
+ currentLiteral.append(1, c);
- if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
- {
- formattingInfo =
- new FormattingInfo(
- formattingInfo->isLeftAligned(), formattingInfo->getMinLength(),
- (formattingInfo->getMaxLength() * 10) + (c - 0x30 /* '0' */));
- }
- else
- {
- i = finalizeConverter(
- c, pattern, i, currentLiteral, formattingInfo,
- rules, patternConverters, formattingInfos);
- state = LITERAL_STATE;
- formattingInfo = FormattingInfo::getDefault();
+ if ((c >= 0x30 /* '0' */) && (c <= 0x39 /* '9' */))
+ {
+ formattingInfo =
+ new FormattingInfo(
+ formattingInfo->isLeftAligned(), formattingInfo->getMinLength(),
+ (formattingInfo->getMaxLength() * 10) + (c - 0x30 /* '0' */));
+ }
+ else
+ {
+ i = finalizeConverter(
+ c, pattern, i, currentLiteral, formattingInfo,
+ rules, patternConverters, formattingInfos);
+ state = LITERAL_STATE;
+ formattingInfo = FormattingInfo::getDefault();
- if (!currentLiteral.empty())
- {
- currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
- }
- }
+ if (!currentLiteral.empty())
+ {
+ currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
+ }
+ }
- break;
- } // switch
- }
+ break;
+ } // switch
+ }
- // while
- if (currentLiteral.length() != 0)
- {
- patternConverters.push_back(
- LiteralPatternConverter::newInstance(currentLiteral));
- formattingInfos.push_back(FormattingInfo::getDefault());
- }
+ // while
+ if (currentLiteral.length() != 0)
+ {
+ patternConverters.push_back(
+ LiteralPatternConverter::newInstance(currentLiteral));
+ formattingInfos.push_back(FormattingInfo::getDefault());
+ }
}
PatternConverterPtr PatternParser::createConverter(
- const LogString& converterId,
- LogString& currentLiteral,
- const PatternMap& rules,
- std::vector<LogString>& options)
+ const LogString& converterId,
+ LogString& currentLiteral,
+ const PatternMap& rules,
+ std::vector<LogString>& options)
{
- LogString converterName(converterId);
+ LogString converterName(converterId);
- for (int i = converterId.length(); i > 0; i--)
- {
- converterName = converterName.substr(0, i);
- PatternMap::const_iterator iter = rules.find(converterName);
+ for (int i = converterId.length(); i > 0; i--)
+ {
+ converterName = converterName.substr(0, i);
+ PatternMap::const_iterator iter = rules.find(converterName);
- if (iter != rules.end())
- {
- currentLiteral.erase(currentLiteral.begin(),
- currentLiteral.end() - (converterId.length() - i));
- return (iter->second)(options);
- }
- }
+ if (iter != rules.end())
+ {
+ currentLiteral.erase(currentLiteral.begin(),
+ currentLiteral.end() - (converterId.length() - i));
+ return (iter->second)(options);
+ }
+ }
- LogLog::error(LogString(LOG4CXX_STR("Unrecognized format specifier ")) + converterId);
- ObjectPtr converterObj;
+ LogLog::error(LogString(LOG4CXX_STR("Unrecognized format specifier ")) + converterId);
+ ObjectPtr converterObj;
- return converterObj;
+ return converterObj;
}
int PatternParser::finalizeConverter(
- logchar c, const LogString& pattern, int i,
- LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
- const PatternMap& rules,
- std::vector<PatternConverterPtr>& patternConverters,
- std::vector<FormattingInfoPtr>& formattingInfos)
+ logchar c, const LogString& pattern, int i,
+ LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
+ const PatternMap& rules,
+ std::vector<PatternConverterPtr>& patternConverters,
+ std::vector<FormattingInfoPtr>& formattingInfos)
{
- LogString convBuf;
- i = extractConverter(c, pattern, i, convBuf, currentLiteral);
+ LogString convBuf;
+ i = extractConverter(c, pattern, i, convBuf, currentLiteral);
- if (convBuf.empty())
- {
- LogLog::error(LOG4CXX_STR("Empty conversion specifier"));
- patternConverters.push_back(
- LiteralPatternConverter::newInstance(currentLiteral));
- formattingInfos.push_back(FormattingInfo::getDefault());
- }
- else
- {
- LogString converterId(convBuf);
+ if (convBuf.empty())
+ {
+ LogLog::error(LOG4CXX_STR("Empty conversion specifier"));
+ patternConverters.push_back(
+ LiteralPatternConverter::newInstance(currentLiteral));
+ formattingInfos.push_back(FormattingInfo::getDefault());
+ }
+ else
+ {
+ LogString converterId(convBuf);
- std::vector<LogString> options;
- i = extractOptions(pattern, i, options);
+ std::vector<LogString> options;
+ i = extractOptions(pattern, i, options);
- PatternConverterPtr pc(
- createConverter(
- converterId, currentLiteral, rules, options));
+ PatternConverterPtr pc(
+ createConverter(
+ converterId, currentLiteral, rules, options));
- if (pc == NULL)
- {
- LogString msg(LOG4CXX_STR("Unrecognized conversion specifier ["));
- msg.append(converterId);
- msg.append(LOG4CXX_STR("] in conversion pattern."));
- LogLog::error(msg);
- patternConverters.push_back(
- LiteralPatternConverter::newInstance(currentLiteral));
- formattingInfos.push_back(FormattingInfo::getDefault());
- }
- else
- {
- patternConverters.push_back(pc);
- formattingInfos.push_back(formattingInfo);
+ if (pc == NULL)
+ {
+ LogString msg(LOG4CXX_STR("Unrecognized conversion specifier ["));
+ msg.append(converterId);
+ msg.append(LOG4CXX_STR("] in conversion pattern."));
+ LogLog::error(msg);
+ patternConverters.push_back(
+ LiteralPatternConverter::newInstance(currentLiteral));
+ formattingInfos.push_back(FormattingInfo::getDefault());
+ }
+ else
+ {
+ patternConverters.push_back(pc);
+ formattingInfos.push_back(formattingInfo);
- if (currentLiteral.length() > 0)
- {
- patternConverters.push_back(
- LiteralPatternConverter::newInstance(currentLiteral));
- formattingInfos.push_back(FormattingInfo::getDefault());
- }
- }
- }
+ if (currentLiteral.length() > 0)
+ {
+ patternConverters.push_back(
+ LiteralPatternConverter::newInstance(currentLiteral));
+ formattingInfos.push_back(FormattingInfo::getDefault());
+ }
+ }
+ }
- if (!currentLiteral.empty())
- {
- currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
- }
+ if (!currentLiteral.empty())
+ {
+ currentLiteral.erase(currentLiteral.begin(), currentLiteral.end());
+ }
- return i;
+ return i;
}
diff --git a/src/main/cpp/pool.cpp b/src/main/cpp/pool.cpp
index ea052da..6678341 100644
--- a/src/main/cpp/pool.cpp
+++ b/src/main/cpp/pool.cpp
@@ -22,7 +22,7 @@
#include <apr_pools.h>
#include <assert.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -32,72 +32,72 @@
Pool::Pool() : pool(0), release(true)
{
- apr_status_t stat = apr_pool_create(&pool, APRInitializer::getRootPool());
+ apr_status_t stat = apr_pool_create(&pool, APRInitializer::getRootPool());
- if (stat != APR_SUCCESS)
- {
- throw PoolException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw PoolException(stat);
+ }
}
Pool::Pool(apr_pool_t* p, bool release1) : pool(p), release(release1)
{
- assert(p != NULL);
+ assert(p != NULL);
}
Pool::~Pool()
{
- if (release)
- {
- apr_pool_destroy(pool);
- }
+ if (release)
+ {
+ apr_pool_destroy(pool);
+ }
}
apr_pool_t* Pool::getAPRPool()
{
- return pool;
+ return pool;
}
apr_pool_t* Pool::create()
{
- apr_pool_t* child;
- apr_status_t stat = apr_pool_create(&child, pool);
+ apr_pool_t* child;
+ apr_status_t stat = apr_pool_create(&child, pool);
- if (stat != APR_SUCCESS)
- {
- throw PoolException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw PoolException(stat);
+ }
- return child;
+ return child;
}
void* Pool::palloc(size_t size)
{
- return apr_palloc(pool, size);
+ return apr_palloc(pool, size);
}
char* Pool::pstralloc(size_t size)
{
- return (char*) palloc(size);
+ return (char*) palloc(size);
}
char* Pool::itoa(int n)
{
- return apr_itoa(pool, n);
+ return apr_itoa(pool, n);
}
char* Pool::pstrndup(const char* s, size_t len)
{
- return apr_pstrndup(pool, s, len);
+ return apr_pstrndup(pool, s, len);
}
char* Pool::pstrdup(const char* s)
{
- return apr_pstrdup(pool, s);
+ return apr_pstrdup(pool, s);
}
char* Pool::pstrdup(const std::string& s)
{
- return apr_pstrndup(pool, s.data(), s.length());
+ return apr_pstrndup(pool, s.data(), s.length());
}
diff --git a/src/main/cpp/properties.cpp b/src/main/cpp/properties.cpp
index c11dbf5..0ba9e16 100644
--- a/src/main/cpp/properties.cpp
+++ b/src/main/cpp/properties.cpp
@@ -26,373 +26,373 @@
class PropertyParser
{
- public:
- void parse(LogString& in, Properties& properties)
- {
- LogString key, element;
- LexemType lexemType = BEGIN;
- logchar c;
- bool finished = false;
+ public:
+ void parse(LogString& in, Properties& properties)
+ {
+ LogString key, element;
+ LexemType lexemType = BEGIN;
+ logchar c;
+ bool finished = false;
- if (!get(in, c))
- {
- return;
- }
+ if (!get(in, c))
+ {
+ return;
+ }
- while (!finished)
- {
- switch (lexemType)
- {
- case BEGIN:
- switch (c)
- {
- case 0x20: // ' '
- case 0x09: // '\t'
- case 0x0A: // '\n'
- case 0x0D: // '\r'
- if (!get(in, c))
- {
- finished = true;
- }
+ while (!finished)
+ {
+ switch (lexemType)
+ {
+ case BEGIN:
+ switch (c)
+ {
+ case 0x20: // ' '
+ case 0x09: // '\t'
+ case 0x0A: // '\n'
+ case 0x0D: // '\r'
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case 0x23: // '#'
- case 0x21: // '!'
- lexemType = COMMENT;
+ case 0x23: // '#'
+ case 0x21: // '!'
+ lexemType = COMMENT;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- lexemType = KEY;
- break;
- }
+ default:
+ lexemType = KEY;
+ break;
+ }
- break;
+ break;
- case KEY:
- switch (c)
- {
- case 0x5C: // '\\'
- lexemType = KEY_ESCAPE;
+ case KEY:
+ switch (c)
+ {
+ case 0x5C: // '\\'
+ lexemType = KEY_ESCAPE;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case 0x09: // '\t'
- case 0x20: // ' '
- case 0x3A: // ':'
- case 0x3D: // '='
- lexemType = DELIMITER;
+ case 0x09: // '\t'
+ case 0x20: // ' '
+ case 0x3A: // ':'
+ case 0x3D: // '='
+ lexemType = DELIMITER;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case 0x0A:
- case 0x0D:
- // key associated with an empty string element
- properties.setProperty(key, LogString());
- key.erase(key.begin(), key.end());
- lexemType = BEGIN;
+ case 0x0A:
+ case 0x0D:
+ // key associated with an empty string element
+ properties.setProperty(key, LogString());
+ key.erase(key.begin(), key.end());
+ lexemType = BEGIN;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- key.append(1, c);
+ default:
+ key.append(1, c);
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
- }
+ break;
+ }
- break;
+ break;
- case KEY_ESCAPE:
- switch (c)
- {
- case 0x74: // 't'
- key.append(1, 0x09);
- lexemType = KEY;
- break;
+ case KEY_ESCAPE:
+ switch (c)
+ {
+ case 0x74: // 't'
+ key.append(1, 0x09);
+ lexemType = KEY;
+ break;
- case 0x6E: // 'n'
- key.append(1, 0x0A);
- lexemType = KEY;
- break;
+ case 0x6E: // 'n'
+ key.append(1, 0x0A);
+ lexemType = KEY;
+ break;
- case 0x72: // 'r'
- key.append(1, 0x0D);
- lexemType = KEY;
- break;
+ case 0x72: // 'r'
+ key.append(1, 0x0D);
+ lexemType = KEY;
+ break;
- case 0x0A: // '\n'
- lexemType = KEY_CONTINUE;
- break;
+ case 0x0A: // '\n'
+ lexemType = KEY_CONTINUE;
+ break;
- case 0x0D: // '\r'
- lexemType = KEY_CONTINUE2;
- break;
+ case 0x0D: // '\r'
+ lexemType = KEY_CONTINUE2;
+ break;
- default:
- key.append(1, c);
- lexemType = KEY;
- }
+ default:
+ key.append(1, c);
+ lexemType = KEY;
+ }
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case KEY_CONTINUE:
- switch (c)
- {
- case 0x20: // ' '
- case 0x09: // '\t'
- if (!get(in, c))
- {
- finished = true;
- }
+ case KEY_CONTINUE:
+ switch (c)
+ {
+ case 0x20: // ' '
+ case 0x09: // '\t'
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- lexemType = KEY;
- break;
- }
+ default:
+ lexemType = KEY;
+ break;
+ }
- break;
+ break;
- case KEY_CONTINUE2:
- switch (c)
- {
- case 0x0A: // '\n'
- if (!get(in, c))
- {
- finished = true;
- }
+ case KEY_CONTINUE2:
+ switch (c)
+ {
+ case 0x0A: // '\n'
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- lexemType = KEY_CONTINUE;
- break;
+ lexemType = KEY_CONTINUE;
+ break;
- default:
- lexemType = KEY_CONTINUE;
- break;
- }
+ default:
+ lexemType = KEY_CONTINUE;
+ break;
+ }
- break;
+ break;
- case DELIMITER:
- switch (c)
- {
- case 0x09: // '\t'
- case 0x20: // ' '
- case 0x3A: // ':'
- case 0x3D: // '='
- if (!get(in, c))
- {
- finished = true;
- }
+ case DELIMITER:
+ switch (c)
+ {
+ case 0x09: // '\t'
+ case 0x20: // ' '
+ case 0x3A: // ':'
+ case 0x3D: // '='
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- lexemType = ELEMENT;
- break;
- }
+ default:
+ lexemType = ELEMENT;
+ break;
+ }
- break;
+ break;
- case ELEMENT:
- switch (c)
- {
- case 0x5C: // '\\'
- lexemType = ELEMENT_ESCAPE;
+ case ELEMENT:
+ switch (c)
+ {
+ case 0x5C: // '\\'
+ lexemType = ELEMENT_ESCAPE;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case 0x0A: // '\n'
- case 0x0D: // '\r'
- // key associated with an empty string element
- properties.setProperty(key, element);
- key.erase(key.begin(), key.end());
- element.erase(element.begin(), element.end());
- lexemType = BEGIN;
+ case 0x0A: // '\n'
+ case 0x0D: // '\r'
+ // key associated with an empty string element
+ properties.setProperty(key, element);
+ key.erase(key.begin(), key.end());
+ element.erase(element.begin(), element.end());
+ lexemType = BEGIN;
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- element.append(1, c);
+ default:
+ element.append(1, c);
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
- }
+ break;
+ }
- break;
+ break;
- case ELEMENT_ESCAPE:
- switch (c)
- {
- case 0x74: // 't'
- element.append(1, 0x09);
- lexemType = ELEMENT;
- break;
+ case ELEMENT_ESCAPE:
+ switch (c)
+ {
+ case 0x74: // 't'
+ element.append(1, 0x09);
+ lexemType = ELEMENT;
+ break;
- case 0x6E: // 'n'
- element.append(1, 0x0A);
- lexemType = ELEMENT;
- break;
+ case 0x6E: // 'n'
+ element.append(1, 0x0A);
+ lexemType = ELEMENT;
+ break;
- case 0x72: // 'r'
- element.append(1, 0x0D);
- lexemType = ELEMENT;
- break;
+ case 0x72: // 'r'
+ element.append(1, 0x0D);
+ lexemType = ELEMENT;
+ break;
- case 0x0A: // '\n'
- lexemType = ELEMENT_CONTINUE;
- break;
+ case 0x0A: // '\n'
+ lexemType = ELEMENT_CONTINUE;
+ break;
- case 0x0D: // '\r'
- lexemType = ELEMENT_CONTINUE2;
- break;
+ case 0x0D: // '\r'
+ lexemType = ELEMENT_CONTINUE2;
+ break;
- default:
- element.append(1, c);
- lexemType = ELEMENT;
- break;
- }
+ default:
+ element.append(1, c);
+ lexemType = ELEMENT;
+ break;
+ }
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- case ELEMENT_CONTINUE:
- switch (c)
- {
- case 0x20: // ' '
- case 0x09: // '\t'
- if (!get(in, c))
- {
- finished = true;
- }
+ case ELEMENT_CONTINUE:
+ switch (c)
+ {
+ case 0x20: // ' '
+ case 0x09: // '\t'
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
+ break;
- default:
- lexemType = ELEMENT;
- break;
- }
+ default:
+ lexemType = ELEMENT;
+ break;
+ }
- break;
+ break;
- case ELEMENT_CONTINUE2:
- switch (c)
- {
- case 0x0A: // '\n'
- if (!get(in, c))
- {
- finished = true;
- }
+ case ELEMENT_CONTINUE2:
+ switch (c)
+ {
+ case 0x0A: // '\n'
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- lexemType = ELEMENT_CONTINUE;
- break;
+ lexemType = ELEMENT_CONTINUE;
+ break;
- default:
- lexemType = ELEMENT_CONTINUE;
- break;
- }
+ default:
+ lexemType = ELEMENT_CONTINUE;
+ break;
+ }
- break;
+ break;
- case COMMENT:
- if (c == 0x0A || c == 0x0D)
- {
- lexemType = BEGIN;
- }
+ case COMMENT:
+ if (c == 0x0A || c == 0x0D)
+ {
+ lexemType = BEGIN;
+ }
- if (!get(in, c))
- {
- finished = true;
- }
+ if (!get(in, c))
+ {
+ finished = true;
+ }
- break;
- }
- }
+ break;
+ }
+ }
- if (!key.empty())
- {
- properties.setProperty(key, element);
- }
- }
+ if (!key.empty())
+ {
+ properties.setProperty(key, element);
+ }
+ }
- protected:
- static bool get(LogString& in, logchar& c)
- {
- if (in.empty())
- {
- c = 0;
- return false;
- }
+ protected:
+ static bool get(LogString& in, logchar& c)
+ {
+ if (in.empty())
+ {
+ c = 0;
+ return false;
+ }
- c = in[0];
- in.erase(in.begin());
- return true;
- }
+ c = in[0];
+ in.erase(in.begin());
+ return true;
+ }
- typedef enum
- {
- BEGIN,
- KEY,
- KEY_ESCAPE,
- KEY_CONTINUE,
- KEY_CONTINUE2,
- DELIMITER,
- ELEMENT,
- ELEMENT_ESCAPE,
- ELEMENT_CONTINUE,
- ELEMENT_CONTINUE2,
- COMMENT
- }
- LexemType;
+ typedef enum
+ {
+ BEGIN,
+ KEY,
+ KEY_ESCAPE,
+ KEY_CONTINUE,
+ KEY_CONTINUE2,
+ DELIMITER,
+ ELEMENT,
+ ELEMENT_ESCAPE,
+ ELEMENT_CONTINUE,
+ ELEMENT_CONTINUE2,
+ COMMENT
+ }
+ LexemType;
};
Properties::Properties() : properties(new PropertyMap())
@@ -401,56 +401,56 @@
Properties::~Properties()
{
- delete properties;
+ delete properties;
}
LogString Properties::setProperty(const LogString& key, const LogString& value)
{
- return put(key, value);
+ return put(key, value);
}
LogString Properties::put(const LogString& key, const LogString& value)
{
- LogString oldValue((*properties)[key]);
- (*properties)[key] = value;
- return oldValue;
+ LogString oldValue((*properties)[key]);
+ (*properties)[key] = value;
+ return oldValue;
}
LogString Properties::getProperty(const LogString& key) const
{
- return get(key);
+ return get(key);
}
LogString Properties::get(const LogString& key) const
{
- PropertyMap::const_iterator it = properties->find(key);
- return (it != properties->end()) ? it->second : LogString();
+ PropertyMap::const_iterator it = properties->find(key);
+ return (it != properties->end()) ? it->second : LogString();
}
void Properties::load(InputStreamPtr inStream)
{
- Pool pool;
- InputStreamReaderPtr lineReader(
- new InputStreamReader(inStream, CharsetDecoder::getISOLatinDecoder()));
- LogString contents = lineReader->read(pool);
- properties->clear();
- PropertyParser parser;
- parser.parse(contents, *this);
+ Pool pool;
+ InputStreamReaderPtr lineReader(
+ new InputStreamReader(inStream, CharsetDecoder::getISOLatinDecoder()));
+ LogString contents = lineReader->read(pool);
+ properties->clear();
+ PropertyParser parser;
+ parser.parse(contents, *this);
}
std::vector<LogString> Properties::propertyNames() const
{
- std::vector<LogString> names;
- names.reserve(properties->size());
+ std::vector<LogString> names;
+ names.reserve(properties->size());
- PropertyMap::const_iterator it;
+ PropertyMap::const_iterator it;
- for (it = properties->begin(); it != properties->end(); it++)
- {
- const LogString& key = it->first;
- names.push_back(key);
- }
+ for (it = properties->begin(); it != properties->end(); it++)
+ {
+ const LogString& key = it->first;
+ names.push_back(key);
+ }
- return names;
+ return names;
}
diff --git a/src/main/cpp/propertiespatternconverter.cpp b/src/main/cpp/propertiespatternconverter.cpp
index a6d7a84..b307bc7 100644
--- a/src/main/cpp/propertiespatternconverter.cpp
+++ b/src/main/cpp/propertiespatternconverter.cpp
@@ -16,7 +16,7 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -34,58 +34,58 @@
IMPLEMENT_LOG4CXX_OBJECT(PropertiesPatternConverter)
PropertiesPatternConverter::PropertiesPatternConverter(const LogString& name1,
- const LogString& propertyName) :
- LoggingEventPatternConverter(name1, LOG4CXX_STR("property")),
- option(propertyName)
+ const LogString& propertyName) :
+ LoggingEventPatternConverter(name1, LOG4CXX_STR("property")),
+ option(propertyName)
{
}
PatternConverterPtr PropertiesPatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() == 0)
- {
- static PatternConverterPtr def(new PropertiesPatternConverter(
- LOG4CXX_STR("Properties"), LOG4CXX_STR("")));
- return def;
- }
+ if (options.size() == 0)
+ {
+ static PatternConverterPtr def(new PropertiesPatternConverter(
+ LOG4CXX_STR("Properties"), LOG4CXX_STR("")));
+ return def;
+ }
- LogString converterName(LOG4CXX_STR("Property{"));
- converterName.append(options[0]);
- converterName.append(LOG4CXX_STR("}"));
- PatternConverterPtr converter(new PropertiesPatternConverter(
- converterName, options[0]));
- return converter;
+ LogString converterName(LOG4CXX_STR("Property{"));
+ converterName.append(options[0]);
+ converterName.append(LOG4CXX_STR("}"));
+ PatternConverterPtr converter(new PropertiesPatternConverter(
+ converterName, options[0]));
+ return converter;
}
void PropertiesPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- if (option.length() == 0)
- {
- toAppendTo.append(1, (logchar) 0x7B /* '{' */);
+ if (option.length() == 0)
+ {
+ toAppendTo.append(1, (logchar) 0x7B /* '{' */);
- LoggingEvent::KeySet keySet(event->getMDCKeySet());
+ LoggingEvent::KeySet keySet(event->getMDCKeySet());
- for (LoggingEvent::KeySet::const_iterator iter = keySet.begin();
- iter != keySet.end();
- iter++)
- {
- toAppendTo.append(1, (logchar) 0x7B /* '{' */);
- toAppendTo.append(*iter);
- toAppendTo.append(1, (logchar) 0x2C /* ',' */);
- event->getMDC(*iter, toAppendTo);
- toAppendTo.append(1, (logchar) 0x7D /* '}' */);
- }
+ for (LoggingEvent::KeySet::const_iterator iter = keySet.begin();
+ iter != keySet.end();
+ iter++)
+ {
+ toAppendTo.append(1, (logchar) 0x7B /* '{' */);
+ toAppendTo.append(*iter);
+ toAppendTo.append(1, (logchar) 0x2C /* ',' */);
+ event->getMDC(*iter, toAppendTo);
+ toAppendTo.append(1, (logchar) 0x7D /* '}' */);
+ }
- toAppendTo.append(1, (logchar) 0x7D /* '}' */);
+ toAppendTo.append(1, (logchar) 0x7D /* '}' */);
- }
- else
- {
- event->getMDC(option, toAppendTo);
- }
+ }
+ else
+ {
+ event->getMDC(option, toAppendTo);
+ }
}
diff --git a/src/main/cpp/propertyconfigurator.cpp b/src/main/cpp/propertyconfigurator.cpp
index c572c59..56eb1d2 100644
--- a/src/main/cpp/propertyconfigurator.cpp
+++ b/src/main/cpp/propertyconfigurator.cpp
@@ -55,21 +55,21 @@
{
class PropertyWatchdog : public FileWatchdog
{
- public:
- PropertyWatchdog(const File& filename) : FileWatchdog(filename)
- {
- }
+ public:
+ PropertyWatchdog(const File& filename) : FileWatchdog(filename)
+ {
+ }
- /**
- Call PropertyConfigurator#doConfigure(const String& configFileName,
- const spi::LoggerRepositoryPtr& hierarchy) with the
- <code>filename</code> to reconfigure log4cxx.
- */
- void doOnChange()
- {
- PropertyConfigurator().doConfigure(file,
- LogManager::getLoggerRepository());
- }
+ /**
+ Call PropertyConfigurator#doConfigure(const String& configFileName,
+ const spi::LoggerRepositoryPtr& hierarchy) with the
+ <code>filename</code> to reconfigure log4cxx.
+ */
+ void doOnChange()
+ {
+ PropertyConfigurator().doConfigure(file,
+ LogManager::getLoggerRepository());
+ }
};
}
@@ -80,406 +80,406 @@
IMPLEMENT_LOG4CXX_OBJECT(PropertyConfigurator)
PropertyConfigurator::PropertyConfigurator()
- : registry(new std::map<LogString, AppenderPtr>()), loggerFactory(new DefaultLoggerFactory())
+ : registry(new std::map<LogString, AppenderPtr>()), loggerFactory(new DefaultLoggerFactory())
{
}
PropertyConfigurator::~PropertyConfigurator()
{
- delete registry;
+ delete registry;
}
void PropertyConfigurator::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void PropertyConfigurator::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void PropertyConfigurator::doConfigure(const File& configFileName,
- spi::LoggerRepositoryPtr& hierarchy)
+ spi::LoggerRepositoryPtr& hierarchy)
{
- hierarchy->setConfigured(true);
+ hierarchy->setConfigured(true);
- Properties props;
+ Properties props;
- try
- {
- InputStreamPtr inputStream = new FileInputStream(configFileName);
- props.load(inputStream);
- }
- catch (const IOException& ie)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Could not read configuration file ["))
- + configFileName.getPath() + LOG4CXX_STR("]."));
- return;
- }
+ try
+ {
+ InputStreamPtr inputStream = new FileInputStream(configFileName);
+ props.load(inputStream);
+ }
+ catch (const IOException& ie)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Could not read configuration file ["))
+ + configFileName.getPath() + LOG4CXX_STR("]."));
+ return;
+ }
- try
- {
- doConfigure(props, hierarchy);
- }
- catch (const std::exception& ex)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Could not parse configuration file ["))
- + configFileName.getPath() + LOG4CXX_STR("]."), ex);
- }
+ try
+ {
+ doConfigure(props, hierarchy);
+ }
+ catch (const std::exception& ex)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Could not parse configuration file ["))
+ + configFileName.getPath() + LOG4CXX_STR("]."), ex);
+ }
}
void PropertyConfigurator::configure(const File& configFilename)
{
- PropertyConfigurator().doConfigure(configFilename, LogManager::getLoggerRepository());
+ PropertyConfigurator().doConfigure(configFilename, LogManager::getLoggerRepository());
}
void PropertyConfigurator::configure(helpers::Properties& properties)
{
- PropertyConfigurator().doConfigure(properties, LogManager::getLoggerRepository());
+ PropertyConfigurator().doConfigure(properties, LogManager::getLoggerRepository());
}
#if APR_HAS_THREADS
void PropertyConfigurator::configureAndWatch(const File& configFilename)
{
- configureAndWatch(configFilename, FileWatchdog::DEFAULT_DELAY);
+ configureAndWatch(configFilename, FileWatchdog::DEFAULT_DELAY);
}
void PropertyConfigurator::configureAndWatch(
- const File& configFilename, long delay)
+ const File& configFilename, long delay)
{
- if (pdog)
- {
- APRInitializer::unregisterCleanup(pdog);
- delete pdog;
- }
+ if (pdog)
+ {
+ APRInitializer::unregisterCleanup(pdog);
+ delete pdog;
+ }
- pdog = new PropertyWatchdog(configFilename);
- APRInitializer::registerCleanup(pdog);
- pdog->setDelay(delay);
- pdog->start();
+ pdog = new PropertyWatchdog(configFilename);
+ APRInitializer::registerCleanup(pdog);
+ pdog->setDelay(delay);
+ pdog->start();
}
#endif
void PropertyConfigurator::doConfigure(helpers::Properties& properties,
- spi::LoggerRepositoryPtr& hierarchy)
+ spi::LoggerRepositoryPtr& hierarchy)
{
- hierarchy->setConfigured(true);
+ hierarchy->setConfigured(true);
- static const LogString DEBUG_KEY(LOG4CXX_STR("log4j.debug"));
- LogString value(properties.getProperty(DEBUG_KEY));
+ static const LogString DEBUG_KEY(LOG4CXX_STR("log4j.debug"));
+ LogString value(properties.getProperty(DEBUG_KEY));
- if (!value.empty())
- {
- LogLog::setInternalDebugging(OptionConverter::toBoolean(value, true));
- }
+ if (!value.empty())
+ {
+ LogLog::setInternalDebugging(OptionConverter::toBoolean(value, true));
+ }
- static const LogString THRESHOLD_PREFIX(LOG4CXX_STR("log4j.threshold"));
- LogString thresholdStr =
- OptionConverter::findAndSubst(THRESHOLD_PREFIX, properties);
+ static const LogString THRESHOLD_PREFIX(LOG4CXX_STR("log4j.threshold"));
+ LogString thresholdStr =
+ OptionConverter::findAndSubst(THRESHOLD_PREFIX, properties);
- if (!thresholdStr.empty())
- {
- hierarchy->setThreshold(OptionConverter::toLevel(thresholdStr, Level::getAll()));
- LogLog::debug(((LogString) LOG4CXX_STR("Hierarchy threshold set to ["))
- + hierarchy->getThreshold()->toString()
- + LOG4CXX_STR("]."));
- }
+ if (!thresholdStr.empty())
+ {
+ hierarchy->setThreshold(OptionConverter::toLevel(thresholdStr, Level::getAll()));
+ LogLog::debug(((LogString) LOG4CXX_STR("Hierarchy threshold set to ["))
+ + hierarchy->getThreshold()->toString()
+ + LOG4CXX_STR("]."));
+ }
- static const LogString STRINGSTREAM_KEY(LOG4CXX_STR("log4j.stringstream"));
- LogString strstrValue(properties.getProperty(STRINGSTREAM_KEY));
+ static const LogString STRINGSTREAM_KEY(LOG4CXX_STR("log4j.stringstream"));
+ LogString strstrValue(properties.getProperty(STRINGSTREAM_KEY));
- if (strstrValue == LOG4CXX_STR("static"))
- {
- MessageBufferUseStaticStream();
- }
+ if (strstrValue == LOG4CXX_STR("static"))
+ {
+ MessageBufferUseStaticStream();
+ }
- configureRootLogger(properties, hierarchy);
- configureLoggerFactory(properties);
- parseCatsAndRenderers(properties, hierarchy);
+ configureRootLogger(properties, hierarchy);
+ configureLoggerFactory(properties);
+ parseCatsAndRenderers(properties, hierarchy);
- LogLog::debug(LOG4CXX_STR("Finished configuring."));
+ LogLog::debug(LOG4CXX_STR("Finished configuring."));
- // We don't want to hold references to appenders preventing their
- // destruction.
- registry->clear();
+ // We don't want to hold references to appenders preventing their
+ // destruction.
+ registry->clear();
}
void PropertyConfigurator::configureLoggerFactory(helpers::Properties& props)
{
- static const LogString LOGGER_FACTORY_KEY(LOG4CXX_STR("log4j.loggerFactory"));
+ static const LogString LOGGER_FACTORY_KEY(LOG4CXX_STR("log4j.loggerFactory"));
- LogString factoryClassName =
- OptionConverter::findAndSubst(LOGGER_FACTORY_KEY, props);
+ LogString factoryClassName =
+ OptionConverter::findAndSubst(LOGGER_FACTORY_KEY, props);
- if (!factoryClassName.empty())
- {
- LogString msg(LOG4CXX_STR("Setting logger factory to ["));
- msg += factoryClassName;
- msg += LOG4CXX_STR("].");
- LogLog::debug(msg);
- loggerFactory =
- OptionConverter::instantiateByClassName(
- factoryClassName, LoggerFactory::getStaticClass(), loggerFactory);
- static const LogString FACTORY_PREFIX(LOG4CXX_STR("log4j.factory."));
- Pool p;
- PropertySetter::setProperties(loggerFactory, props, FACTORY_PREFIX, p);
- }
+ if (!factoryClassName.empty())
+ {
+ LogString msg(LOG4CXX_STR("Setting logger factory to ["));
+ msg += factoryClassName;
+ msg += LOG4CXX_STR("].");
+ LogLog::debug(msg);
+ loggerFactory =
+ OptionConverter::instantiateByClassName(
+ factoryClassName, LoggerFactory::getStaticClass(), loggerFactory);
+ static const LogString FACTORY_PREFIX(LOG4CXX_STR("log4j.factory."));
+ Pool p;
+ PropertySetter::setProperties(loggerFactory, props, FACTORY_PREFIX, p);
+ }
}
void PropertyConfigurator::configureRootLogger(helpers::Properties& props,
- spi::LoggerRepositoryPtr& hierarchy)
+ spi::LoggerRepositoryPtr& hierarchy)
{
- static const LogString ROOT_CATEGORY_PREFIX(LOG4CXX_STR("log4j.rootCategory"));
- static const LogString ROOT_LOGGER_PREFIX(LOG4CXX_STR("log4j.rootLogger"));
+ static const LogString ROOT_CATEGORY_PREFIX(LOG4CXX_STR("log4j.rootCategory"));
+ static const LogString ROOT_LOGGER_PREFIX(LOG4CXX_STR("log4j.rootLogger"));
- LogString effectiveFrefix(ROOT_LOGGER_PREFIX);
- LogString value = OptionConverter::findAndSubst(ROOT_LOGGER_PREFIX, props);
+ LogString effectiveFrefix(ROOT_LOGGER_PREFIX);
+ LogString value = OptionConverter::findAndSubst(ROOT_LOGGER_PREFIX, props);
- if (value.empty())
- {
- value = OptionConverter::findAndSubst(ROOT_CATEGORY_PREFIX, props);
- effectiveFrefix = ROOT_CATEGORY_PREFIX;
- }
+ if (value.empty())
+ {
+ value = OptionConverter::findAndSubst(ROOT_CATEGORY_PREFIX, props);
+ effectiveFrefix = ROOT_CATEGORY_PREFIX;
+ }
- if (value.empty())
- {
- LogLog::debug(LOG4CXX_STR("Could not find root logger information. Is this OK?"));
- }
- else
- {
- LoggerPtr root = hierarchy->getRootLogger();
+ if (value.empty())
+ {
+ LogLog::debug(LOG4CXX_STR("Could not find root logger information. Is this OK?"));
+ }
+ else
+ {
+ LoggerPtr root = hierarchy->getRootLogger();
- LOCK_W sync(root->getMutex());
- static const LogString INTERNAL_ROOT_NAME(LOG4CXX_STR("root"));
- parseLogger(props, root, effectiveFrefix, INTERNAL_ROOT_NAME, value);
- }
+ LOCK_W sync(root->getMutex());
+ static const LogString INTERNAL_ROOT_NAME(LOG4CXX_STR("root"));
+ parseLogger(props, root, effectiveFrefix, INTERNAL_ROOT_NAME, value);
+ }
}
void PropertyConfigurator::parseCatsAndRenderers(helpers::Properties& props,
- spi::LoggerRepositoryPtr& hierarchy)
+ spi::LoggerRepositoryPtr& hierarchy)
{
- static const LogString CATEGORY_PREFIX(LOG4CXX_STR("log4j.category."));
- static const LogString LOGGER_PREFIX(LOG4CXX_STR("log4j.logger."));
+ static const LogString CATEGORY_PREFIX(LOG4CXX_STR("log4j.category."));
+ static const LogString LOGGER_PREFIX(LOG4CXX_STR("log4j.logger."));
- std::vector<LogString> names = props.propertyNames();
+ std::vector<LogString> names = props.propertyNames();
- std::vector<LogString>::iterator it = names.begin();
- std::vector<LogString>::iterator itEnd = names.end();
+ std::vector<LogString>::iterator it = names.begin();
+ std::vector<LogString>::iterator itEnd = names.end();
- while (it != itEnd)
- {
- LogString key = *it++;
+ while (it != itEnd)
+ {
+ LogString key = *it++;
- if (key.find(CATEGORY_PREFIX) == 0 || key.find(LOGGER_PREFIX) == 0)
- {
- LogString loggerName;
+ if (key.find(CATEGORY_PREFIX) == 0 || key.find(LOGGER_PREFIX) == 0)
+ {
+ LogString loggerName;
- if (key.find(CATEGORY_PREFIX) == 0)
- {
- loggerName = key.substr(CATEGORY_PREFIX.length());
- }
- else if (key.find(LOGGER_PREFIX) == 0)
- {
- loggerName = key.substr(LOGGER_PREFIX.length());
- }
+ if (key.find(CATEGORY_PREFIX) == 0)
+ {
+ loggerName = key.substr(CATEGORY_PREFIX.length());
+ }
+ else if (key.find(LOGGER_PREFIX) == 0)
+ {
+ loggerName = key.substr(LOGGER_PREFIX.length());
+ }
- LogString value = OptionConverter::findAndSubst(key, props);
- LoggerPtr logger = hierarchy->getLogger(loggerName, loggerFactory);
+ LogString value = OptionConverter::findAndSubst(key, props);
+ LoggerPtr logger = hierarchy->getLogger(loggerName, loggerFactory);
- LOCK_W sync(logger->getMutex());
- parseLogger(props, logger, key, loggerName, value);
- parseAdditivityForLogger(props, logger, loggerName);
- }
- }
+ LOCK_W sync(logger->getMutex());
+ parseLogger(props, logger, key, loggerName, value);
+ parseAdditivityForLogger(props, logger, loggerName);
+ }
+ }
}
void PropertyConfigurator::parseAdditivityForLogger(helpers::Properties& props,
- LoggerPtr& cat, const LogString& loggerName)
+ LoggerPtr& cat, const LogString& loggerName)
{
- static const LogString ADDITIVITY_PREFIX(LOG4CXX_STR("log4j.additivity."));
+ static const LogString ADDITIVITY_PREFIX(LOG4CXX_STR("log4j.additivity."));
- LogString value(OptionConverter::findAndSubst(ADDITIVITY_PREFIX + loggerName, props));
- LogLog::debug((LogString) LOG4CXX_STR("Handling ") + ADDITIVITY_PREFIX
- + loggerName + LOG4CXX_STR("=[") + value + LOG4CXX_STR("]"));
+ LogString value(OptionConverter::findAndSubst(ADDITIVITY_PREFIX + loggerName, props));
+ LogLog::debug((LogString) LOG4CXX_STR("Handling ") + ADDITIVITY_PREFIX
+ + loggerName + LOG4CXX_STR("=[") + value + LOG4CXX_STR("]"));
- // touch additivity only if necessary
- if (!value.empty())
- {
- bool additivity = OptionConverter::toBoolean(value, true);
- LogLog::debug(((LogString) LOG4CXX_STR("Setting additivity for \""))
- + loggerName
- + ((additivity) ? LOG4CXX_STR("\" to true") :
- LOG4CXX_STR("\" to false")));
- cat->setAdditivity(additivity);
- }
+ // touch additivity only if necessary
+ if (!value.empty())
+ {
+ bool additivity = OptionConverter::toBoolean(value, true);
+ LogLog::debug(((LogString) LOG4CXX_STR("Setting additivity for \""))
+ + loggerName
+ + ((additivity) ? LOG4CXX_STR("\" to true") :
+ LOG4CXX_STR("\" to false")));
+ cat->setAdditivity(additivity);
+ }
}
/**
This method must work for the root logger as well.
*/
void PropertyConfigurator::parseLogger(
- helpers::Properties& props, LoggerPtr& logger, const LogString& /* optionKey */,
- const LogString& loggerName, const LogString& value)
+ helpers::Properties& props, LoggerPtr& logger, const LogString& /* optionKey */,
+ const LogString& loggerName, const LogString& value)
{
- LogLog::debug(((LogString) LOG4CXX_STR("Parsing for ["))
- + loggerName
- + LOG4CXX_STR("] with value=[")
- + value + LOG4CXX_STR("]."));
+ LogLog::debug(((LogString) LOG4CXX_STR("Parsing for ["))
+ + loggerName
+ + LOG4CXX_STR("] with value=[")
+ + value + LOG4CXX_STR("]."));
- // We must skip over ',' but not white space
- StringTokenizer st(value, LOG4CXX_STR(","));
+ // We must skip over ',' but not white space
+ StringTokenizer st(value, LOG4CXX_STR(","));
- // If value is not in the form ", appender.." or "", then we should set
- // the level of the logger.
- if (!(value.find(LOG4CXX_STR(",")) == 0 || value.empty()))
- {
- // just to be on the safe side...
- if (!st.hasMoreTokens())
- {
- return;
- }
+ // If value is not in the form ", appender.." or "", then we should set
+ // the level of the logger.
+ if (!(value.find(LOG4CXX_STR(",")) == 0 || value.empty()))
+ {
+ // just to be on the safe side...
+ if (!st.hasMoreTokens())
+ {
+ return;
+ }
- LogString levelStr = st.nextToken();
- LogLog::debug((LogString) LOG4CXX_STR("Level token is [")
- + levelStr + LOG4CXX_STR("]."));
+ LogString levelStr = st.nextToken();
+ LogLog::debug((LogString) LOG4CXX_STR("Level token is [")
+ + levelStr + LOG4CXX_STR("]."));
- // If the level value is inherited, set logger level value to
- // null. We also check that the user has not specified inherited for the
- // root logger.
- if (StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("INHERITED"), LOG4CXX_STR("inherited"))
- || StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
- {
- static const LogString INTERNAL_ROOT_NAME(LOG4CXX_STR("root"));
+ // If the level value is inherited, set logger level value to
+ // null. We also check that the user has not specified inherited for the
+ // root logger.
+ if (StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("INHERITED"), LOG4CXX_STR("inherited"))
+ || StringHelper::equalsIgnoreCase(levelStr, LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
+ {
+ static const LogString INTERNAL_ROOT_NAME(LOG4CXX_STR("root"));
- if (loggerName == INTERNAL_ROOT_NAME)
- {
- LogLog::warn(LOG4CXX_STR("The root logger cannot be set to null."));
- }
- else
- {
- logger->setLevel(0);
- LogLog::debug((LogString) LOG4CXX_STR("Logger ")
- + loggerName + LOG4CXX_STR(" set to null"));
- }
- }
- else
- {
- logger->setLevel(OptionConverter::toLevel(levelStr, Level::getDebug()));
+ if (loggerName == INTERNAL_ROOT_NAME)
+ {
+ LogLog::warn(LOG4CXX_STR("The root logger cannot be set to null."));
+ }
+ else
+ {
+ logger->setLevel(0);
+ LogLog::debug((LogString) LOG4CXX_STR("Logger ")
+ + loggerName + LOG4CXX_STR(" set to null"));
+ }
+ }
+ else
+ {
+ logger->setLevel(OptionConverter::toLevel(levelStr, Level::getDebug()));
- LogLog::debug((LogString) LOG4CXX_STR("Logger ")
- + loggerName + LOG4CXX_STR(" set to ")
- + logger->getLevel()->toString());
- }
+ LogLog::debug((LogString) LOG4CXX_STR("Logger ")
+ + loggerName + LOG4CXX_STR(" set to ")
+ + logger->getLevel()->toString());
+ }
- }
+ }
- // Begin by removing all existing appenders.
- logger->removeAllAppenders();
+ // Begin by removing all existing appenders.
+ logger->removeAllAppenders();
- AppenderPtr appender;
- LogString appenderName;
+ AppenderPtr appender;
+ LogString appenderName;
- while (st.hasMoreTokens())
- {
- appenderName = StringHelper::trim(st.nextToken());
+ while (st.hasMoreTokens())
+ {
+ appenderName = StringHelper::trim(st.nextToken());
- if (appenderName.empty() || appenderName == LOG4CXX_STR(","))
- {
- continue;
- }
+ if (appenderName.empty() || appenderName == LOG4CXX_STR(","))
+ {
+ continue;
+ }
- LogLog::debug(LOG4CXX_STR("Parsing appender named ")
- + appenderName + LOG4CXX_STR("\"."));
- appender = parseAppender(props, appenderName);
+ LogLog::debug(LOG4CXX_STR("Parsing appender named ")
+ + appenderName + LOG4CXX_STR("\"."));
+ appender = parseAppender(props, appenderName);
- if (appender != 0)
- {
- logger->addAppender(appender);
- }
- }
+ if (appender != 0)
+ {
+ logger->addAppender(appender);
+ }
+ }
}
AppenderPtr PropertyConfigurator::parseAppender(
- helpers::Properties& props, const LogString& appenderName)
+ helpers::Properties& props, const LogString& appenderName)
{
- AppenderPtr appender = registryGet(appenderName);
+ AppenderPtr appender = registryGet(appenderName);
- if (appender != 0)
- {
- LogLog::debug((LogString) LOG4CXX_STR("Appender \"")
- + appenderName + LOG4CXX_STR("\" was already parsed."));
+ if (appender != 0)
+ {
+ LogLog::debug((LogString) LOG4CXX_STR("Appender \"")
+ + appenderName + LOG4CXX_STR("\" was already parsed."));
- return appender;
- }
+ return appender;
+ }
- static const LogString APPENDER_PREFIX(LOG4CXX_STR("log4j.appender."));
+ static const LogString APPENDER_PREFIX(LOG4CXX_STR("log4j.appender."));
- // Appender was not previously initialized.
- LogString prefix = APPENDER_PREFIX + appenderName;
- LogString layoutPrefix = prefix + LOG4CXX_STR(".layout");
+ // Appender was not previously initialized.
+ LogString prefix = APPENDER_PREFIX + appenderName;
+ LogString layoutPrefix = prefix + LOG4CXX_STR(".layout");
- appender =
- OptionConverter::instantiateByKey(
- props, prefix, Appender::getStaticClass(), 0);
+ appender =
+ OptionConverter::instantiateByKey(
+ props, prefix, Appender::getStaticClass(), 0);
- if (appender == 0)
- {
- LogLog::error((LogString) LOG4CXX_STR("Could not instantiate appender named \"")
- + appenderName + LOG4CXX_STR("\"."));
- return 0;
- }
+ if (appender == 0)
+ {
+ LogLog::error((LogString) LOG4CXX_STR("Could not instantiate appender named \"")
+ + appenderName + LOG4CXX_STR("\"."));
+ return 0;
+ }
- appender->setName(appenderName);
+ appender->setName(appenderName);
- if (appender->instanceof(OptionHandler::getStaticClass()))
- {
- Pool p;
+ if (appender->instanceof(OptionHandler::getStaticClass()))
+ {
+ Pool p;
- if (appender->requiresLayout())
- {
- LayoutPtr layout =
- OptionConverter::instantiateByKey(
- props, layoutPrefix, Layout::getStaticClass(), 0);
+ if (appender->requiresLayout())
+ {
+ LayoutPtr layout =
+ OptionConverter::instantiateByKey(
+ props, layoutPrefix, Layout::getStaticClass(), 0);
- if (layout != 0)
- {
- appender->setLayout(layout);
- LogLog::debug((LogString) LOG4CXX_STR("Parsing layout options for \"")
- + appenderName + LOG4CXX_STR("\"."));
+ if (layout != 0)
+ {
+ appender->setLayout(layout);
+ LogLog::debug((LogString) LOG4CXX_STR("Parsing layout options for \"")
+ + appenderName + LOG4CXX_STR("\"."));
- //configureOptionHandler(layout, layoutPrefix + ".", props);
- PropertySetter::setProperties(layout, props, layoutPrefix + LOG4CXX_STR("."), p);
- LogLog::debug((LogString) LOG4CXX_STR("End of parsing for \"")
- + appenderName + LOG4CXX_STR("\"."));
- }
- }
+ //configureOptionHandler(layout, layoutPrefix + ".", props);
+ PropertySetter::setProperties(layout, props, layoutPrefix + LOG4CXX_STR("."), p);
+ LogLog::debug((LogString) LOG4CXX_STR("End of parsing for \"")
+ + appenderName + LOG4CXX_STR("\"."));
+ }
+ }
- //configureOptionHandler((OptionHandler) appender, prefix + _T("."), props);
- PropertySetter::setProperties(appender, props, prefix + LOG4CXX_STR("."), p);
- LogLog::debug((LogString) LOG4CXX_STR("Parsed \"")
- + appenderName + LOG4CXX_STR("\" options."));
- }
+ //configureOptionHandler((OptionHandler) appender, prefix + _T("."), props);
+ PropertySetter::setProperties(appender, props, prefix + LOG4CXX_STR("."), p);
+ LogLog::debug((LogString) LOG4CXX_STR("Parsed \"")
+ + appenderName + LOG4CXX_STR("\" options."));
+ }
- registryPut(appender);
+ registryPut(appender);
- return appender;
+ return appender;
}
void PropertyConfigurator::registryPut(const AppenderPtr& appender)
{
- (*registry)[appender->getName()] = appender;
+ (*registry)[appender->getName()] = appender;
}
AppenderPtr PropertyConfigurator::registryGet(const LogString& name)
{
- return (*registry)[name];
+ return (*registry)[name];
}
diff --git a/src/main/cpp/propertyresourcebundle.cpp b/src/main/cpp/propertyresourcebundle.cpp
index e99170d..2ae4ae7 100644
--- a/src/main/cpp/propertyresourcebundle.cpp
+++ b/src/main/cpp/propertyresourcebundle.cpp
@@ -18,7 +18,7 @@
#include <log4cxx/helpers/propertyresourcebundle.h>
#include <log4cxx/helpers/exception.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -30,29 +30,29 @@
PropertyResourceBundle::PropertyResourceBundle(InputStreamPtr inStream)
{
- properties.load(inStream);
+ properties.load(inStream);
}
LogString PropertyResourceBundle::getString(const LogString& key) const
{
- LogString resource;
- PropertyResourceBundlePtr resourceBundle(const_cast<PropertyResourceBundle*>(this));
+ LogString resource;
+ PropertyResourceBundlePtr resourceBundle(const_cast<PropertyResourceBundle*>(this));
- do
- {
- resource = resourceBundle->properties.getProperty(key);
+ do
+ {
+ resource = resourceBundle->properties.getProperty(key);
- if (!resource.empty())
- {
- return resource;
- }
+ if (!resource.empty())
+ {
+ return resource;
+ }
- resourceBundle = resourceBundle->parent;
- }
- while (resourceBundle != 0);
+ resourceBundle = resourceBundle->parent;
+ }
+ while (resourceBundle != 0);
- throw MissingResourceException(key);
+ throw MissingResourceException(key);
#if LOG4CXX_RETURN_AFTER_THROW
- return resource;
+ return resource;
#endif
}
diff --git a/src/main/cpp/propertysetter.cpp b/src/main/cpp/propertysetter.cpp
index 0efd49e..c1ce878 100644
--- a/src/main/cpp/propertysetter.cpp
+++ b/src/main/cpp/propertysetter.cpp
@@ -36,74 +36,74 @@
}
void PropertySetter::setProperties(const helpers::ObjectPtr& obj,
- helpers::Properties& properties,
- const LogString& prefix,
- Pool& p)
+ helpers::Properties& properties,
+ const LogString& prefix,
+ Pool& p)
{
- PropertySetter(obj).setProperties(properties, prefix, p);
+ PropertySetter(obj).setProperties(properties, prefix, p);
}
void PropertySetter::setProperties(helpers::Properties& properties,
- const LogString& prefix,
- Pool& p)
+ const LogString& prefix,
+ Pool& p)
{
- int len = prefix.length();
+ int len = prefix.length();
- std::vector<LogString> names = properties.propertyNames();
- std::vector<LogString>::iterator it;
+ std::vector<LogString> names = properties.propertyNames();
+ std::vector<LogString>::iterator it;
- for (it = names.begin(); it != names.end(); it++)
- {
- LogString key = *it;
+ for (it = names.begin(); it != names.end(); it++)
+ {
+ LogString key = *it;
- // handle only properties that start with the desired frefix.
- if (key.find(prefix) == 0)
- {
- // ignore key if it contains dots after the prefix
- if (key.find(0x2E /* '.' */, len + 1) != LogString::npos)
- {
- continue;
- }
+ // handle only properties that start with the desired frefix.
+ if (key.find(prefix) == 0)
+ {
+ // ignore key if it contains dots after the prefix
+ if (key.find(0x2E /* '.' */, len + 1) != LogString::npos)
+ {
+ continue;
+ }
- LogString value = OptionConverter::findAndSubst(key, properties);
- key = key.substr(len);
+ LogString value = OptionConverter::findAndSubst(key, properties);
+ key = key.substr(len);
- if (key == LOG4CXX_STR("layout")
- && obj != 0
- && obj->instanceof(Appender::getStaticClass()))
- {
- continue;
- }
+ if (key == LOG4CXX_STR("layout")
+ && obj != 0
+ && obj->instanceof(Appender::getStaticClass()))
+ {
+ continue;
+ }
- setProperty(key, value, p);
- }
- }
+ setProperty(key, value, p);
+ }
+ }
- activate(p);
+ activate(p);
}
void PropertySetter::setProperty(const LogString& option,
- const LogString& value,
- Pool&)
+ const LogString& value,
+ Pool&)
{
- if (value.empty())
- {
- return;
- }
+ if (value.empty())
+ {
+ return;
+ }
- if (obj != 0 && obj->instanceof(OptionHandler::getStaticClass()))
- {
- LogLog::debug(LOG4CXX_STR("Setting option name=[") +
- option + LOG4CXX_STR("], value=[") + value + LOG4CXX_STR("]"));
- OptionHandlerPtr(obj)->setOption(option, value);
- }
+ if (obj != 0 && obj->instanceof(OptionHandler::getStaticClass()))
+ {
+ LogLog::debug(LOG4CXX_STR("Setting option name=[") +
+ option + LOG4CXX_STR("], value=[") + value + LOG4CXX_STR("]"));
+ OptionHandlerPtr(obj)->setOption(option, value);
+ }
}
void PropertySetter::activate(Pool& p)
{
- if (obj != 0 && obj->instanceof(OptionHandler::getStaticClass()))
- {
- OptionHandlerPtr(obj)->activateOptions(p);
- }
+ if (obj != 0 && obj->instanceof(OptionHandler::getStaticClass()))
+ {
+ OptionHandlerPtr(obj)->activateOptions(p);
+ }
}
diff --git a/src/main/cpp/relativetimedateformat.cpp b/src/main/cpp/relativetimedateformat.cpp
index 3433d12..70c486f 100644
--- a/src/main/cpp/relativetimedateformat.cpp
+++ b/src/main/cpp/relativetimedateformat.cpp
@@ -25,15 +25,15 @@
log4cxx::helpers::RelativeTimeDateFormat::RelativeTimeDateFormat()
- : DateFormat(), startTime(log4cxx::spi::LoggingEvent::getStartTime())
+ : DateFormat(), startTime(log4cxx::spi::LoggingEvent::getStartTime())
{
}
void log4cxx::helpers::RelativeTimeDateFormat::format(
- LogString& s,
- log4cxx_time_t date,
- Pool& p) const
+ LogString& s,
+ log4cxx_time_t date,
+ Pool& p) const
{
- log4cxx_int64_t interval = (date - startTime) / APR_INT64_C(1000);
- StringHelper::toString(interval, p, s);
+ log4cxx_int64_t interval = (date - startTime) / APR_INT64_C(1000);
+ StringHelper::toString(interval, p, s);
}
diff --git a/src/main/cpp/relativetimepatternconverter.cpp b/src/main/cpp/relativetimepatternconverter.cpp
index 7d96a6a..a290de3 100644
--- a/src/main/cpp/relativetimepatternconverter.cpp
+++ b/src/main/cpp/relativetimepatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -33,24 +33,24 @@
IMPLEMENT_LOG4CXX_OBJECT(RelativeTimePatternConverter)
RelativeTimePatternConverter::RelativeTimePatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Time"),
- LOG4CXX_STR("time"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Time"),
+ LOG4CXX_STR("time"))
{
}
PatternConverterPtr RelativeTimePatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr def(new RelativeTimePatternConverter());
- return def;
+ static PatternConverterPtr def(new RelativeTimePatternConverter());
+ return def;
}
void RelativeTimePatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& p) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& p) const
{
- log4cxx_time_t delta = (event->getTimeStamp() - LoggingEvent::getStartTime()) / 1000;
- StringHelper::toString(delta, p, toAppendTo);
+ log4cxx_time_t delta = (event->getTimeStamp() - LoggingEvent::getStartTime()) / 1000;
+ StringHelper::toString(delta, p, toAppendTo);
}
diff --git a/src/main/cpp/resourcebundle.cpp b/src/main/cpp/resourcebundle.cpp
index 8f3978c..c1c42c2 100644
--- a/src/main/cpp/resourcebundle.cpp
+++ b/src/main/cpp/resourcebundle.cpp
@@ -28,97 +28,97 @@
IMPLEMENT_LOG4CXX_OBJECT(ResourceBundle)
ResourceBundlePtr ResourceBundle::getBundle(const LogString& baseName,
- const Locale& locale)
+ const Locale& locale)
{
- LogString bundleName;
- PropertyResourceBundlePtr resourceBundle, previous;
+ LogString bundleName;
+ PropertyResourceBundlePtr resourceBundle, previous;
- std::vector<LogString> bundlesNames;
+ std::vector<LogString> bundlesNames;
- if (!locale.getVariant().empty())
- {
- bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
- locale.getLanguage() + LOG4CXX_STR("_") +
- locale.getCountry() + LOG4CXX_STR("_") +
- locale.getVariant());
- }
+ if (!locale.getVariant().empty())
+ {
+ bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
+ locale.getLanguage() + LOG4CXX_STR("_") +
+ locale.getCountry() + LOG4CXX_STR("_") +
+ locale.getVariant());
+ }
- if (!locale.getCountry().empty())
- {
- bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
- locale.getLanguage() + LOG4CXX_STR("_") +
- locale.getCountry());
- }
+ if (!locale.getCountry().empty())
+ {
+ bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
+ locale.getLanguage() + LOG4CXX_STR("_") +
+ locale.getCountry());
+ }
- if (!locale.getLanguage().empty())
- {
- bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
- locale.getLanguage());
- }
+ if (!locale.getLanguage().empty())
+ {
+ bundlesNames.push_back(baseName + LOG4CXX_STR("_") +
+ locale.getLanguage());
+ }
- bundlesNames.push_back(baseName);
+ bundlesNames.push_back(baseName);
- for (std::vector<LogString>::iterator it = bundlesNames.begin();
- it != bundlesNames.end(); it++)
- {
+ for (std::vector<LogString>::iterator it = bundlesNames.begin();
+ it != bundlesNames.end(); it++)
+ {
- bundleName = *it;
+ bundleName = *it;
- PropertyResourceBundlePtr current;
+ PropertyResourceBundlePtr current;
- // Try loading a class which implements ResourceBundle
- try
- {
- const Class& classObj = Loader::loadClass(bundleName);
- current = classObj.newInstance();
- }
- catch (ClassNotFoundException&)
- {
- current = 0;
- }
+ // Try loading a class which implements ResourceBundle
+ try
+ {
+ const Class& classObj = Loader::loadClass(bundleName);
+ current = classObj.newInstance();
+ }
+ catch (ClassNotFoundException&)
+ {
+ current = 0;
+ }
- // No class found, then try to create a PropertyResourceBundle from a file
- if (current == 0)
- {
- InputStreamPtr bundleStream =
- Loader::getResourceAsStream(
- bundleName + LOG4CXX_STR(".properties"));
+ // No class found, then try to create a PropertyResourceBundle from a file
+ if (current == 0)
+ {
+ InputStreamPtr bundleStream =
+ Loader::getResourceAsStream(
+ bundleName + LOG4CXX_STR(".properties"));
- if (bundleStream == 0)
- {
- continue;
- }
+ if (bundleStream == 0)
+ {
+ continue;
+ }
- try
- {
- current = new PropertyResourceBundle(bundleStream);
- }
- catch (Exception&)
- {
- throw;
- }
- }
+ try
+ {
+ current = new PropertyResourceBundle(bundleStream);
+ }
+ catch (Exception&)
+ {
+ throw;
+ }
+ }
- // Add the new resource bundle to the hierarchy
- if (resourceBundle == 0)
- {
- resourceBundle = current;
- previous = current;
- }
- else
- {
- previous->setParent(current);
- previous = current;
- }
- }
+ // Add the new resource bundle to the hierarchy
+ if (resourceBundle == 0)
+ {
+ resourceBundle = current;
+ previous = current;
+ }
+ else
+ {
+ previous->setParent(current);
+ previous = current;
+ }
+ }
- // no resource bundle found at all, then throw exception
- if (resourceBundle == 0)
- {
- throw MissingResourceException(
- ((LogString) LOG4CXX_STR("Missing resource bundle ")) + baseName);
- }
+ // no resource bundle found at all, then throw exception
+ if (resourceBundle == 0)
+ {
+ throw MissingResourceException(
+ ((LogString) LOG4CXX_STR("Missing resource bundle ")) + baseName);
+ }
- return resourceBundle;
+ return resourceBundle;
}
diff --git a/src/main/cpp/rollingfileappender.cpp b/src/main/cpp/rollingfileappender.cpp
index c0d8783..638dd23 100644
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@ -16,20 +16,20 @@
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#ifdef LOG4CXX_MULTI_PROCESS
- #include <apr_portable.h>
- #include <libgen.h>
- #include <apr_file_io.h>
- #include <apr_atomic.h>
- #include <apr_mmap.h>
- #ifndef MAX_FILE_LEN
- #define MAX_FILE_LEN 2048
- #endif
- #include <log4cxx/pattern/filedatepatternconverter.h>
- #include <log4cxx/helpers/date.h>
+ #include <apr_portable.h>
+ #include <libgen.h>
+ #include <apr_file_io.h>
+ #include <apr_atomic.h>
+ #include <apr_mmap.h>
+ #ifndef MAX_FILE_LEN
+ #define MAX_FILE_LEN 2048
+ #endif
+ #include <log4cxx/pattern/filedatepatternconverter.h>
+ #include <log4cxx/helpers/date.h>
#endif
#include <log4cxx/rolling/rollingfileappender.h>
@@ -67,102 +67,102 @@
*/
void RollingFileAppenderSkeleton::activateOptions(Pool& p)
{
- if (rollingPolicy == NULL)
- {
- FixedWindowRollingPolicy* fwrp = new FixedWindowRollingPolicy();
- fwrp->setFileNamePattern(getFile() + LOG4CXX_STR(".%i"));
- rollingPolicy = fwrp;
- }
+ if (rollingPolicy == NULL)
+ {
+ FixedWindowRollingPolicy* fwrp = new FixedWindowRollingPolicy();
+ fwrp->setFileNamePattern(getFile() + LOG4CXX_STR(".%i"));
+ rollingPolicy = fwrp;
+ }
- //
- // if no explicit triggering policy and rolling policy is both.
- //
- if (triggeringPolicy == NULL)
- {
- TriggeringPolicyPtr trig(rollingPolicy);
+ //
+ // if no explicit triggering policy and rolling policy is both.
+ //
+ if (triggeringPolicy == NULL)
+ {
+ TriggeringPolicyPtr trig(rollingPolicy);
- if (trig != NULL)
- {
- triggeringPolicy = trig;
- }
- }
+ if (trig != NULL)
+ {
+ triggeringPolicy = trig;
+ }
+ }
- if (triggeringPolicy == NULL)
- {
- triggeringPolicy = new ManualTriggeringPolicy();
- }
+ if (triggeringPolicy == NULL)
+ {
+ triggeringPolicy = new ManualTriggeringPolicy();
+ }
- {
- LOCK_W sync(mutex);
- triggeringPolicy->activateOptions(p);
- rollingPolicy->activateOptions(p);
+ {
+ LOCK_W sync(mutex);
+ triggeringPolicy->activateOptions(p);
+ rollingPolicy->activateOptions(p);
- try
- {
- RolloverDescriptionPtr rollover1 =
- rollingPolicy->initialize(getFile(), getAppend(), p);
+ try
+ {
+ RolloverDescriptionPtr rollover1 =
+ rollingPolicy->initialize(getFile(), getAppend(), p);
- if (rollover1 != NULL)
- {
- ActionPtr syncAction(rollover1->getSynchronous());
+ if (rollover1 != NULL)
+ {
+ ActionPtr syncAction(rollover1->getSynchronous());
- if (syncAction != NULL)
- {
- syncAction->execute(p);
- }
+ if (syncAction != NULL)
+ {
+ syncAction->execute(p);
+ }
- setFile(rollover1->getActiveFileName());
- setAppend(rollover1->getAppend());
+ setFile(rollover1->getActiveFileName());
+ setAppend(rollover1->getAppend());
- //
- // async action not yet implemented
- //
- ActionPtr asyncAction(rollover1->getAsynchronous());
+ //
+ // async action not yet implemented
+ //
+ ActionPtr asyncAction(rollover1->getAsynchronous());
- if (asyncAction != NULL)
- {
- asyncAction->execute(p);
- }
- }
+ if (asyncAction != NULL)
+ {
+ asyncAction->execute(p);
+ }
+ }
- File activeFile;
- activeFile.setPath(getFile());
+ File activeFile;
+ activeFile.setPath(getFile());
- if (getAppend())
- {
- fileLength = activeFile.length(p);
- }
- else
- {
- fileLength = 0;
- }
+ if (getAppend())
+ {
+ fileLength = activeFile.length(p);
+ }
+ else
+ {
+ fileLength = 0;
+ }
- FileAppender::activateOptions(p);
- }
- catch (std::exception& ex)
- {
- LogLog::warn(
- LogString(LOG4CXX_STR("Exception will initializing RollingFileAppender named "))
- + getName());
- }
- }
+ FileAppender::activateOptions(p);
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(
+ LogString(LOG4CXX_STR("Exception will initializing RollingFileAppender named "))
+ + getName());
+ }
+ }
}
#ifdef LOG4CXX_MULTI_PROCESS
void RollingFileAppenderSkeleton::releaseFileLock(apr_file_t* lock_file)
{
- if (lock_file)
- {
- apr_status_t stat = apr_file_unlock(lock_file);
+ if (lock_file)
+ {
+ apr_status_t stat = apr_file_unlock(lock_file);
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("flock: unlock failed"));
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("flock: unlock failed"));
+ }
- apr_file_close(lock_file);
- lock_file = NULL;
- }
+ apr_file_close(lock_file);
+ lock_file = NULL;
+ }
}
#endif
/**
@@ -182,236 +182,236 @@
*/
bool RollingFileAppenderSkeleton::rollover(Pool& p)
{
- //
- // can't roll without a policy
- //
- if (rollingPolicy != NULL)
- {
+ //
+ // can't roll without a policy
+ //
+ if (rollingPolicy != NULL)
+ {
- {
- LOCK_W sync(mutex);
+ {
+ LOCK_W sync(mutex);
#ifdef LOG4CXX_MULTI_PROCESS
- std::string fileName(getFile());
- RollingPolicyBase* basePolicy = dynamic_cast<RollingPolicyBase* >(&(*rollingPolicy));
- apr_time_t n = apr_time_now();
- ObjectPtr obj(new Date(n));
- LogString fileNamePattern;
+ std::string fileName(getFile());
+ RollingPolicyBase* basePolicy = dynamic_cast<RollingPolicyBase* >(&(*rollingPolicy));
+ apr_time_t n = apr_time_now();
+ ObjectPtr obj(new Date(n));
+ LogString fileNamePattern;
- if (basePolicy)
- {
- if (basePolicy->getPatternConverterList().size())
- {
- (*(basePolicy->getPatternConverterList().begin()))->format(obj, fileNamePattern, p);
- fileName = std::string(fileNamePattern);
- }
- }
+ if (basePolicy)
+ {
+ if (basePolicy->getPatternConverterList().size())
+ {
+ (*(basePolicy->getPatternConverterList().begin()))->format(obj, fileNamePattern, p);
+ fileName = std::string(fileNamePattern);
+ }
+ }
- bool bAlreadyRolled = true;
- char szDirName[MAX_FILE_LEN] = {'\0'};
- char szBaseName[MAX_FILE_LEN] = {'\0'};
- char szUid[MAX_FILE_LEN] = {'\0'};
- memcpy(szDirName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
- memcpy(szBaseName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
- apr_uid_t uid;
- apr_gid_t groupid;
- apr_status_t stat = apr_uid_current(&uid, &groupid, pool.getAPRPool());
+ bool bAlreadyRolled = true;
+ char szDirName[MAX_FILE_LEN] = {'\0'};
+ char szBaseName[MAX_FILE_LEN] = {'\0'};
+ char szUid[MAX_FILE_LEN] = {'\0'};
+ memcpy(szDirName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
+ memcpy(szBaseName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
+ apr_uid_t uid;
+ apr_gid_t groupid;
+ apr_status_t stat = apr_uid_current(&uid, &groupid, pool.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- snprintf(szUid, MAX_FILE_LEN, "%u", uid);
- }
+ if (stat == APR_SUCCESS)
+ {
+ snprintf(szUid, MAX_FILE_LEN, "%u", uid);
+ }
- const std::string lockname = std::string(::dirname(szDirName)) + "/." + ::basename(szBaseName) + szUid + ".lock";
- apr_file_t* lock_file;
- stat = apr_file_open(&lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, p.getAPRPool());
+ const std::string lockname = std::string(::dirname(szDirName)) + "/." + ::basename(szBaseName) + szUid + ".lock";
+ apr_file_t* lock_file;
+ stat = apr_file_open(&lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- std::string err = "lockfile return error: open lockfile failed. ";
- err += (strerror(errno));
- LogLog::warn(LOG4CXX_STR(err.c_str()));
- bAlreadyRolled = false;
- lock_file = NULL;
- }
- else
- {
- stat = apr_file_lock(lock_file, APR_FLOCK_EXCLUSIVE);
+ if (stat != APR_SUCCESS)
+ {
+ std::string err = "lockfile return error: open lockfile failed. ";
+ err += (strerror(errno));
+ LogLog::warn(LOG4CXX_STR(err.c_str()));
+ bAlreadyRolled = false;
+ lock_file = NULL;
+ }
+ else
+ {
+ stat = apr_file_lock(lock_file, APR_FLOCK_EXCLUSIVE);
- if (stat != APR_SUCCESS)
- {
- std::string err = "apr_file_lock: lock failed. ";
- err += (strerror(errno));
- LogLog::warn(LOG4CXX_STR(err.c_str()));
- bAlreadyRolled = false;
- }
- else
- {
- if (_event)
- {
- triggeringPolicy->isTriggeringEvent(this, *_event, getFile(), getFileLength());
- }
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ std::string err = "apr_file_lock: lock failed. ";
+ err += (strerror(errno));
+ LogLog::warn(LOG4CXX_STR(err.c_str()));
+ bAlreadyRolled = false;
+ }
+ else
+ {
+ if (_event)
+ {
+ triggeringPolicy->isTriggeringEvent(this, *_event, getFile(), getFileLength());
+ }
+ }
+ }
- if (bAlreadyRolled)
- {
- apr_finfo_t finfo1, finfo2;
- apr_status_t st1, st2;
- apr_file_t* _fd = getWriter()->getOutPutStreamPtr()->getFileOutPutStreamPtr().getFilePtr();
- st1 = apr_file_info_get(&finfo1, APR_FINFO_IDENT, _fd);
+ if (bAlreadyRolled)
+ {
+ apr_finfo_t finfo1, finfo2;
+ apr_status_t st1, st2;
+ apr_file_t* _fd = getWriter()->getOutPutStreamPtr()->getFileOutPutStreamPtr().getFilePtr();
+ st1 = apr_file_info_get(&finfo1, APR_FINFO_IDENT, _fd);
- if (st1 != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_file_info_get failed"));
- }
+ if (st1 != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_file_info_get failed"));
+ }
- st2 = apr_stat(&finfo2, std::string(getFile()).c_str(), APR_FINFO_IDENT, p.getAPRPool());
+ st2 = apr_stat(&finfo2, std::string(getFile()).c_str(), APR_FINFO_IDENT, p.getAPRPool());
- if (st2 != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_stat failed."));
- }
+ if (st2 != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_stat failed."));
+ }
- bAlreadyRolled = ((st1 == APR_SUCCESS) && (st2 == APR_SUCCESS)
- && ((finfo1.device != finfo2.device) || (finfo1.inode != finfo2.inode)));
- }
+ bAlreadyRolled = ((st1 == APR_SUCCESS) && (st2 == APR_SUCCESS)
+ && ((finfo1.device != finfo2.device) || (finfo1.inode != finfo2.inode)));
+ }
- if (!bAlreadyRolled)
- {
+ if (!bAlreadyRolled)
+ {
#endif
- try
- {
- RolloverDescriptionPtr rollover1(rollingPolicy->rollover(this->getFile(), this->getAppend(), p));
+ try
+ {
+ RolloverDescriptionPtr rollover1(rollingPolicy->rollover(this->getFile(), this->getAppend(), p));
- if (rollover1 != NULL)
- {
- if (rollover1->getActiveFileName() == getFile())
- {
- closeWriter();
+ if (rollover1 != NULL)
+ {
+ if (rollover1->getActiveFileName() == getFile())
+ {
+ closeWriter();
- bool success = true;
+ bool success = true;
- if (rollover1->getSynchronous() != NULL)
- {
- success = false;
+ if (rollover1->getSynchronous() != NULL)
+ {
+ success = false;
- try
- {
- success = rollover1->getSynchronous()->execute(p);
- }
- catch (std::exception& ex)
- {
- LogLog::warn(LOG4CXX_STR("Exception on rollover"));
- }
- }
+ try
+ {
+ success = rollover1->getSynchronous()->execute(p);
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(LOG4CXX_STR("Exception on rollover"));
+ }
+ }
- if (success)
- {
- if (rollover1->getAppend())
- {
- fileLength = File().setPath(rollover1->getActiveFileName()).length(p);
- }
- else
- {
- fileLength = 0;
- }
+ if (success)
+ {
+ if (rollover1->getAppend())
+ {
+ fileLength = File().setPath(rollover1->getActiveFileName()).length(p);
+ }
+ else
+ {
+ fileLength = 0;
+ }
- //
- // async action not yet implemented
- //
- ActionPtr asyncAction(rollover1->getAsynchronous());
+ //
+ // async action not yet implemented
+ //
+ ActionPtr asyncAction(rollover1->getAsynchronous());
- if (asyncAction != NULL)
- {
- asyncAction->execute(p);
- }
+ if (asyncAction != NULL)
+ {
+ asyncAction->execute(p);
+ }
- setFile(
- rollover1->getActiveFileName(), rollover1->getAppend(),
- bufferedIO, bufferSize, p);
- }
- else
- {
- setFile(
- rollover1->getActiveFileName(), true, bufferedIO, bufferSize, p);
- }
- }
- else
- {
- OutputStreamPtr os(new FileOutputStream(
- rollover1->getActiveFileName(), rollover1->getAppend()));
- WriterPtr newWriter(createWriter(os));
- closeWriter();
- setFile(rollover1->getActiveFileName());
- setWriter(newWriter);
+ setFile(
+ rollover1->getActiveFileName(), rollover1->getAppend(),
+ bufferedIO, bufferSize, p);
+ }
+ else
+ {
+ setFile(
+ rollover1->getActiveFileName(), true, bufferedIO, bufferSize, p);
+ }
+ }
+ else
+ {
+ OutputStreamPtr os(new FileOutputStream(
+ rollover1->getActiveFileName(), rollover1->getAppend()));
+ WriterPtr newWriter(createWriter(os));
+ closeWriter();
+ setFile(rollover1->getActiveFileName());
+ setWriter(newWriter);
- bool success = true;
+ bool success = true;
- if (rollover1->getSynchronous() != NULL)
- {
- success = false;
+ if (rollover1->getSynchronous() != NULL)
+ {
+ success = false;
- try
- {
- success = rollover1->getSynchronous()->execute(p);
- }
- catch (std::exception& ex)
- {
- LogLog::warn(LOG4CXX_STR("Exception during rollover"));
- }
- }
+ try
+ {
+ success = rollover1->getSynchronous()->execute(p);
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(LOG4CXX_STR("Exception during rollover"));
+ }
+ }
- if (success)
- {
- if (rollover1->getAppend())
- {
- fileLength = File().setPath(rollover1->getActiveFileName()).length(p);
- }
- else
- {
- fileLength = 0;
- }
+ if (success)
+ {
+ if (rollover1->getAppend())
+ {
+ fileLength = File().setPath(rollover1->getActiveFileName()).length(p);
+ }
+ else
+ {
+ fileLength = 0;
+ }
- //
- // async action not yet implemented
- //
- ActionPtr asyncAction(rollover1->getAsynchronous());
+ //
+ // async action not yet implemented
+ //
+ ActionPtr asyncAction(rollover1->getAsynchronous());
- if (asyncAction != NULL)
- {
- asyncAction->execute(p);
- }
- }
+ if (asyncAction != NULL)
+ {
+ asyncAction->execute(p);
+ }
+ }
- writeHeader(p);
- }
+ writeHeader(p);
+ }
#ifdef LOG4CXX_MULTI_PROCESS
- releaseFileLock(lock_file);
+ releaseFileLock(lock_file);
#endif
- return true;
- }
- }
- catch (std::exception& ex)
- {
- LogLog::warn(LOG4CXX_STR("Exception during rollover"));
- }
+ return true;
+ }
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(LOG4CXX_STR("Exception during rollover"));
+ }
#ifdef LOG4CXX_MULTI_PROCESS
- }
- else
- {
- reopenLatestFile(p);
- }
+ }
+ else
+ {
+ reopenLatestFile(p);
+ }
- releaseFileLock(lock_file);
+ releaseFileLock(lock_file);
#endif
- }
- }
+ }
+ }
- return false;
+ return false;
}
#ifdef LOG4CXX_MULTI_PROCESS
@@ -420,13 +420,13 @@
*/
void RollingFileAppenderSkeleton::reopenLatestFile(Pool& p)
{
- closeWriter();
- OutputStreamPtr os(new FileOutputStream(getFile(), true));
- WriterPtr newWriter(createWriter(os));
- setFile(getFile());
- setWriter(newWriter);
- fileLength = File().setPath(getFile()).length(p);
- writeHeader(p);
+ closeWriter();
+ OutputStreamPtr os(new FileOutputStream(getFile(), true));
+ WriterPtr newWriter(createWriter(os));
+ setFile(getFile());
+ setWriter(newWriter);
+ fileLength = File().setPath(getFile()).length(p);
+ writeHeader(p);
}
#endif
@@ -436,60 +436,60 @@
*/
void RollingFileAppenderSkeleton::subAppend(const LoggingEventPtr& event, Pool& p)
{
- // The rollover check must precede actual writing. This is the
- // only correct behavior for time driven triggers.
- if (
- triggeringPolicy->isTriggeringEvent(
- this, event, getFile(), getFileLength()))
- {
- //
- // wrap rollover request in try block since
- // rollover may fail in case read access to directory
- // is not provided. However appender should still be in good
- // condition and the append should still happen.
- try
- {
- _event = &(const_cast<LoggingEventPtr&>(event));
- rollover(p);
- }
- catch (std::exception& ex)
- {
- LogLog::warn(LOG4CXX_STR("Exception during rollover attempt."));
- }
- }
+ // The rollover check must precede actual writing. This is the
+ // only correct behavior for time driven triggers.
+ if (
+ triggeringPolicy->isTriggeringEvent(
+ this, event, getFile(), getFileLength()))
+ {
+ //
+ // wrap rollover request in try block since
+ // rollover may fail in case read access to directory
+ // is not provided. However appender should still be in good
+ // condition and the append should still happen.
+ try
+ {
+ _event = &(const_cast<LoggingEventPtr&>(event));
+ rollover(p);
+ }
+ catch (std::exception& ex)
+ {
+ LogLog::warn(LOG4CXX_STR("Exception during rollover attempt."));
+ }
+ }
#ifdef LOG4CXX_MULTI_PROCESS
- //do re-check before every write
- //
- apr_finfo_t finfo1, finfo2;
- apr_status_t st1, st2;
- apr_file_t* _fd = getWriter()->getOutPutStreamPtr()->getFileOutPutStreamPtr().getFilePtr();
- st1 = apr_file_info_get(&finfo1, APR_FINFO_IDENT, _fd);
+ //do re-check before every write
+ //
+ apr_finfo_t finfo1, finfo2;
+ apr_status_t st1, st2;
+ apr_file_t* _fd = getWriter()->getOutPutStreamPtr()->getFileOutPutStreamPtr().getFilePtr();
+ st1 = apr_file_info_get(&finfo1, APR_FINFO_IDENT, _fd);
- if (st1 != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_file_info_get failed"));
- }
+ if (st1 != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_file_info_get failed"));
+ }
- st2 = apr_stat(&finfo2, std::string(getFile()).c_str(), APR_FINFO_IDENT, p.getAPRPool());
+ st2 = apr_stat(&finfo2, std::string(getFile()).c_str(), APR_FINFO_IDENT, p.getAPRPool());
- if (st2 != APR_SUCCESS)
- {
- std::string err = "apr_stat failed. file:" + std::string(getFile());
- LogLog::warn(LOG4CXX_STR(err.c_str()));
- }
+ if (st2 != APR_SUCCESS)
+ {
+ std::string err = "apr_stat failed. file:" + std::string(getFile());
+ LogLog::warn(LOG4CXX_STR(err.c_str()));
+ }
- bool bAlreadyRolled = ((st1 == APR_SUCCESS) && (st2 == APR_SUCCESS)
- && ((finfo1.device != finfo2.device) || (finfo1.inode != finfo2.inode)));
+ bool bAlreadyRolled = ((st1 == APR_SUCCESS) && (st2 == APR_SUCCESS)
+ && ((finfo1.device != finfo2.device) || (finfo1.inode != finfo2.inode)));
- if (bAlreadyRolled)
- {
- reopenLatestFile(p);
- }
+ if (bAlreadyRolled)
+ {
+ reopenLatestFile(p);
+ }
#endif
- FileAppender::subAppend(event, p);
+ FileAppender::subAppend(event, p);
}
/**
@@ -498,7 +498,7 @@
*/
RollingPolicyPtr RollingFileAppenderSkeleton::getRollingPolicy() const
{
- return rollingPolicy;
+ return rollingPolicy;
}
/**
@@ -507,7 +507,7 @@
*/
TriggeringPolicyPtr RollingFileAppenderSkeleton::getTriggeringPolicy() const
{
- return triggeringPolicy;
+ return triggeringPolicy;
}
/**
@@ -516,7 +516,7 @@
*/
void RollingFileAppenderSkeleton::setRollingPolicy(const RollingPolicyPtr& policy)
{
- rollingPolicy = policy;
+ rollingPolicy = policy;
}
/**
@@ -525,7 +525,7 @@
*/
void RollingFileAppenderSkeleton::setTriggeringPolicy(const TriggeringPolicyPtr& policy)
{
- triggeringPolicy = policy;
+ triggeringPolicy = policy;
}
/**
@@ -533,7 +533,7 @@
*/
void RollingFileAppenderSkeleton::close()
{
- FileAppender::close();
+ FileAppender::close();
}
namespace log4cxx
@@ -546,68 +546,68 @@
*/
class CountingOutputStream : public OutputStream
{
- /**
- * Wrapped output stream.
- */
- private:
- OutputStreamPtr os;
+ /**
+ * Wrapped output stream.
+ */
+ private:
+ OutputStreamPtr os;
- /**
- * Rolling file appender to inform of stream writes.
- */
- RollingFileAppenderSkeleton* rfa;
+ /**
+ * Rolling file appender to inform of stream writes.
+ */
+ RollingFileAppenderSkeleton* rfa;
- public:
- /**
- * Constructor.
- * @param os output stream to wrap.
- * @param rfa rolling file appender to inform.
- */
- CountingOutputStream(
- OutputStreamPtr& os1, RollingFileAppenderSkeleton* rfa1) :
- os(os1), rfa(rfa1)
- {
- }
+ public:
+ /**
+ * Constructor.
+ * @param os output stream to wrap.
+ * @param rfa rolling file appender to inform.
+ */
+ CountingOutputStream(
+ OutputStreamPtr& os1, RollingFileAppenderSkeleton* rfa1) :
+ os(os1), rfa(rfa1)
+ {
+ }
- /**
- * {@inheritDoc}
- */
- void close(Pool& p)
- {
- os->close(p);
- rfa = 0;
- }
+ /**
+ * {@inheritDoc}
+ */
+ void close(Pool& p)
+ {
+ os->close(p);
+ rfa = 0;
+ }
- /**
- * {@inheritDoc}
- */
- void flush(Pool& p)
- {
- os->flush(p);
- }
+ /**
+ * {@inheritDoc}
+ */
+ void flush(Pool& p)
+ {
+ os->flush(p);
+ }
- /**
- * {@inheritDoc}
- */
- void write(ByteBuffer& buf, Pool& p)
- {
- os->write(buf, p);
+ /**
+ * {@inheritDoc}
+ */
+ void write(ByteBuffer& buf, Pool& p)
+ {
+ os->write(buf, p);
- if (rfa != 0)
- {
+ if (rfa != 0)
+ {
#ifndef LOG4CXX_MULTI_PROCESS
- rfa->incrementFileLength(buf.limit());
+ rfa->incrementFileLength(buf.limit());
#else
- rfa->setFileLength(File().setPath(rfa->getFile()).length(p));
+ rfa->setFileLength(File().setPath(rfa->getFile()).length(p));
#endif
- }
- }
+ }
+ }
#ifdef LOG4CXX_MULTI_PROCESS
- OutputStream& getFileOutPutStreamPtr()
- {
- return *os;
- }
+ OutputStream& getFileOutPutStreamPtr()
+ {
+ return *os;
+ }
#endif
};
}
@@ -624,8 +624,8 @@
*/
WriterPtr RollingFileAppenderSkeleton::createWriter(OutputStreamPtr& os)
{
- OutputStreamPtr cos(new CountingOutputStream(os, this));
- return FileAppender::createWriter(cos);
+ OutputStreamPtr cos(new CountingOutputStream(os, this));
+ return FileAppender::createWriter(cos);
}
/**
@@ -634,13 +634,13 @@
*/
size_t RollingFileAppenderSkeleton::getFileLength() const
{
- return fileLength;
+ return fileLength;
}
#ifdef LOG4CXX_MULTI_PROCESS
void RollingFileAppenderSkeleton::setFileLength(size_t length)
{
- fileLength = length;
+ fileLength = length;
}
#endif
@@ -650,5 +650,5 @@
*/
void RollingFileAppenderSkeleton::incrementFileLength(size_t increment)
{
- fileLength += increment;
+ fileLength += increment;
}
diff --git a/src/main/cpp/rollingpolicybase.cpp b/src/main/cpp/rollingpolicybase.cpp
index 664c3ed..af83c64 100644
--- a/src/main/cpp/rollingpolicybase.cpp
+++ b/src/main/cpp/rollingpolicybase.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -46,50 +46,50 @@
void RollingPolicyBase::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void RollingPolicyBase::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
void RollingPolicyBase::activateOptions(log4cxx::helpers::Pool& /* pool */)
{
- if (fileNamePatternStr.length() > 0)
- {
- parseFileNamePattern();
- }
- else
- {
- LogString msg(LOG4CXX_STR("The FileNamePattern option must be set before using FixedWindowRollingPolicy."));
- LogString ref1(LOG4CXX_STR("See also http://logging.apache.org/log4j/codes.html#tbr_fnp_not_set"));
- LogLog::warn(msg);
- LogLog::warn(ref1);
- throw IllegalStateException();
- }
+ if (fileNamePatternStr.length() > 0)
+ {
+ parseFileNamePattern();
+ }
+ else
+ {
+ LogString msg(LOG4CXX_STR("The FileNamePattern option must be set before using FixedWindowRollingPolicy."));
+ LogString ref1(LOG4CXX_STR("See also http://logging.apache.org/log4j/codes.html#tbr_fnp_not_set"));
+ LogLog::warn(msg);
+ LogLog::warn(ref1);
+ throw IllegalStateException();
+ }
}
void RollingPolicyBase::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("FILENAMEPATTERN"),
- LOG4CXX_STR("filenamepattern")))
- {
- fileNamePatternStr = value;
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("FILENAMEPATTERN"),
+ LOG4CXX_STR("filenamepattern")))
+ {
+ fileNamePatternStr = value;
+ }
}
void RollingPolicyBase::setFileNamePattern(const LogString& fnp)
{
- fileNamePatternStr = fnp;
+ fileNamePatternStr = fnp;
}
LogString RollingPolicyBase::getFileNamePattern() const
{
- return fileNamePatternStr;
+ return fileNamePatternStr;
}
/**
@@ -97,12 +97,12 @@
*/
void RollingPolicyBase::parseFileNamePattern()
{
- patternConverters.erase(patternConverters.begin(), patternConverters.end());
- patternFields.erase(patternFields.begin(), patternFields.end());
- PatternParser::parse(fileNamePatternStr,
- patternConverters,
- patternFields,
- getFormatSpecifiers());
+ patternConverters.erase(patternConverters.begin(), patternConverters.end());
+ patternFields.erase(patternFields.begin(), patternFields.end());
+ PatternParser::parse(fileNamePatternStr,
+ patternConverters,
+ patternFields,
+ getFormatSpecifiers());
}
/**
@@ -112,61 +112,61 @@
* @param buf string buffer to which formatted file name is appended, may not be null.
*/
void RollingPolicyBase::formatFileName(
- ObjectPtr& obj,
- LogString& toAppendTo,
- Pool& pool) const
+ ObjectPtr& obj,
+ LogString& toAppendTo,
+ Pool& pool) const
{
- std::vector<FormattingInfoPtr>::const_iterator formatterIter =
- patternFields.begin();
+ std::vector<FormattingInfoPtr>::const_iterator formatterIter =
+ patternFields.begin();
- for (std::vector<PatternConverterPtr>::const_iterator
- converterIter = patternConverters.begin();
- converterIter != patternConverters.end();
- converterIter++, formatterIter++)
- {
- int startField = toAppendTo.length();
- (*converterIter)->format(obj, toAppendTo, pool);
- (*formatterIter)->format(startField, toAppendTo);
- }
+ for (std::vector<PatternConverterPtr>::const_iterator
+ converterIter = patternConverters.begin();
+ converterIter != patternConverters.end();
+ converterIter++, formatterIter++)
+ {
+ int startField = toAppendTo.length();
+ (*converterIter)->format(obj, toAppendTo, pool);
+ (*formatterIter)->format(startField, toAppendTo);
+ }
}
PatternConverterPtr RollingPolicyBase::getIntegerPatternConverter() const
{
- for (std::vector<PatternConverterPtr>::const_iterator
- converterIter = patternConverters.begin();
- converterIter != patternConverters.end();
- converterIter++)
- {
- IntegerPatternConverterPtr intPattern(*converterIter);
+ for (std::vector<PatternConverterPtr>::const_iterator
+ converterIter = patternConverters.begin();
+ converterIter != patternConverters.end();
+ converterIter++)
+ {
+ IntegerPatternConverterPtr intPattern(*converterIter);
- if (intPattern != NULL)
- {
- return *converterIter;
- }
- }
+ if (intPattern != NULL)
+ {
+ return *converterIter;
+ }
+ }
- PatternConverterPtr noMatch;
- return noMatch;
+ PatternConverterPtr noMatch;
+ return noMatch;
}
PatternConverterPtr RollingPolicyBase::getDatePatternConverter() const
{
- for (std::vector<PatternConverterPtr>::const_iterator
- converterIter = patternConverters.begin();
- converterIter != patternConverters.end();
- converterIter++)
- {
- DatePatternConverterPtr datePattern(*converterIter);
+ for (std::vector<PatternConverterPtr>::const_iterator
+ converterIter = patternConverters.begin();
+ converterIter != patternConverters.end();
+ converterIter++)
+ {
+ DatePatternConverterPtr datePattern(*converterIter);
- if (datePattern != NULL)
- {
- return *converterIter;
- }
- }
+ if (datePattern != NULL)
+ {
+ return *converterIter;
+ }
+ }
- PatternConverterPtr noMatch;
- return noMatch;
+ PatternConverterPtr noMatch;
+ return noMatch;
}
diff --git a/src/main/cpp/rolloverdescription.cpp b/src/main/cpp/rolloverdescription.cpp
index fbd9242..cc2c9aa 100644
--- a/src/main/cpp/rolloverdescription.cpp
+++ b/src/main/cpp/rolloverdescription.cpp
@@ -30,30 +30,30 @@
}
RolloverDescription::RolloverDescription(
- const LogString& activeFileName1,
- const bool append1,
- const ActionPtr& synchronous1,
- const ActionPtr& asynchronous1)
- : activeFileName(activeFileName1),
- append(append1),
- synchronous(synchronous1),
- asynchronous(asynchronous1)
+ const LogString& activeFileName1,
+ const bool append1,
+ const ActionPtr& synchronous1,
+ const ActionPtr& asynchronous1)
+ : activeFileName(activeFileName1),
+ append(append1),
+ synchronous(synchronous1),
+ asynchronous(asynchronous1)
{
}
LogString RolloverDescription::getActiveFileName() const
{
- return activeFileName;
+ return activeFileName;
}
bool RolloverDescription::getAppend() const
{
- return append;
+ return append;
}
ActionPtr RolloverDescription::getSynchronous() const
{
- return synchronous;
+ return synchronous;
}
/**
@@ -64,5 +64,5 @@
*/
ActionPtr RolloverDescription::getAsynchronous() const
{
- return asynchronous;
+ return asynchronous;
}
diff --git a/src/main/cpp/rootlogger.cpp b/src/main/cpp/rootlogger.cpp
index 0d89e50..f733806 100644
--- a/src/main/cpp/rootlogger.cpp
+++ b/src/main/cpp/rootlogger.cpp
@@ -25,27 +25,27 @@
using namespace log4cxx::helpers;
RootLogger::RootLogger(Pool& pool, const LevelPtr& level1) :
- Logger(pool, LOG4CXX_STR("root"))
+ Logger(pool, LOG4CXX_STR("root"))
{
- setLevel(level1);
+ setLevel(level1);
}
const LevelPtr& RootLogger::getEffectiveLevel() const
{
- return level;
+ return level;
}
void RootLogger::setLevel(const LevelPtr& level1)
{
- if (level1 == 0)
- {
- LogLog::error(LOG4CXX_STR("You have tried to set a null level to root."));
- }
- else
- {
+ if (level1 == 0)
+ {
+ LogLog::error(LOG4CXX_STR("You have tried to set a null level to root."));
+ }
+ else
+ {
- this->level = level1;
- }
+ this->level = level1;
+ }
}
diff --git a/src/main/cpp/serversocket.cpp b/src/main/cpp/serversocket.cpp
index 33565b1..5af4955 100644
--- a/src/main/cpp/serversocket.cpp
+++ b/src/main/cpp/serversocket.cpp
@@ -27,48 +27,48 @@
*/
ServerSocket::ServerSocket(int port) : pool(), mutex(pool), socket(0), timeout(0)
{
- apr_status_t status =
- apr_socket_create(&socket, APR_INET, SOCK_STREAM,
- APR_PROTO_TCP, pool.getAPRPool());
+ apr_status_t status =
+ apr_socket_create(&socket, APR_INET, SOCK_STREAM,
+ APR_PROTO_TCP, pool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- status = apr_socket_opt_set(socket, APR_SO_NONBLOCK, 1);
+ status = apr_socket_opt_set(socket, APR_SO_NONBLOCK, 1);
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- // Create server socket address (including port number)
- apr_sockaddr_t* server_addr;
- status =
- apr_sockaddr_info_get(&server_addr, NULL, APR_INET,
- port, 0, pool.getAPRPool());
+ // Create server socket address (including port number)
+ apr_sockaddr_t* server_addr;
+ status =
+ apr_sockaddr_info_get(&server_addr, NULL, APR_INET,
+ port, 0, pool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw ConnectException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw ConnectException(status);
+ }
- // bind the socket to the address
- status = apr_socket_bind(socket, server_addr);
+ // bind the socket to the address
+ status = apr_socket_bind(socket, server_addr);
- if (status != APR_SUCCESS)
- {
- throw BindException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw BindException(status);
+ }
- status = apr_socket_listen(socket, 50);
+ status = apr_socket_listen(socket, 50);
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
}
@@ -78,19 +78,19 @@
void ServerSocket::close()
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- if (socket != 0)
- {
- apr_status_t status = apr_socket_close(socket);
+ if (socket != 0)
+ {
+ apr_status_t status = apr_socket_close(socket);
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- socket = 0;
- }
+ socket = 0;
+ }
}
/** Listens for a connection to be made to this socket and
@@ -98,72 +98,72 @@
*/
SocketPtr ServerSocket::accept()
{
- synchronized sync(mutex);
+ synchronized sync(mutex);
- if (socket == 0)
- {
- throw IOException();
- }
+ if (socket == 0)
+ {
+ throw IOException();
+ }
- apr_pollfd_t poll;
- poll.p = pool.getAPRPool();
- poll.desc_type = APR_POLL_SOCKET;
- poll.reqevents = APR_POLLIN;
- poll.rtnevents = 0;
- poll.desc.s = socket;
- poll.client_data = NULL;
+ apr_pollfd_t poll;
+ poll.p = pool.getAPRPool();
+ poll.desc_type = APR_POLL_SOCKET;
+ poll.reqevents = APR_POLLIN;
+ poll.rtnevents = 0;
+ poll.desc.s = socket;
+ poll.client_data = NULL;
- apr_int32_t signaled;
- apr_interval_time_t to = timeout * 1000;
- apr_status_t status = apr_poll(&poll, 1, &signaled, to);
+ apr_int32_t signaled;
+ apr_interval_time_t to = timeout * 1000;
+ apr_status_t status = apr_poll(&poll, 1, &signaled, to);
- if (APR_STATUS_IS_TIMEUP(status))
- {
- throw SocketTimeoutException();
- }
- else if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (APR_STATUS_IS_TIMEUP(status))
+ {
+ throw SocketTimeoutException();
+ }
+ else if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- apr_pool_t* newPool;
- status = apr_pool_create(&newPool, 0);
+ apr_pool_t* newPool;
+ status = apr_pool_create(&newPool, 0);
- if (status != APR_SUCCESS)
- {
- throw PoolException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw PoolException(status);
+ }
- apr_socket_t* newSocket;
- status = apr_socket_accept(&newSocket, socket, newPool);
+ apr_socket_t* newSocket;
+ status = apr_socket_accept(&newSocket, socket, newPool);
- if (status != APR_SUCCESS)
- {
- apr_pool_destroy(newPool);
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ apr_pool_destroy(newPool);
+ throw SocketException(status);
+ }
- status = apr_socket_opt_set(newSocket, APR_SO_NONBLOCK, 0);
+ status = apr_socket_opt_set(newSocket, APR_SO_NONBLOCK, 0);
- if (status != APR_SUCCESS)
- {
- apr_pool_destroy(newPool);
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ apr_pool_destroy(newPool);
+ throw SocketException(status);
+ }
- return new Socket(newSocket, newPool);
+ return new Socket(newSocket, newPool);
}
/** Retrive setting for SO_TIMEOUT.
*/
int ServerSocket::getSoTimeout() const
{
- return timeout;
+ return timeout;
}
/** Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
*/
void ServerSocket::setSoTimeout(int newVal)
{
- timeout = newVal;
+ timeout = newVal;
}
diff --git a/src/main/cpp/simpledateformat.cpp b/src/main/cpp/simpledateformat.cpp
index 6c51d78..e3f39d2 100644
--- a/src/main/cpp/simpledateformat.cpp
+++ b/src/main/cpp/simpledateformat.cpp
@@ -24,7 +24,7 @@
#include <log4cxx/helpers/stringhelper.h>
#include <assert.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <log4cxx/helpers/pool.h>
@@ -35,22 +35,22 @@
using namespace std;
#if LOG4CXX_HAS_STD_LOCALE
- #include <locale>
+ #include <locale>
#endif
#if defined(_MSC_VER) && _MSC_VER < 1300
- #define HAS_FACET(locale, type) _HAS(locale, type)
- #define USE_FACET(locale, type) _USE(locale, type)
- #define PUT_FACET(facet, os, time, spec) facet.put(os, os, time, spec)
+ #define HAS_FACET(locale, type) _HAS(locale, type)
+ #define USE_FACET(locale, type) _USE(locale, type)
+ #define PUT_FACET(facet, os, time, spec) facet.put(os, os, time, spec)
#else
- #if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)
- #define HAS_FACET(locale, type) std::has_facet(locale, (type*) 0)
- #define USE_FACET(locale, type) std::use_facet(locale, (type*) 0)
- #else
- #define HAS_FACET(locale, type) std::has_facet < type >(locale)
- #define USE_FACET(locale, type) std::use_facet < type >(locale)
- #endif
- #define PUT_FACET(facet, os, time, spec) facet.put(os, os, os.fill(), time, spec)
+ #if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)
+ #define HAS_FACET(locale, type) std::has_facet(locale, (type*) 0)
+ #define USE_FACET(locale, type) std::use_facet(locale, (type*) 0)
+ #else
+ #define HAS_FACET(locale, type) std::has_facet < type >(locale)
+ #define USE_FACET(locale, type) std::use_facet < type >(locale)
+ #endif
+ #define PUT_FACET(facet, os, time, spec) facet.put(os, os, os.fill(), time, spec)
#endif
namespace log4cxx
@@ -67,359 +67,359 @@
*/
class PatternToken
{
- public:
- PatternToken()
- {
- }
+ public:
+ PatternToken()
+ {
+ }
- virtual ~PatternToken()
- {
- }
+ virtual ~PatternToken()
+ {
+ }
- /**
- * Sets the time zone.
- * @param zone new time zone.
- */
- virtual void setTimeZone(const TimeZonePtr& zone)
- {
- }
+ /**
+ * Sets the time zone.
+ * @param zone new time zone.
+ */
+ virtual void setTimeZone(const TimeZonePtr& zone)
+ {
+ }
- /**
- * Appends the formatted content to the string.
- * @param s string to which format contribution is appended.
- * @param date exploded date/time.
- * @param p memory pool.
- */
- virtual void format(LogString& s,
- const apr_time_exp_t& date,
- log4cxx::helpers::Pool& p) const = 0;
+ /**
+ * Appends the formatted content to the string.
+ * @param s string to which format contribution is appended.
+ * @param date exploded date/time.
+ * @param p memory pool.
+ */
+ virtual void format(LogString& s,
+ const apr_time_exp_t& date,
+ log4cxx::helpers::Pool& p) const = 0;
- protected:
+ protected:
- static void incrementMonth(tm& time, apr_time_exp_t& aprtime)
- {
- time.tm_mon++;
- aprtime.tm_mon++;
- }
+ static void incrementMonth(tm& time, apr_time_exp_t& aprtime)
+ {
+ time.tm_mon++;
+ aprtime.tm_mon++;
+ }
- static void incrementDay(tm& time, apr_time_exp_t& aprtime)
- {
- time.tm_wday++;
- aprtime.tm_wday++;
- }
+ static void incrementDay(tm& time, apr_time_exp_t& aprtime)
+ {
+ time.tm_wday++;
+ aprtime.tm_wday++;
+ }
- static void incrementHalfDay(tm& time, apr_time_exp_t& aprtime)
- {
- time.tm_hour += 12;
- aprtime.tm_hour += 12;
- }
+ static void incrementHalfDay(tm& time, apr_time_exp_t& aprtime)
+ {
+ time.tm_hour += 12;
+ aprtime.tm_hour += 12;
+ }
- static void renderFacet(const std::locale* locale,
- incrementFunction inc,
- char spec,
- unsigned int wspec,
- const char* aprspec,
- std::vector<LogString>& values)
- {
- std::vector<LogString>::iterator valueIter = values.begin();
- tm time;
- memset(&time, 0, sizeof(time));
- apr_time_exp_t aprtime;
- memset(&aprtime, 0, sizeof(aprtime));
+ static void renderFacet(const std::locale* locale,
+ incrementFunction inc,
+ char spec,
+ unsigned int wspec,
+ const char* aprspec,
+ std::vector<LogString>& values)
+ {
+ std::vector<LogString>::iterator valueIter = values.begin();
+ tm time;
+ memset(&time, 0, sizeof(time));
+ apr_time_exp_t aprtime;
+ memset(&aprtime, 0, sizeof(aprtime));
#if LOG4CXX_HAS_STD_LOCALE
- if (locale != NULL)
- {
+ if (locale != NULL)
+ {
#if LOG4CXX_WCHAR_T_API
- if (HAS_FACET(*locale, std::time_put<wchar_t>))
- {
- const std::time_put<wchar_t>& facet = USE_FACET(*locale, std::time_put<wchar_t>);
- size_t start = 0;
- std::basic_ostringstream<wchar_t> os;
+ if (HAS_FACET(*locale, std::time_put<wchar_t>))
+ {
+ const std::time_put<wchar_t>& facet = USE_FACET(*locale, std::time_put<wchar_t>);
+ size_t start = 0;
+ std::basic_ostringstream<wchar_t> os;
- for (; valueIter != values.end(); valueIter++)
- {
- PUT_FACET(facet, os, &time, (wchar_t) wspec);
- Transcoder::decode(os.str().substr(start), *valueIter);
- start = os.str().length();
- (*inc)(time, aprtime);
- }
- }
- else
+ for (; valueIter != values.end(); valueIter++)
+ {
+ PUT_FACET(facet, os, &time, (wchar_t) wspec);
+ Transcoder::decode(os.str().substr(start), *valueIter);
+ start = os.str().length();
+ (*inc)(time, aprtime);
+ }
+ }
+ else
#endif
- if (HAS_FACET(*locale, std::time_put<char>))
- {
- const std::time_put<char>& facet = USE_FACET(*locale, std::time_put<char> );
- size_t start = 0;
- std::ostringstream os;
+ if (HAS_FACET(*locale, std::time_put<char>))
+ {
+ const std::time_put<char>& facet = USE_FACET(*locale, std::time_put<char> );
+ size_t start = 0;
+ std::ostringstream os;
- for (; valueIter != values.end(); valueIter++)
- {
- PUT_FACET(facet, os, &time, spec);
- Transcoder::decode(os.str().substr(start), *valueIter);
- start = os.str().length();
- (*inc)(time, aprtime);
- }
- }
- }
+ for (; valueIter != values.end(); valueIter++)
+ {
+ PUT_FACET(facet, os, &time, spec);
+ Transcoder::decode(os.str().substr(start), *valueIter);
+ start = os.str().length();
+ (*inc)(time, aprtime);
+ }
+ }
+ }
#endif
- const size_t BUFSIZE = 256;
- char buf[BUFSIZE];
- memset(buf, 0, BUFSIZE);
- apr_size_t retsize = 0;
+ const size_t BUFSIZE = 256;
+ char buf[BUFSIZE];
+ memset(buf, 0, BUFSIZE);
+ apr_size_t retsize = 0;
- for (; valueIter != values.end(); valueIter++)
- {
- apr_status_t stat = apr_strftime(buf, &retsize, BUFSIZE, aprspec, &aprtime);
- (*inc)(time, aprtime);
+ for (; valueIter != values.end(); valueIter++)
+ {
+ apr_status_t stat = apr_strftime(buf, &retsize, BUFSIZE, aprspec, &aprtime);
+ (*inc)(time, aprtime);
- if (stat == APR_SUCCESS)
- {
- Transcoder::decode(std::string(buf, retsize), *valueIter);
- }
- else
- {
- valueIter->append(1, (logchar) 0x3F);
- }
- }
- }
+ if (stat == APR_SUCCESS)
+ {
+ Transcoder::decode(std::string(buf, retsize), *valueIter);
+ }
+ else
+ {
+ valueIter->append(1, (logchar) 0x3F);
+ }
+ }
+ }
- private:
- /**
- * Private copy constructor.
- */
- PatternToken(const PatternToken&);
+ private:
+ /**
+ * Private copy constructor.
+ */
+ PatternToken(const PatternToken&);
- /**
- * Private assignment operator.
- */
- PatternToken& operator=(const PatternToken&);
+ /**
+ * Private assignment operator.
+ */
+ PatternToken& operator=(const PatternToken&);
};
class LiteralToken : public PatternToken
{
- public:
- LiteralToken( logchar ch1, int count1 ) : ch( ch1 ), count( count1 )
- {
- }
+ public:
+ LiteralToken( logchar ch1, int count1 ) : ch( ch1 ), count( count1 )
+ {
+ }
- void format( LogString& s, const apr_time_exp_t&, Pool& /* p */ ) const
- {
- s.append( count, ch );
- }
+ void format( LogString& s, const apr_time_exp_t&, Pool& /* p */ ) const
+ {
+ s.append( count, ch );
+ }
- private:
- logchar ch;
- int count;
+ private:
+ logchar ch;
+ int count;
};
class EraToken : public PatternToken
{
- public:
- EraToken( int /* count */, const std::locale* /* locale */ )
- {
- }
+ public:
+ EraToken( int /* count */, const std::locale* /* locale */ )
+ {
+ }
- void format(LogString& s, const apr_time_exp_t& /* tm */, Pool& /* p */ ) const
- {
- s.append(1, (logchar) 0x41 /* 'A' */);
- s.append(1, (logchar) 0x44 /* 'D' */);
- }
+ void format(LogString& s, const apr_time_exp_t& /* tm */, Pool& /* p */ ) const
+ {
+ s.append(1, (logchar) 0x41 /* 'A' */);
+ s.append(1, (logchar) 0x44 /* 'D' */);
+ }
};
class NumericToken : public PatternToken
{
- public:
- NumericToken( size_t width1 ) : width( width1 )
- {
- }
+ public:
+ NumericToken( size_t width1 ) : width( width1 )
+ {
+ }
- virtual int getField( const apr_time_exp_t& tm ) const = 0;
+ virtual int getField( const apr_time_exp_t& tm ) const = 0;
- void format( LogString& s, const apr_time_exp_t& tm, Pool& p ) const
- {
- size_t initialLength = s.length();
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& p ) const
+ {
+ size_t initialLength = s.length();
- StringHelper::toString( getField( tm ), p, s );
- size_t finalLength = s.length();
+ StringHelper::toString( getField( tm ), p, s );
+ size_t finalLength = s.length();
- if ( initialLength + width > finalLength )
- {
- s.insert( initialLength, ( initialLength + width ) - finalLength, (logchar) 0x30 /* '0' */);
- }
- }
+ if ( initialLength + width > finalLength )
+ {
+ s.insert( initialLength, ( initialLength + width ) - finalLength, (logchar) 0x30 /* '0' */);
+ }
+ }
- private:
- size_t width;
+ private:
+ size_t width;
};
class YearToken : public NumericToken
{
- public:
- YearToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ YearToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return 1900 + tm.tm_year;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return 1900 + tm.tm_year;
+ }
};
class MonthToken : public NumericToken
{
- public:
- MonthToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ MonthToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_mon + 1;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_mon + 1;
+ }
};
class AbbreviatedMonthNameToken : public PatternToken
{
- public:
- AbbreviatedMonthNameToken(int, const std::locale* locale) : names( 12 )
- {
- renderFacet(locale, PatternToken::incrementMonth, 'b', 0x62, "%b", names);
- }
+ public:
+ AbbreviatedMonthNameToken(int, const std::locale* locale) : names( 12 )
+ {
+ renderFacet(locale, PatternToken::incrementMonth, 'b', 0x62, "%b", names);
+ }
- void format(LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
- {
- s.append( names[tm.tm_mon] );
- }
+ void format(LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
+ {
+ s.append( names[tm.tm_mon] );
+ }
- private:
- std::vector < LogString > names;
+ private:
+ std::vector < LogString > names;
};
class FullMonthNameToken : public PatternToken
{
- public:
- FullMonthNameToken( int width, const std::locale* locale) : names( 12 )
- {
- renderFacet(locale, PatternToken::incrementMonth, 'B', 0x42, "%B", names);
- }
+ public:
+ FullMonthNameToken( int width, const std::locale* locale) : names( 12 )
+ {
+ renderFacet(locale, PatternToken::incrementMonth, 'B', 0x42, "%B", names);
+ }
- void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
- {
- s.append( names[tm.tm_mon] );
- }
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
+ {
+ s.append( names[tm.tm_mon] );
+ }
- private:
- std::vector < LogString > names;
+ private:
+ std::vector < LogString > names;
};
class WeekInYearToken : public NumericToken
{
- public:
- WeekInYearToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ WeekInYearToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_yday / 7;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_yday / 7;
+ }
};
class WeekInMonthToken : public NumericToken
{
- public:
- WeekInMonthToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ WeekInMonthToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_mday / 7;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_mday / 7;
+ }
};
class DayInMonthToken : public NumericToken
{
- public:
- DayInMonthToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ DayInMonthToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_mday;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_mday;
+ }
};
class DayInYearToken : public NumericToken
{
- public:
- DayInYearToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ DayInYearToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_yday;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_yday;
+ }
};
class DayOfWeekInMonthToken : public NumericToken
{
- public:
- DayOfWeekInMonthToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ DayOfWeekInMonthToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& /* tm */ ) const
- {
- return -1;
- }
+ int getField( const apr_time_exp_t& /* tm */ ) const
+ {
+ return -1;
+ }
};
class AbbreviatedDayNameToken : public PatternToken
{
- public:
- AbbreviatedDayNameToken( int width, const std::locale* locale) : names( 7 )
- {
- renderFacet(locale, PatternToken::incrementDay, 'a', 0x61, "%a", names);
- }
+ public:
+ AbbreviatedDayNameToken( int width, const std::locale* locale) : names( 7 )
+ {
+ renderFacet(locale, PatternToken::incrementDay, 'a', 0x61, "%a", names);
+ }
- void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
- {
- s.append( names[tm.tm_wday] );
- }
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
+ {
+ s.append( names[tm.tm_wday] );
+ }
- private:
- std::vector < LogString > names;
+ private:
+ std::vector < LogString > names;
};
@@ -427,19 +427,19 @@
class FullDayNameToken : public PatternToken
{
- public:
- FullDayNameToken( int width, const std::locale* locale) : names( 7 )
- {
- renderFacet(locale, PatternToken::incrementDay, 'A', 0x41, "%A", names);
- }
+ public:
+ FullDayNameToken( int width, const std::locale* locale) : names( 7 )
+ {
+ renderFacet(locale, PatternToken::incrementDay, 'A', 0x41, "%A", names);
+ }
- void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
- {
- s.append( names[tm.tm_wday] );
- }
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
+ {
+ s.append( names[tm.tm_wday] );
+ }
- private:
- std::vector < LogString > names;
+ private:
+ std::vector < LogString > names;
};
@@ -447,192 +447,192 @@
class MilitaryHourToken : public NumericToken
{
- public:
- MilitaryHourToken( int width1, int offset1 ) : NumericToken( width1 ), offset( offset1 )
- {
- }
+ public:
+ MilitaryHourToken( int width1, int offset1 ) : NumericToken( width1 ), offset( offset1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_hour + offset;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_hour + offset;
+ }
- private:
- int offset;
+ private:
+ int offset;
};
class HourToken : public NumericToken
{
- public:
- HourToken( int width1, int /* offset1 */ ) : NumericToken( width1 ), offset( 0 )
- {
- }
+ public:
+ HourToken( int width1, int /* offset1 */ ) : NumericToken( width1 ), offset( 0 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return ( ( tm.tm_hour + 12 - offset ) % 12 ) + offset;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return ( ( tm.tm_hour + 12 - offset ) % 12 ) + offset;
+ }
- private:
- int offset;
+ private:
+ int offset;
};
class MinuteToken : public NumericToken
{
- public:
- MinuteToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ MinuteToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_min;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_min;
+ }
};
class SecondToken : public NumericToken
{
- public:
- SecondToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ SecondToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_sec;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_sec;
+ }
};
class MillisecondToken : public NumericToken
{
- public:
- MillisecondToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ MillisecondToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_usec / 1000;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_usec / 1000;
+ }
};
class MicrosecondToken : public NumericToken
{
- public:
- MicrosecondToken( int width1 ) : NumericToken( width1 )
- {
- }
+ public:
+ MicrosecondToken( int width1 ) : NumericToken( width1 )
+ {
+ }
- int getField( const apr_time_exp_t& tm ) const
- {
- return tm.tm_usec;
- }
+ int getField( const apr_time_exp_t& tm ) const
+ {
+ return tm.tm_usec;
+ }
};
class AMPMToken : public PatternToken
{
- public:
- AMPMToken( int width, const std::locale* locale) : names( 2 )
- {
- renderFacet(locale, PatternToken::incrementHalfDay, 'p', 0x70, "%p", names);
- }
+ public:
+ AMPMToken( int width, const std::locale* locale) : names( 2 )
+ {
+ renderFacet(locale, PatternToken::incrementHalfDay, 'p', 0x70, "%p", names);
+ }
- void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
- {
- s.append( names[tm.tm_hour / 12] );
- }
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& /* p */ ) const
+ {
+ s.append( names[tm.tm_hour / 12] );
+ }
- private:
- std::vector < LogString > names;
+ private:
+ std::vector < LogString > names;
};
class GeneralTimeZoneToken : public PatternToken
{
- public:
- GeneralTimeZoneToken( int /* width */ )
- {
- }
+ public:
+ GeneralTimeZoneToken( int /* width */ )
+ {
+ }
- void format( LogString& s, const apr_time_exp_t&, Pool& /* p */ ) const
- {
- s.append(timeZone->getID());
- }
+ void format( LogString& s, const apr_time_exp_t&, Pool& /* p */ ) const
+ {
+ s.append(timeZone->getID());
+ }
- void setTimeZone( const TimeZonePtr& zone )
- {
- timeZone = zone;
- }
+ void setTimeZone( const TimeZonePtr& zone )
+ {
+ timeZone = zone;
+ }
- private:
- TimeZonePtr timeZone;
+ private:
+ TimeZonePtr timeZone;
};
class RFC822TimeZoneToken : public PatternToken
{
- public:
- RFC822TimeZoneToken( int /* width */ )
- {
- }
+ public:
+ RFC822TimeZoneToken( int /* width */ )
+ {
+ }
- void format( LogString& s, const apr_time_exp_t& tm, Pool& p ) const
- {
- if ( tm.tm_gmtoff == 0 )
- {
- s.append( 1, (logchar) 0x5A /* 'Z' */ );
- }
- else
- {
- apr_int32_t off = tm.tm_gmtoff;
- size_t basePos = s.length();
- s.append( LOG4CXX_STR( "+0000" ) );
+ void format( LogString& s, const apr_time_exp_t& tm, Pool& p ) const
+ {
+ if ( tm.tm_gmtoff == 0 )
+ {
+ s.append( 1, (logchar) 0x5A /* 'Z' */ );
+ }
+ else
+ {
+ apr_int32_t off = tm.tm_gmtoff;
+ size_t basePos = s.length();
+ s.append( LOG4CXX_STR( "+0000" ) );
- if ( off < 0 )
- {
- s[basePos] = 0x2D; // '-'
- off = -off;
- }
+ if ( off < 0 )
+ {
+ s[basePos] = 0x2D; // '-'
+ off = -off;
+ }
- LogString hours;
- StringHelper::toString( off / 3600, p, hours );
- size_t hourPos = basePos + 2;
+ LogString hours;
+ StringHelper::toString( off / 3600, p, hours );
+ size_t hourPos = basePos + 2;
- //
- // assumes that point values for 0-9 are same between char and wchar_t
- //
- for ( size_t i = hours.length(); i-- > 0; )
- {
- s[hourPos--] = hours[i];
- }
+ //
+ // assumes that point values for 0-9 are same between char and wchar_t
+ //
+ for ( size_t i = hours.length(); i-- > 0; )
+ {
+ s[hourPos--] = hours[i];
+ }
- LogString min;
- StringHelper::toString( ( off % 3600 ) / 60, p, min );
- size_t minPos = basePos + 4;
+ LogString min;
+ StringHelper::toString( ( off % 3600 ) / 60, p, min );
+ size_t minPos = basePos + 4;
- //
- // assumes that point values for 0-9 are same between char and wchar_t
- //
- for ( size_t j = min.length(); j-- > 0; )
- {
- s[minPos--] = min[j];
- }
- }
- }
+ //
+ // assumes that point values for 0-9 are same between char and wchar_t
+ //
+ for ( size_t j = min.length(); j-- > 0; )
+ {
+ s[minPos--] = min[j];
+ }
+ }
+ }
};
@@ -646,206 +646,206 @@
using namespace log4cxx::helpers::SimpleDateFormatImpl;
void SimpleDateFormat::addToken(const logchar spec, const int repeat, const std::locale* locale,
- std::vector < PatternToken* >& pattern )
+ std::vector < PatternToken* >& pattern )
{
- PatternToken* token = NULL;
+ PatternToken* token = NULL;
- switch ( spec )
- {
- case 0x47: // 'G'
- token = ( new EraToken( repeat, locale ) );
- break;
+ switch ( spec )
+ {
+ case 0x47: // 'G'
+ token = ( new EraToken( repeat, locale ) );
+ break;
- case 0x79: // 'y'
- token = ( new YearToken( repeat ) );
- break;
+ case 0x79: // 'y'
+ token = ( new YearToken( repeat ) );
+ break;
- case 0x4D: // 'M'
- if ( repeat <= 2 )
- {
- token = ( new MonthToken( repeat ) );
- }
- else if ( repeat <= 3 )
- {
- token = ( new AbbreviatedMonthNameToken( repeat, locale ) );
- }
- else
- {
- token = ( new FullMonthNameToken( repeat, locale ) );
- }
+ case 0x4D: // 'M'
+ if ( repeat <= 2 )
+ {
+ token = ( new MonthToken( repeat ) );
+ }
+ else if ( repeat <= 3 )
+ {
+ token = ( new AbbreviatedMonthNameToken( repeat, locale ) );
+ }
+ else
+ {
+ token = ( new FullMonthNameToken( repeat, locale ) );
+ }
- break;
+ break;
- case 0x77: // 'w'
- token = ( new WeekInYearToken( repeat ) );
- break;
+ case 0x77: // 'w'
+ token = ( new WeekInYearToken( repeat ) );
+ break;
- case 0x57: // 'W'
- token = ( new WeekInMonthToken( repeat ) );
- break;
+ case 0x57: // 'W'
+ token = ( new WeekInMonthToken( repeat ) );
+ break;
- case 0x44: // 'D'
- token = ( new DayInYearToken( repeat ) );
- break;
+ case 0x44: // 'D'
+ token = ( new DayInYearToken( repeat ) );
+ break;
- case 0x64: // 'd'
- token = ( new DayInMonthToken( repeat ) );
- break;
+ case 0x64: // 'd'
+ token = ( new DayInMonthToken( repeat ) );
+ break;
- case 0x46: // 'F'
- token = ( new DayOfWeekInMonthToken( repeat ) );
- break;
+ case 0x46: // 'F'
+ token = ( new DayOfWeekInMonthToken( repeat ) );
+ break;
- case 0x45: // 'E'
- if ( repeat <= 3 )
- {
- token = ( new AbbreviatedDayNameToken( repeat, locale ) );
- }
- else
- {
- token = ( new FullDayNameToken( repeat, locale ) );
- }
+ case 0x45: // 'E'
+ if ( repeat <= 3 )
+ {
+ token = ( new AbbreviatedDayNameToken( repeat, locale ) );
+ }
+ else
+ {
+ token = ( new FullDayNameToken( repeat, locale ) );
+ }
- break;
+ break;
- case 0x61: // 'a'
- token = ( new AMPMToken( repeat, locale ) );
- break;
+ case 0x61: // 'a'
+ token = ( new AMPMToken( repeat, locale ) );
+ break;
- case 0x48: // 'H'
- token = ( new MilitaryHourToken( repeat, 0 ) );
- break;
+ case 0x48: // 'H'
+ token = ( new MilitaryHourToken( repeat, 0 ) );
+ break;
- case 0x6B: // 'k'
- token = ( new MilitaryHourToken( repeat, 1 ) );
- break;
+ case 0x6B: // 'k'
+ token = ( new MilitaryHourToken( repeat, 1 ) );
+ break;
- case 0x4B: // 'K'
- token = ( new HourToken( repeat, 0 ) );
- break;
+ case 0x4B: // 'K'
+ token = ( new HourToken( repeat, 0 ) );
+ break;
- case 0x68: // 'h'
- token = ( new HourToken( repeat, 1 ) );
- break;
+ case 0x68: // 'h'
+ token = ( new HourToken( repeat, 1 ) );
+ break;
- case 0x6D: // 'm'
- token = ( new MinuteToken( repeat ) );
- break;
+ case 0x6D: // 'm'
+ token = ( new MinuteToken( repeat ) );
+ break;
- case 0x73: // 's'
- token = ( new SecondToken( repeat ) );
- break;
+ case 0x73: // 's'
+ token = ( new SecondToken( repeat ) );
+ break;
- case 0x53: // 'S'
- if ( repeat == 6 )
- {
- token = ( new MicrosecondToken( repeat ) );
- }
- else
- {
- // It would be nice to support patterns with arbitrary
- // subsecond precision (like "s.S" or "s.SSSS"), but we
- // don't; so this is a back-compatible default.
- token = ( new MillisecondToken( repeat ) );
- }
+ case 0x53: // 'S'
+ if ( repeat == 6 )
+ {
+ token = ( new MicrosecondToken( repeat ) );
+ }
+ else
+ {
+ // It would be nice to support patterns with arbitrary
+ // subsecond precision (like "s.S" or "s.SSSS"), but we
+ // don't; so this is a back-compatible default.
+ token = ( new MillisecondToken( repeat ) );
+ }
- break;
+ break;
- case 0x7A: // 'z'
- token = ( new GeneralTimeZoneToken( repeat ) );
- break;
+ case 0x7A: // 'z'
+ token = ( new GeneralTimeZoneToken( repeat ) );
+ break;
- case 0x5A: // 'Z'
- token = ( new RFC822TimeZoneToken( repeat ) );
- break;
+ case 0x5A: // 'Z'
+ token = ( new RFC822TimeZoneToken( repeat ) );
+ break;
- default:
- token = ( new LiteralToken( spec, repeat ) );
- }
+ default:
+ token = ( new LiteralToken( spec, repeat ) );
+ }
- assert( token != NULL );
- pattern.push_back( token );
+ assert( token != NULL );
+ pattern.push_back( token );
}
void SimpleDateFormat::parsePattern( const LogString& fmt, const std::locale* locale,
- std::vector < PatternToken* >& pattern )
+ std::vector < PatternToken* >& pattern )
{
- if ( !fmt.empty() )
- {
- LogString::const_iterator iter = fmt.begin();
- int repeat = 1;
- logchar prevChar = * iter;
+ if ( !fmt.empty() )
+ {
+ LogString::const_iterator iter = fmt.begin();
+ int repeat = 1;
+ logchar prevChar = * iter;
- for ( iter++; iter != fmt.end(); iter++ )
- {
- if ( * iter == prevChar )
- {
- repeat++;
- }
- else
- {
- addToken( prevChar, repeat, locale, pattern );
- prevChar = * iter;
- repeat = 1;
- }
- }
+ for ( iter++; iter != fmt.end(); iter++ )
+ {
+ if ( * iter == prevChar )
+ {
+ repeat++;
+ }
+ else
+ {
+ addToken( prevChar, repeat, locale, pattern );
+ prevChar = * iter;
+ repeat = 1;
+ }
+ }
- addToken( prevChar, repeat, locale, pattern );
- }
+ addToken( prevChar, repeat, locale, pattern );
+ }
}
SimpleDateFormat::SimpleDateFormat( const LogString& fmt ) : timeZone( TimeZone::getDefault() )
{
#if LOG4CXX_HAS_STD_LOCALE
- std::locale defaultLocale;
- parsePattern( fmt, & defaultLocale, pattern );
+ std::locale defaultLocale;
+ parsePattern( fmt, & defaultLocale, pattern );
#else
- parsePattern( fmt, NULL, pattern );
+ parsePattern( fmt, NULL, pattern );
#endif
- for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
- {
- ( * iter )->setTimeZone( timeZone );
- }
+ for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
+ {
+ ( * iter )->setTimeZone( timeZone );
+ }
}
SimpleDateFormat::SimpleDateFormat( const LogString& fmt, const std::locale* locale ) : timeZone( TimeZone::getDefault() )
{
- parsePattern( fmt, locale, pattern );
+ parsePattern( fmt, locale, pattern );
- for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
- {
- ( * iter )->setTimeZone( timeZone );
- }
+ for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
+ {
+ ( * iter )->setTimeZone( timeZone );
+ }
}
SimpleDateFormat::~SimpleDateFormat()
{
- for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
- {
- delete * iter;
- }
+ for ( PatternTokenList::iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
+ {
+ delete * iter;
+ }
}
void SimpleDateFormat::format( LogString& s, log4cxx_time_t time, Pool& p ) const
{
- apr_time_exp_t exploded;
- apr_status_t stat = timeZone->explode( & exploded, time );
+ apr_time_exp_t exploded;
+ apr_status_t stat = timeZone->explode( & exploded, time );
- if ( stat == APR_SUCCESS )
- {
- for ( PatternTokenList::const_iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
- {
- ( * iter )->format( s, exploded, p );
- }
- }
+ if ( stat == APR_SUCCESS )
+ {
+ for ( PatternTokenList::const_iterator iter = pattern.begin(); iter != pattern.end(); iter++ )
+ {
+ ( * iter )->format( s, exploded, p );
+ }
+ }
}
void SimpleDateFormat::setTimeZone( const TimeZonePtr& zone )
{
- timeZone = zone;
+ timeZone = zone;
}
diff --git a/src/main/cpp/simplelayout.cpp b/src/main/cpp/simplelayout.cpp
index 2134d9e..2504a4c 100644
--- a/src/main/cpp/simplelayout.cpp
+++ b/src/main/cpp/simplelayout.cpp
@@ -27,11 +27,11 @@
void SimpleLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool&) const
+ const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool&) const
{
- output.append(event->getLevel()->toString());
- output.append(LOG4CXX_STR(" - "));
- output.append(event->getRenderedMessage());
- output.append(LOG4CXX_EOL);
+ output.append(event->getLevel()->toString());
+ output.append(LOG4CXX_STR(" - "));
+ output.append(event->getRenderedMessage());
+ output.append(LOG4CXX_EOL);
}
diff --git a/src/main/cpp/sizebasedtriggeringpolicy.cpp b/src/main/cpp/sizebasedtriggeringpolicy.cpp
index f843a19..e6c2963 100644
--- a/src/main/cpp/sizebasedtriggeringpolicy.cpp
+++ b/src/main/cpp/sizebasedtriggeringpolicy.cpp
@@ -26,26 +26,26 @@
IMPLEMENT_LOG4CXX_OBJECT(SizeBasedTriggeringPolicy)
SizeBasedTriggeringPolicy::SizeBasedTriggeringPolicy()
- : maxFileSize(10 * 1024 * 1024)
+ : maxFileSize(10 * 1024 * 1024)
{
}
bool SizeBasedTriggeringPolicy::isTriggeringEvent(Appender* /* appender */,
- const log4cxx::spi::LoggingEventPtr& /* event */,
- const LogString& /* file */,
- size_t fileLength)
+ const log4cxx::spi::LoggingEventPtr& /* event */,
+ const LogString& /* file */,
+ size_t fileLength)
{
- return (fileLength >= maxFileSize);
+ return (fileLength >= maxFileSize);
}
size_t SizeBasedTriggeringPolicy::getMaxFileSize()
{
- return maxFileSize;
+ return maxFileSize;
}
void SizeBasedTriggeringPolicy::setMaxFileSize(size_t l)
{
- maxFileSize = l;
+ maxFileSize = l;
}
void SizeBasedTriggeringPolicy::activateOptions(Pool& /* p */)
@@ -54,10 +54,10 @@
void SizeBasedTriggeringPolicy::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("MAXFILESIZE"),
- LOG4CXX_STR("maxfilesize")))
- {
- maxFileSize = OptionConverter::toFileSize(value, 10 * 1024 * 1024);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXFILESIZE"),
+ LOG4CXX_STR("maxfilesize")))
+ {
+ maxFileSize = OptionConverter::toFileSize(value, 10 * 1024 * 1024);
+ }
}
diff --git a/src/main/cpp/smtpappender.cpp b/src/main/cpp/smtpappender.cpp
index 8972676..3be6600 100644
--- a/src/main/cpp/smtpappender.cpp
+++ b/src/main/cpp/smtpappender.cpp
@@ -24,7 +24,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <log4cxx/helpers/synchronized.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -39,8 +39,8 @@
using namespace log4cxx::spi;
#if LOG4CXX_HAVE_LIBESMTP
- #include <auth-client.h>
- #include <libesmtp.h>
+ #include <auth-client.h>
+ #include <libesmtp.h>
#endif
namespace log4cxx
@@ -59,120 +59,120 @@
*/
class SMTPSession
{
- public:
- /**
- * Create new instance.
- */
- SMTPSession(const LogString& smtpHost,
- int smtpPort,
- const LogString& smtpUsername,
- const LogString& smtpPassword,
- Pool& p) : session(0), authctx(0),
- user(toAscii(smtpUsername, p)),
- pwd(toAscii(smtpPassword, p))
- {
- auth_client_init();
- session = smtp_create_session();
+ public:
+ /**
+ * Create new instance.
+ */
+ SMTPSession(const LogString& smtpHost,
+ int smtpPort,
+ const LogString& smtpUsername,
+ const LogString& smtpPassword,
+ Pool& p) : session(0), authctx(0),
+ user(toAscii(smtpUsername, p)),
+ pwd(toAscii(smtpPassword, p))
+ {
+ auth_client_init();
+ session = smtp_create_session();
- if (session == 0)
- {
- throw Exception("Could not initialize session.");
- }
+ if (session == 0)
+ {
+ throw Exception("Could not initialize session.");
+ }
- std::string host(toAscii(smtpHost, p));
- host.append(1, ':');
- host.append(p.itoa(smtpPort));
- smtp_set_server(session, host.c_str());
+ std::string host(toAscii(smtpHost, p));
+ host.append(1, ':');
+ host.append(p.itoa(smtpPort));
+ smtp_set_server(session, host.c_str());
- authctx = auth_create_context();
- auth_set_mechanism_flags(authctx, AUTH_PLUGIN_PLAIN, 0);
- auth_set_interact_cb(authctx, authinteract, (void*) this);
+ authctx = auth_create_context();
+ auth_set_mechanism_flags(authctx, AUTH_PLUGIN_PLAIN, 0);
+ auth_set_interact_cb(authctx, authinteract, (void*) this);
- if (*user || *pwd)
- {
- smtp_auth_set_context(session, authctx);
- }
- }
+ if (*user || *pwd)
+ {
+ smtp_auth_set_context(session, authctx);
+ }
+ }
- ~SMTPSession()
- {
- smtp_destroy_session(session);
- auth_destroy_context(authctx);
- }
+ ~SMTPSession()
+ {
+ smtp_destroy_session(session);
+ auth_destroy_context(authctx);
+ }
- void send(Pool& p)
- {
- int status = smtp_start_session(session);
+ void send(Pool& p)
+ {
+ int status = smtp_start_session(session);
- if (!status)
- {
- size_t bufSize = 128;
- char* buf = p.pstralloc(bufSize);
- smtp_strerror(smtp_errno(), buf, bufSize);
- throw Exception(buf);
- }
- }
+ if (!status)
+ {
+ size_t bufSize = 128;
+ char* buf = p.pstralloc(bufSize);
+ smtp_strerror(smtp_errno(), buf, bufSize);
+ throw Exception(buf);
+ }
+ }
- operator smtp_session_t()
- {
- return session;
- }
+ operator smtp_session_t()
+ {
+ return session;
+ }
- static char* toAscii(const LogString& str, Pool& p)
- {
- char* buf = p.pstralloc(str.length() + 1);
- char* current = buf;
+ static char* toAscii(const LogString& str, Pool& p)
+ {
+ char* buf = p.pstralloc(str.length() + 1);
+ char* current = buf;
- for (LogString::const_iterator iter = str.begin();
- iter != str.end();
- iter++)
- {
- unsigned int c = *iter;
+ for (LogString::const_iterator iter = str.begin();
+ iter != str.end();
+ iter++)
+ {
+ unsigned int c = *iter;
- if (c > 0x7F)
- {
- c = '?';
- }
+ if (c > 0x7F)
+ {
+ c = '?';
+ }
- *current++ = c;
- }
+ *current++ = c;
+ }
- *current = 0;
- return buf;
- }
+ *current = 0;
+ return buf;
+ }
- private:
- SMTPSession(SMTPSession&);
- SMTPSession& operator=(SMTPSession&);
- smtp_session_t session;
- auth_context_t authctx;
- char* user;
- char* pwd;
+ private:
+ SMTPSession(SMTPSession&);
+ SMTPSession& operator=(SMTPSession&);
+ smtp_session_t session;
+ auth_context_t authctx;
+ char* user;
+ char* pwd;
- /**
- * This method is called if the SMTP server requests authentication.
- */
- static int authinteract(auth_client_request_t request, char** result, int fields,
- void* arg)
- {
- SMTPSession* pThis = (SMTPSession*) arg;
+ /**
+ * This method is called if the SMTP server requests authentication.
+ */
+ static int authinteract(auth_client_request_t request, char** result, int fields,
+ void* arg)
+ {
+ SMTPSession* pThis = (SMTPSession*) arg;
- for (int i = 0; i < fields; i++)
- {
- int flag = request[i].flags & 0x07;
+ for (int i = 0; i < fields; i++)
+ {
+ int flag = request[i].flags & 0x07;
- if (flag == AUTH_USER)
- {
- result[i] = pThis->user;
- }
- else if (flag == AUTH_PASS)
- {
- result[i] = pThis->pwd;
- }
- }
+ if (flag == AUTH_USER)
+ {
+ result[i] = pThis->user;
+ }
+ else if (flag == AUTH_PASS)
+ {
+ result[i] = pThis->pwd;
+ }
+ }
- return 1;
- }
+ return 1;
+ }
};
@@ -182,193 +182,193 @@
*/
class SMTPMessage
{
- public:
- SMTPMessage(SMTPSession& session,
- const LogString& from,
- const LogString& to,
- const LogString& cc,
- const LogString& bcc,
- const LogString& subject,
- const LogString msg, Pool& p)
- {
- message = smtp_add_message(session);
- body = current = toMessage(msg, p);
- messagecbState = 0;
- smtp_set_reverse_path(message, toAscii(from, p));
- addRecipients(to, "To", p);
- addRecipients(cc, "Cc", p);
- addRecipients(bcc, "Bcc", p);
+ public:
+ SMTPMessage(SMTPSession& session,
+ const LogString& from,
+ const LogString& to,
+ const LogString& cc,
+ const LogString& bcc,
+ const LogString& subject,
+ const LogString msg, Pool& p)
+ {
+ message = smtp_add_message(session);
+ body = current = toMessage(msg, p);
+ messagecbState = 0;
+ smtp_set_reverse_path(message, toAscii(from, p));
+ addRecipients(to, "To", p);
+ addRecipients(cc, "Cc", p);
+ addRecipients(bcc, "Bcc", p);
- if (!subject.empty())
- {
- smtp_set_header(message, "Subject", toAscii(subject, p));
- }
+ if (!subject.empty())
+ {
+ smtp_set_header(message, "Subject", toAscii(subject, p));
+ }
- smtp_set_messagecb(message, messagecb, this);
- }
- ~SMTPMessage()
- {
- }
+ smtp_set_messagecb(message, messagecb, this);
+ }
+ ~SMTPMessage()
+ {
+ }
- private:
- SMTPMessage(const SMTPMessage&);
- SMTPMessage& operator=(const SMTPMessage&);
- smtp_message_t message;
- const char* body;
- const char* current;
- int messagecbState;
- void addRecipients(const LogString& addresses, const char* field, Pool& p)
- {
- if (!addresses.empty())
- {
- char* str = p.pstrdup(toAscii(addresses, p));;
- smtp_set_header(message, field, NULL, str);
- char* last;
+ private:
+ SMTPMessage(const SMTPMessage&);
+ SMTPMessage& operator=(const SMTPMessage&);
+ smtp_message_t message;
+ const char* body;
+ const char* current;
+ int messagecbState;
+ void addRecipients(const LogString& addresses, const char* field, Pool& p)
+ {
+ if (!addresses.empty())
+ {
+ char* str = p.pstrdup(toAscii(addresses, p));;
+ smtp_set_header(message, field, NULL, str);
+ char* last;
- for (char* next = apr_strtok(str, ",", &last);
- next;
- next = apr_strtok(NULL, ",", &last))
- {
- smtp_add_recipient(message, next);
- }
- }
- }
- static const char* toAscii(const LogString& str, Pool& p)
- {
- return SMTPSession::toAscii(str, p);
- }
+ for (char* next = apr_strtok(str, ",", &last);
+ next;
+ next = apr_strtok(NULL, ",", &last))
+ {
+ smtp_add_recipient(message, next);
+ }
+ }
+ }
+ static const char* toAscii(const LogString& str, Pool& p)
+ {
+ return SMTPSession::toAscii(str, p);
+ }
- /**
- * Message bodies can only contain US-ASCII characters and
- * CR and LFs can only occur together.
- */
- static const char* toMessage(const LogString& str, Pool& p)
- {
- //
- // count the number of carriage returns and line feeds
- //
- int feedCount = 0;
+ /**
+ * Message bodies can only contain US-ASCII characters and
+ * CR and LFs can only occur together.
+ */
+ static const char* toMessage(const LogString& str, Pool& p)
+ {
+ //
+ // count the number of carriage returns and line feeds
+ //
+ int feedCount = 0;
- for (size_t pos = str.find_first_of(LOG4CXX_STR("\n\r"));
- pos != LogString::npos;
- pos = str.find_first_of(LOG4CXX_STR("\n\r"), ++pos))
- {
- feedCount++;
- }
+ for (size_t pos = str.find_first_of(LOG4CXX_STR("\n\r"));
+ pos != LogString::npos;
+ pos = str.find_first_of(LOG4CXX_STR("\n\r"), ++pos))
+ {
+ feedCount++;
+ }
- //
- // allocate sufficient space for the modified message
- char* retval = p.pstralloc(str.length() + feedCount + 1);
- char* current = retval;
- char* startOfLine = current;
+ //
+ // allocate sufficient space for the modified message
+ char* retval = p.pstralloc(str.length() + feedCount + 1);
+ char* current = retval;
+ char* startOfLine = current;
- //
- // iterator through message
- //
- for (LogString::const_iterator iter = str.begin();
- iter != str.end();
- iter++)
- {
- unsigned int c = *iter;
+ //
+ // iterator through message
+ //
+ for (LogString::const_iterator iter = str.begin();
+ iter != str.end();
+ iter++)
+ {
+ unsigned int c = *iter;
- //
- // replace non-ASCII characters with '?'
- //
- if (c > 0x7F)
- {
- *current++ = 0x3F; // '?'
- }
- else if (c == 0x0A || c == 0x0D)
- {
- //
- // replace any stray CR or LF with CRLF
- // reset start of line
- *current++ = 0x0D;
- *current++ = 0x0A;
- startOfLine = current;
- LogString::const_iterator next = iter + 1;
+ //
+ // replace non-ASCII characters with '?'
+ //
+ if (c > 0x7F)
+ {
+ *current++ = 0x3F; // '?'
+ }
+ else if (c == 0x0A || c == 0x0D)
+ {
+ //
+ // replace any stray CR or LF with CRLF
+ // reset start of line
+ *current++ = 0x0D;
+ *current++ = 0x0A;
+ startOfLine = current;
+ LogString::const_iterator next = iter + 1;
- if (next != str.end() && (*next == 0x0A || *next == 0x0D))
- {
- iter++;
- }
- }
- else
- {
- //
- // truncate any lines to 1000 characters (including CRLF)
- // as required by RFC.
- if (current < startOfLine + 998)
- {
- *current++ = (char) c;
- }
- }
- }
+ if (next != str.end() && (*next == 0x0A || *next == 0x0D))
+ {
+ iter++;
+ }
+ }
+ else
+ {
+ //
+ // truncate any lines to 1000 characters (including CRLF)
+ // as required by RFC.
+ if (current < startOfLine + 998)
+ {
+ *current++ = (char) c;
+ }
+ }
+ }
- *current = 0;
- return retval;
- }
+ *current = 0;
+ return retval;
+ }
- /**
- * Callback for message.
- */
- static const char* messagecb(void** ctx, int* len, void* arg)
- {
- *ctx = 0;
- const char* retval = 0;
- SMTPMessage* pThis = (SMTPMessage*) arg;
+ /**
+ * Callback for message.
+ */
+ static const char* messagecb(void** ctx, int* len, void* arg)
+ {
+ *ctx = 0;
+ const char* retval = 0;
+ SMTPMessage* pThis = (SMTPMessage*) arg;
- // rewind message
- if (len == NULL)
- {
- pThis->current = pThis->body;
- }
- else
- {
- // we are asked for headers, but we don't have any
- if ((pThis->messagecbState)++ == 0)
- {
- return NULL;
- }
+ // rewind message
+ if (len == NULL)
+ {
+ pThis->current = pThis->body;
+ }
+ else
+ {
+ // we are asked for headers, but we don't have any
+ if ((pThis->messagecbState)++ == 0)
+ {
+ return NULL;
+ }
- if (pThis->current)
- {
- *len = strlen(pThis->current);
- }
+ if (pThis->current)
+ {
+ *len = strlen(pThis->current);
+ }
- retval = pThis->current;
- pThis->current = 0;
- }
+ retval = pThis->current;
+ pThis->current = 0;
+ }
- return retval;
- }
+ return retval;
+ }
};
#endif
class LOG4CXX_EXPORT DefaultEvaluator :
- public virtual spi::TriggeringEventEvaluator,
- public virtual helpers::ObjectImpl
+ public virtual spi::TriggeringEventEvaluator,
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_LOG4CXX_OBJECT(DefaultEvaluator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DefaultEvaluator)
- LOG4CXX_CAST_ENTRY(spi::TriggeringEventEvaluator)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(DefaultEvaluator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DefaultEvaluator)
+ LOG4CXX_CAST_ENTRY(spi::TriggeringEventEvaluator)
+ END_LOG4CXX_CAST_MAP()
- DefaultEvaluator();
+ DefaultEvaluator();
- /**
- Is this <code>event</code> the e-mail triggering event?
- <p>This method returns <code>true</code>, if the event level
- has ERROR level or higher. Otherwise it returns
- <code>false</code>.
- */
- virtual bool isTriggeringEvent(const spi::LoggingEventPtr& event);
- private:
- DefaultEvaluator(const DefaultEvaluator&);
- DefaultEvaluator& operator=(const DefaultEvaluator&);
+ /**
+ Is this <code>event</code> the e-mail triggering event?
+ <p>This method returns <code>true</code>, if the event level
+ has ERROR level or higher. Otherwise it returns
+ <code>false</code>.
+ */
+ virtual bool isTriggeringEvent(const spi::LoggingEventPtr& event);
+ private:
+ DefaultEvaluator(const DefaultEvaluator&);
+ DefaultEvaluator& operator=(const DefaultEvaluator&);
}; // class DefaultEvaluator
}
@@ -383,12 +383,12 @@
bool DefaultEvaluator::isTriggeringEvent(const spi::LoggingEventPtr& event)
{
- return event->getLevel()->isGreaterOrEqual(Level::getError());
+ return event->getLevel()->isGreaterOrEqual(Level::getError());
}
SMTPAppender::SMTPAppender()
- : smtpPort(25), bufferSize(512), locationInfo(false), cb(bufferSize),
- evaluator(new DefaultEvaluator())
+ : smtpPort(25), bufferSize(512), locationInfo(false), cb(bufferSize),
+ evaluator(new DefaultEvaluator())
{
}
@@ -396,91 +396,91 @@
Use <code>evaluator</code> passed as parameter as the
TriggeringEventEvaluator for this SMTPAppender. */
SMTPAppender::SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator)
- : smtpPort(25), bufferSize(512), locationInfo(false), cb(bufferSize),
- evaluator(evaluator)
+ : smtpPort(25), bufferSize(512), locationInfo(false), cb(bufferSize),
+ evaluator(evaluator)
{
}
SMTPAppender::~SMTPAppender()
{
- finalize();
+ finalize();
}
bool SMTPAppender::requiresLayout() const
{
- return true;
+ return true;
}
LogString SMTPAppender::getFrom() const
{
- return from;
+ return from;
}
void SMTPAppender::setFrom(const LogString& newVal)
{
- from = newVal;
+ from = newVal;
}
LogString SMTPAppender::getSubject() const
{
- return subject;
+ return subject;
}
void SMTPAppender::setSubject(const LogString& newVal)
{
- subject = newVal;
+ subject = newVal;
}
LogString SMTPAppender::getSMTPHost() const
{
- return smtpHost;
+ return smtpHost;
}
void SMTPAppender::setSMTPHost(const LogString& newVal)
{
- smtpHost = newVal;
+ smtpHost = newVal;
}
int SMTPAppender::getSMTPPort() const
{
- return smtpPort;
+ return smtpPort;
}
void SMTPAppender::setSMTPPort(int newVal)
{
- smtpPort = newVal;
+ smtpPort = newVal;
}
bool SMTPAppender::getLocationInfo() const
{
- return locationInfo;
+ return locationInfo;
}
void SMTPAppender::setLocationInfo(bool newVal)
{
- locationInfo = newVal;
+ locationInfo = newVal;
}
LogString SMTPAppender::getSMTPUsername() const
{
- return smtpUsername;
+ return smtpUsername;
}
void SMTPAppender::setSMTPUsername(const LogString& newVal)
{
- smtpUsername = newVal;
+ smtpUsername = newVal;
}
LogString SMTPAppender::getSMTPPassword() const
{
- return smtpPassword;
+ return smtpPassword;
}
void SMTPAppender::setSMTPPassword(const LogString& newVal)
{
- smtpPassword = newVal;
+ smtpPassword = newVal;
}
@@ -488,73 +488,73 @@
void SMTPAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- setBufferSize(OptionConverter::toInt(value, 512));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("EVALUATORCLASS"), LOG4CXX_STR("evaluatorclass")))
- {
- setEvaluatorClass(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FROM"), LOG4CXX_STR("from")))
- {
- setFrom(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPHOST"), LOG4CXX_STR("smtphost")))
- {
- setSMTPHost(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPUSERNAME"), LOG4CXX_STR("smtpusername")))
- {
- setSMTPUsername(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPPASSWORD"), LOG4CXX_STR("smtppassword")))
- {
- setSMTPPassword(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SUBJECT"), LOG4CXX_STR("subject")))
- {
- setSubject(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("TO"), LOG4CXX_STR("to")))
- {
- setTo(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("CC"), LOG4CXX_STR("cc")))
- {
- setCc(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BCC"), LOG4CXX_STR("bcc")))
- {
- setBcc(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPPORT"), LOG4CXX_STR("smtpport")))
- {
- setSMTPPort(OptionConverter::toInt(value, 25));
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ setBufferSize(OptionConverter::toInt(value, 512));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("EVALUATORCLASS"), LOG4CXX_STR("evaluatorclass")))
+ {
+ setEvaluatorClass(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FROM"), LOG4CXX_STR("from")))
+ {
+ setFrom(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPHOST"), LOG4CXX_STR("smtphost")))
+ {
+ setSMTPHost(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPUSERNAME"), LOG4CXX_STR("smtpusername")))
+ {
+ setSMTPUsername(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPPASSWORD"), LOG4CXX_STR("smtppassword")))
+ {
+ setSMTPPassword(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SUBJECT"), LOG4CXX_STR("subject")))
+ {
+ setSubject(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("TO"), LOG4CXX_STR("to")))
+ {
+ setTo(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("CC"), LOG4CXX_STR("cc")))
+ {
+ setCc(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BCC"), LOG4CXX_STR("bcc")))
+ {
+ setBcc(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SMTPPORT"), LOG4CXX_STR("smtpport")))
+ {
+ setSMTPPort(OptionConverter::toInt(value, 25));
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
bool SMTPAppender::asciiCheck(const LogString& value, const LogString& field)
{
- for (LogString::const_iterator iter = value.begin();
- iter != value.end();
- iter++)
- {
- if (0x7F < (unsigned int) *iter)
- {
- LogLog::warn(field + LOG4CXX_STR(" contains non-ASCII character"));
- return false;
- }
- }
+ for (LogString::const_iterator iter = value.begin();
+ iter != value.end();
+ iter++)
+ {
+ if (0x7F < (unsigned int) *iter)
+ {
+ LogLog::warn(field + LOG4CXX_STR(" contains non-ASCII character"));
+ return false;
+ }
+ }
- return true;
+ return true;
}
/**
@@ -562,49 +562,49 @@
recipient, from, etc. */
void SMTPAppender::activateOptions(Pool& p)
{
- bool activate = true;
+ bool activate = true;
- if (layout == 0)
- {
- errorHandler->error(LOG4CXX_STR("No layout set for appender named [") + name + LOG4CXX_STR("]."));
- activate = false;
- }
+ if (layout == 0)
+ {
+ errorHandler->error(LOG4CXX_STR("No layout set for appender named [") + name + LOG4CXX_STR("]."));
+ activate = false;
+ }
- if (evaluator == 0)
- {
- errorHandler->error(LOG4CXX_STR("No TriggeringEventEvaluator is set for appender [") +
- name + LOG4CXX_STR("]."));
- activate = false;
- }
+ if (evaluator == 0)
+ {
+ errorHandler->error(LOG4CXX_STR("No TriggeringEventEvaluator is set for appender [") +
+ name + LOG4CXX_STR("]."));
+ activate = false;
+ }
- if (smtpHost.empty())
- {
- errorHandler->error(LOG4CXX_STR("No smtpHost is set for appender [") +
- name + LOG4CXX_STR("]."));
- activate = false;
- }
+ if (smtpHost.empty())
+ {
+ errorHandler->error(LOG4CXX_STR("No smtpHost is set for appender [") +
+ name + LOG4CXX_STR("]."));
+ activate = false;
+ }
- if (to.empty() && cc.empty() && bcc.empty())
- {
- errorHandler->error(LOG4CXX_STR("No recipient address is set for appender [") +
- name + LOG4CXX_STR("]."));
- activate = false;
- }
+ if (to.empty() && cc.empty() && bcc.empty())
+ {
+ errorHandler->error(LOG4CXX_STR("No recipient address is set for appender [") +
+ name + LOG4CXX_STR("]."));
+ activate = false;
+ }
- activate &= asciiCheck(to, LOG4CXX_STR("to"));
- activate &= asciiCheck(cc, LOG4CXX_STR("cc"));
- activate &= asciiCheck(bcc, LOG4CXX_STR("bcc"));
- activate &= asciiCheck(from, LOG4CXX_STR("from"));
+ activate &= asciiCheck(to, LOG4CXX_STR("to"));
+ activate &= asciiCheck(cc, LOG4CXX_STR("cc"));
+ activate &= asciiCheck(bcc, LOG4CXX_STR("bcc"));
+ activate &= asciiCheck(from, LOG4CXX_STR("from"));
#if !LOG4CXX_HAVE_LIBESMTP
- errorHandler->error(LOG4CXX_STR("log4cxx built without SMTP support."));
- activate = false;
+ errorHandler->error(LOG4CXX_STR("log4cxx built without SMTP support."));
+ activate = false;
#endif
- if (activate)
- {
- AppenderSkeleton::activateOptions(p);
- }
+ if (activate)
+ {
+ AppenderSkeleton::activateOptions(p);
+ }
}
/**
@@ -613,23 +613,23 @@
an e-mail to be sent. */
void SMTPAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
- if (!checkEntryConditions())
- {
- return;
- }
+ if (!checkEntryConditions())
+ {
+ return;
+ }
- LogString ndc;
- event->getNDC(ndc);
- event->getThreadName();
- // Get a copy of this thread's MDC.
- event->getMDCCopy();
+ LogString ndc;
+ event->getNDC(ndc);
+ event->getThreadName();
+ // Get a copy of this thread's MDC.
+ event->getMDCCopy();
- cb.add(event);
+ cb.add(event);
- if (evaluator->isTriggeringEvent(event))
- {
- sendBuffer(p);
- }
+ if (evaluator->isTriggeringEvent(event))
+ {
+ sendBuffer(p);
+ }
}
/**
@@ -641,29 +641,29 @@
{
#if LOG4CXX_HAVE_LIBESMTP
- if ((to.empty() && cc.empty() && bcc.empty()) || from.empty() || smtpHost.empty())
- {
- errorHandler->error(LOG4CXX_STR("Message not configured."));
- return false;
- }
+ if ((to.empty() && cc.empty() && bcc.empty()) || from.empty() || smtpHost.empty())
+ {
+ errorHandler->error(LOG4CXX_STR("Message not configured."));
+ return false;
+ }
- if (evaluator == 0)
- {
- errorHandler->error(LOG4CXX_STR("No TriggeringEventEvaluator is set for appender [") +
- name + LOG4CXX_STR("]."));
- return false;
- }
+ if (evaluator == 0)
+ {
+ errorHandler->error(LOG4CXX_STR("No TriggeringEventEvaluator is set for appender [") +
+ name + LOG4CXX_STR("]."));
+ return false;
+ }
- if (layout == 0)
- {
- errorHandler->error(LOG4CXX_STR("No layout set for appender named [") + name + LOG4CXX_STR("]."));
- return false;
- }
+ if (layout == 0)
+ {
+ errorHandler->error(LOG4CXX_STR("No layout set for appender named [") + name + LOG4CXX_STR("]."));
+ return false;
+ }
- return true;
+ return true;
#else
- return false;
+ return false;
#endif
}
@@ -671,37 +671,37 @@
void SMTPAppender::close()
{
- this->closed = true;
+ this->closed = true;
}
LogString SMTPAppender::getTo() const
{
- return to;
+ return to;
}
void SMTPAppender::setTo(const LogString& addressStr)
{
- to = addressStr;
+ to = addressStr;
}
LogString SMTPAppender::getCc() const
{
- return cc;
+ return cc;
}
void SMTPAppender::setCc(const LogString& addressStr)
{
- cc = addressStr;
+ cc = addressStr;
}
LogString SMTPAppender::getBcc() const
{
- return bcc;
+ return bcc;
}
void SMTPAppender::setBcc(const LogString& addressStr)
{
- bcc = addressStr;
+ bcc = addressStr;
}
/**
@@ -711,35 +711,35 @@
{
#if LOG4CXX_HAVE_LIBESMTP
- // Note: this code already owns the monitor for this
- // appender. This frees us from needing to synchronize on 'cb'.
- try
- {
- LogString sbuf;
- layout->appendHeader(sbuf, p);
+ // Note: this code already owns the monitor for this
+ // appender. This frees us from needing to synchronize on 'cb'.
+ try
+ {
+ LogString sbuf;
+ layout->appendHeader(sbuf, p);
- int len = cb.length();
+ int len = cb.length();
- for (int i = 0; i < len; i++)
- {
- LoggingEventPtr event = cb.get();
- layout->format(sbuf, event, p);
- }
+ for (int i = 0; i < len; i++)
+ {
+ LoggingEventPtr event = cb.get();
+ layout->format(sbuf, event, p);
+ }
- layout->appendFooter(sbuf, p);
+ layout->appendFooter(sbuf, p);
- SMTPSession session(smtpHost, smtpPort, smtpUsername, smtpPassword, p);
+ SMTPSession session(smtpHost, smtpPort, smtpUsername, smtpPassword, p);
- SMTPMessage message(session, from, to, cc,
- bcc, subject, sbuf, p);
+ SMTPMessage message(session, from, to, cc,
+ bcc, subject, sbuf, p);
- session.send(p);
+ session.send(p);
- }
- catch (std::exception& e)
- {
- LogLog::error(LOG4CXX_STR("Error occured while sending e-mail notification."), e);
- }
+ }
+ catch (std::exception& e)
+ {
+ LogLog::error(LOG4CXX_STR("Error occured while sending e-mail notification."), e);
+ }
#endif
}
@@ -749,17 +749,17 @@
*/
LogString SMTPAppender::getEvaluatorClass()
{
- return evaluator == 0 ? LogString() : evaluator->getClass().getName();
+ return evaluator == 0 ? LogString() : evaluator->getClass().getName();
}
log4cxx::spi::TriggeringEventEvaluatorPtr SMTPAppender::getEvaluator() const
{
- return evaluator;
+ return evaluator;
}
void SMTPAppender::setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger)
{
- evaluator = trigger;
+ evaluator = trigger;
}
/**
@@ -771,8 +771,8 @@
*/
void SMTPAppender::setBufferSize(int sz)
{
- this->bufferSize = sz;
- cb.resize(sz);
+ this->bufferSize = sz;
+ cb.resize(sz);
}
/**
@@ -784,7 +784,7 @@
*/
void SMTPAppender::setEvaluatorClass(const LogString& value)
{
- evaluator = OptionConverter::instantiateByClassName(value,
- TriggeringEventEvaluator::getStaticClass(), evaluator);
+ evaluator = OptionConverter::instantiateByClassName(value,
+ TriggeringEventEvaluator::getStaticClass(), evaluator);
}
diff --git a/src/main/cpp/socket.cpp b/src/main/cpp/socket.cpp
index bf683a0..2ede191 100644
--- a/src/main/cpp/socket.cpp
+++ b/src/main/cpp/socket.cpp
@@ -31,64 +31,64 @@
*/
Socket::Socket(InetAddressPtr& addr, int prt) : pool(), socket(0), address(addr), port(prt)
{
- apr_status_t status =
- apr_socket_create(&socket, APR_INET, SOCK_STREAM,
- APR_PROTO_TCP, pool.getAPRPool());
+ apr_status_t status =
+ apr_socket_create(&socket, APR_INET, SOCK_STREAM,
+ APR_PROTO_TCP, pool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- LOG4CXX_ENCODE_CHAR(host, addr->getHostAddress());
+ LOG4CXX_ENCODE_CHAR(host, addr->getHostAddress());
- // create socket address (including port)
- apr_sockaddr_t* client_addr;
- status =
- apr_sockaddr_info_get(&client_addr, host.c_str(), APR_INET,
- prt, 0, pool.getAPRPool());
+ // create socket address (including port)
+ apr_sockaddr_t* client_addr;
+ status =
+ apr_sockaddr_info_get(&client_addr, host.c_str(), APR_INET,
+ prt, 0, pool.getAPRPool());
- if (status != APR_SUCCESS)
- {
- throw ConnectException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw ConnectException(status);
+ }
- // connect the socket
- status = apr_socket_connect(socket, client_addr);
+ // connect the socket
+ status = apr_socket_connect(socket, client_addr);
- if (status != APR_SUCCESS)
- {
- throw ConnectException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw ConnectException(status);
+ }
}
Socket::Socket(apr_socket_t* s, apr_pool_t* p) :
- pool(p, true), socket(s)
+ pool(p, true), socket(s)
{
- apr_sockaddr_t* sa;
- apr_status_t status = apr_socket_addr_get(&sa, APR_REMOTE, s);
+ apr_sockaddr_t* sa;
+ apr_status_t status = apr_socket_addr_get(&sa, APR_REMOTE, s);
- if (status == APR_SUCCESS)
- {
- port = sa->port;
- LogString remotename;
- LogString remoteip;
+ if (status == APR_SUCCESS)
+ {
+ port = sa->port;
+ LogString remotename;
+ LogString remoteip;
- if (sa->hostname != NULL)
- {
- Transcoder::decode(sa->hostname, remotename);
- }
+ if (sa->hostname != NULL)
+ {
+ Transcoder::decode(sa->hostname, remotename);
+ }
- char* buf = 0;
- status = apr_sockaddr_ip_get(&buf, sa);
+ char* buf = 0;
+ status = apr_sockaddr_ip_get(&buf, sa);
- if (status == APR_SUCCESS)
- {
- Transcoder::decode(buf, remoteip);
- }
+ if (status == APR_SUCCESS)
+ {
+ Transcoder::decode(buf, remoteip);
+ }
- address = new InetAddress(remotename, remoteip);
- }
+ address = new InetAddress(remotename, remoteip);
+ }
}
Socket::~Socket()
@@ -97,65 +97,65 @@
size_t Socket::write(ByteBuffer& buf)
{
- if (socket == 0)
- {
- throw ClosedChannelException();
- }
+ if (socket == 0)
+ {
+ throw ClosedChannelException();
+ }
- int totalWritten = 0;
+ int totalWritten = 0;
- while (buf.remaining() > 0)
- {
- apr_size_t written = buf.remaining();
+ while (buf.remaining() > 0)
+ {
+ apr_size_t written = buf.remaining();
- // while writing to the socket, we need to ignore the SIGPIPE
- // signal. Otherwise, when the client has closed the connection,
- // the send() function would not return an error but call the
- // SIGPIPE handler.
+ // while writing to the socket, we need to ignore the SIGPIPE
+ // signal. Otherwise, when the client has closed the connection,
+ // the send() function would not return an error but call the
+ // SIGPIPE handler.
#if APR_HAVE_SIGACTION
- apr_sigfunc_t* old = apr_signal(SIGPIPE, SIG_IGN);
- apr_status_t status = apr_socket_send(socket, buf.current(), &written);
- apr_signal(SIGPIPE, old);
+ apr_sigfunc_t* old = apr_signal(SIGPIPE, SIG_IGN);
+ apr_status_t status = apr_socket_send(socket, buf.current(), &written);
+ apr_signal(SIGPIPE, old);
#else
- apr_status_t status = apr_socket_send(socket, buf.current(), &written);
+ apr_status_t status = apr_socket_send(socket, buf.current(), &written);
#endif
- buf.position(buf.position() + written);
- totalWritten += written;
+ buf.position(buf.position() + written);
+ totalWritten += written;
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
+ }
- return totalWritten;
+ return totalWritten;
}
void Socket::close()
{
- if (socket != 0)
- {
- apr_status_t status = apr_socket_close(socket);
+ if (socket != 0)
+ {
+ apr_status_t status = apr_socket_close(socket);
- if (status != APR_SUCCESS)
- {
- throw SocketException(status);
- }
+ if (status != APR_SUCCESS)
+ {
+ throw SocketException(status);
+ }
- socket = 0;
- }
+ socket = 0;
+ }
}
InetAddressPtr Socket::getInetAddress() const
{
- return address;
+ return address;
}
int Socket::getPort() const
{
- return port;
+ return port;
}
diff --git a/src/main/cpp/socketappender.cpp b/src/main/cpp/socketappender.cpp
index 7af0287..06d7b39 100644
--- a/src/main/cpp/socketappender.cpp
+++ b/src/main/cpp/socketappender.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/net/socketappender.h>
@@ -44,87 +44,87 @@
int SocketAppender::DEFAULT_RECONNECTION_DELAY = 30000;
SocketAppender::SocketAppender()
- : SocketAppenderSkeleton(DEFAULT_PORT, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(DEFAULT_PORT, DEFAULT_RECONNECTION_DELAY)
{
}
SocketAppender::SocketAppender(InetAddressPtr& address1, int port1)
- : SocketAppenderSkeleton(address1, port1, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(address1, port1, DEFAULT_RECONNECTION_DELAY)
{
- Pool p;
- activateOptions(p);
+ Pool p;
+ activateOptions(p);
}
SocketAppender::SocketAppender(const LogString& host, int port1)
- : SocketAppenderSkeleton(host, port1, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(host, port1, DEFAULT_RECONNECTION_DELAY)
{
- Pool p;
- activateOptions(p);
+ Pool p;
+ activateOptions(p);
}
SocketAppender::~SocketAppender()
{
- finalize();
+ finalize();
}
int SocketAppender::getDefaultDelay() const
{
- return DEFAULT_RECONNECTION_DELAY;
+ return DEFAULT_RECONNECTION_DELAY;
}
int SocketAppender::getDefaultPort() const
{
- return DEFAULT_PORT;
+ return DEFAULT_PORT;
}
void SocketAppender::setSocket(log4cxx::helpers::SocketPtr& socket, Pool& p)
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- oos = new ObjectOutputStream(new SocketOutputStream(socket), p);
+ oos = new ObjectOutputStream(new SocketOutputStream(socket), p);
}
void SocketAppender::cleanUp(Pool& p)
{
- if (oos == 0)
- {
- return;
- }
+ if (oos == 0)
+ {
+ return;
+ }
- try
- {
- oos->close(p);
- oos = 0;
- }
- catch (std::exception& e)
- {}
+ try
+ {
+ oos->close(p);
+ oos = 0;
+ }
+ catch (std::exception& e)
+ {}
}
void SocketAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p)
{
- if (oos == 0)
- {
- return;
- }
+ if (oos == 0)
+ {
+ return;
+ }
- LogString ndcVal;
- event->getNDC(ndcVal);
- event->getThreadName();
- event->getMDCCopy();
+ LogString ndcVal;
+ event->getNDC(ndcVal);
+ event->getThreadName();
+ event->getMDCCopy();
- try
- {
- event->write(*oos, p);
- oos->reset(p);
- }
- catch (std::exception& e)
- {
- oos = 0;
- LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e);
+ try
+ {
+ event->write(*oos, p);
+ oos->reset(p);
+ }
+ catch (std::exception& e)
+ {
+ oos = 0;
+ LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e);
- if (getReconnectionDelay() > 0)
- {
- fireConnector();
- }
- }
+ if (getReconnectionDelay() > 0)
+ {
+ fireConnector();
+ }
+ }
}
diff --git a/src/main/cpp/socketappenderskeleton.cpp b/src/main/cpp/socketappenderskeleton.cpp
index dcad50c..af08126 100755
--- a/src/main/cpp/socketappenderskeleton.cpp
+++ b/src/main/cpp/socketappenderskeleton.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#define __STDC_CONSTANT_MACROS
@@ -33,195 +33,195 @@
using namespace log4cxx::net;
SocketAppenderSkeleton::SocketAppenderSkeleton(int defaultPort, int reconnectionDelay1)
- : remoteHost(),
- address(),
- port(defaultPort),
- reconnectionDelay(reconnectionDelay1),
- locationInfo(false),
- thread()
+ : remoteHost(),
+ address(),
+ port(defaultPort),
+ reconnectionDelay(reconnectionDelay1),
+ locationInfo(false),
+ thread()
{
}
SocketAppenderSkeleton::SocketAppenderSkeleton(InetAddressPtr address1, int port1, int delay)
- :
- remoteHost(),
- address(address1),
- port(port1),
- reconnectionDelay(delay),
- locationInfo(false),
- thread()
+ :
+ remoteHost(),
+ address(address1),
+ port(port1),
+ reconnectionDelay(delay),
+ locationInfo(false),
+ thread()
{
- remoteHost = this->address->getHostName();
+ remoteHost = this->address->getHostName();
}
SocketAppenderSkeleton::SocketAppenderSkeleton(const LogString& host, int port1, int delay)
- : remoteHost(host),
- address(InetAddress::getByName(host)),
- port(port1),
- reconnectionDelay(delay),
- locationInfo(false),
- thread()
+ : remoteHost(host),
+ address(InetAddress::getByName(host)),
+ port(port1),
+ reconnectionDelay(delay),
+ locationInfo(false),
+ thread()
{
}
SocketAppenderSkeleton::~SocketAppenderSkeleton()
{
- finalize();
+ finalize();
- try
- {
- thread.join();
- }
- catch (ThreadException& ex)
- {
- LogLog::error(LOG4CXX_STR("Error closing socket appender connection thread"), ex);
- }
+ try
+ {
+ thread.join();
+ }
+ catch (ThreadException& ex)
+ {
+ LogLog::error(LOG4CXX_STR("Error closing socket appender connection thread"), ex);
+ }
}
void SocketAppenderSkeleton::activateOptions(Pool& p)
{
- AppenderSkeleton::activateOptions(p);
- connect(p);
+ AppenderSkeleton::activateOptions(p);
+ connect(p);
}
void SocketAppenderSkeleton::close()
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (closed)
- {
- return;
- }
+ if (closed)
+ {
+ return;
+ }
- closed = true;
- cleanUp(pool);
- thread.interrupt();
+ closed = true;
+ cleanUp(pool);
+ thread.interrupt();
}
void SocketAppenderSkeleton::connect(Pool& p)
{
- if (address == 0)
- {
- LogLog::error(LogString(LOG4CXX_STR("No remote host is set for Appender named \"")) +
- name + LOG4CXX_STR("\"."));
- }
- else
- {
- cleanUp(p);
+ if (address == 0)
+ {
+ LogLog::error(LogString(LOG4CXX_STR("No remote host is set for Appender named \"")) +
+ name + LOG4CXX_STR("\"."));
+ }
+ else
+ {
+ cleanUp(p);
- try
- {
- SocketPtr socket(new Socket(address, port));
- setSocket(socket, p);
- }
- catch (SocketException& e)
- {
- LogString msg = LOG4CXX_STR("Could not connect to remote log4cxx server at [")
- + address->getHostName() + LOG4CXX_STR("].");
+ try
+ {
+ SocketPtr socket(new Socket(address, port));
+ setSocket(socket, p);
+ }
+ catch (SocketException& e)
+ {
+ LogString msg = LOG4CXX_STR("Could not connect to remote log4cxx server at [")
+ + address->getHostName() + LOG4CXX_STR("].");
- if (reconnectionDelay > 0)
- {
- msg += LOG4CXX_STR(" We will try again later. ");
- }
+ if (reconnectionDelay > 0)
+ {
+ msg += LOG4CXX_STR(" We will try again later. ");
+ }
- fireConnector(); // fire the connector thread
- LogLog::error(msg, e);
- }
- }
+ fireConnector(); // fire the connector thread
+ LogLog::error(msg, e);
+ }
+ }
}
void SocketAppenderSkeleton::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("REMOTEHOST"), LOG4CXX_STR("remotehost")))
- {
- setRemoteHost(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
- {
- setPort(OptionConverter::toInt(value, getDefaultPort()));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, false));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("RECONNECTIONDELAY"), LOG4CXX_STR("reconnectiondelay")))
- {
- setReconnectionDelay(OptionConverter::toInt(value, getDefaultDelay()));
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("REMOTEHOST"), LOG4CXX_STR("remotehost")))
+ {
+ setRemoteHost(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
+ {
+ setPort(OptionConverter::toInt(value, getDefaultPort()));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, false));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("RECONNECTIONDELAY"), LOG4CXX_STR("reconnectiondelay")))
+ {
+ setReconnectionDelay(OptionConverter::toInt(value, getDefaultDelay()));
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void SocketAppenderSkeleton::fireConnector()
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if ( !thread.isAlive() )
- {
- LogLog::debug(LOG4CXX_STR("Connector thread not alive: starting monitor."));
+ if ( !thread.isAlive() )
+ {
+ LogLog::debug(LOG4CXX_STR("Connector thread not alive: starting monitor."));
- try
- {
- thread.run(monitor, this);
- }
- catch ( ThreadException& te )
- {
- LogLog::error(LOG4CXX_STR("Monitor not started: "), te);
- }
- }
+ try
+ {
+ thread.run(monitor, this);
+ }
+ catch ( ThreadException& te )
+ {
+ LogLog::error(LOG4CXX_STR("Monitor not started: "), te);
+ }
+ }
}
void* LOG4CXX_THREAD_FUNC SocketAppenderSkeleton::monitor(apr_thread_t* /* thread */, void* data)
{
- SocketAppenderSkeleton* socketAppender = (SocketAppenderSkeleton*) data;
- SocketPtr socket;
- bool isClosed = socketAppender->closed;
+ SocketAppenderSkeleton* socketAppender = (SocketAppenderSkeleton*) data;
+ SocketPtr socket;
+ bool isClosed = socketAppender->closed;
- while (!isClosed)
- {
- try
- {
- Thread::sleep(socketAppender->reconnectionDelay);
+ while (!isClosed)
+ {
+ try
+ {
+ Thread::sleep(socketAppender->reconnectionDelay);
- if (!socketAppender->closed)
- {
- LogLog::debug(LogString(LOG4CXX_STR("Attempting connection to "))
- + socketAppender->address->getHostName());
- socket = new Socket(socketAppender->address, socketAppender->port);
- Pool p;
- socketAppender->setSocket(socket, p);
- LogLog::debug(LOG4CXX_STR("Connection established. Exiting connector thread."));
- }
+ if (!socketAppender->closed)
+ {
+ LogLog::debug(LogString(LOG4CXX_STR("Attempting connection to "))
+ + socketAppender->address->getHostName());
+ socket = new Socket(socketAppender->address, socketAppender->port);
+ Pool p;
+ socketAppender->setSocket(socket, p);
+ LogLog::debug(LOG4CXX_STR("Connection established. Exiting connector thread."));
+ }
- return NULL;
- }
- catch (InterruptedException&)
- {
- LogLog::debug(LOG4CXX_STR("Connector interrupted. Leaving loop."));
- return NULL;
- }
- catch (ConnectException&)
- {
- LogLog::debug(LOG4CXX_STR("Remote host ")
- + socketAppender->address->getHostName()
- + LOG4CXX_STR(" refused connection."));
- }
- catch (IOException& e)
- {
- LogString exmsg;
- log4cxx::helpers::Transcoder::decode(e.what(), exmsg);
+ return NULL;
+ }
+ catch (InterruptedException&)
+ {
+ LogLog::debug(LOG4CXX_STR("Connector interrupted. Leaving loop."));
+ return NULL;
+ }
+ catch (ConnectException&)
+ {
+ LogLog::debug(LOG4CXX_STR("Remote host ")
+ + socketAppender->address->getHostName()
+ + LOG4CXX_STR(" refused connection."));
+ }
+ catch (IOException& e)
+ {
+ LogString exmsg;
+ log4cxx::helpers::Transcoder::decode(e.what(), exmsg);
- LogLog::debug(((LogString) LOG4CXX_STR("Could not connect to "))
- + socketAppender->address->getHostName()
- + LOG4CXX_STR(". Exception is ")
- + exmsg);
- }
+ LogLog::debug(((LogString) LOG4CXX_STR("Could not connect to "))
+ + socketAppender->address->getHostName()
+ + LOG4CXX_STR(". Exception is ")
+ + exmsg);
+ }
- isClosed = socketAppender->closed;
- }
+ isClosed = socketAppender->closed;
+ }
- LogLog::debug(LOG4CXX_STR("Exiting Connector.run() method."));
- return NULL;
+ LogLog::debug(LOG4CXX_STR("Exiting Connector.run() method."));
+ return NULL;
}
diff --git a/src/main/cpp/sockethubappender.cpp b/src/main/cpp/sockethubappender.cpp
index 1c7d3c6..79646f7 100644
--- a/src/main/cpp/sockethubappender.cpp
+++ b/src/main/cpp/sockethubappender.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/net/sockethubappender.h>
@@ -45,211 +45,211 @@
SocketHubAppender::~SocketHubAppender()
{
- finalize();
+ finalize();
}
SocketHubAppender::SocketHubAppender()
- : port(DEFAULT_PORT), streams(), locationInfo(false), thread()
+ : port(DEFAULT_PORT), streams(), locationInfo(false), thread()
{
}
SocketHubAppender::SocketHubAppender(int port1)
- : port(port1), streams(), locationInfo(false), thread()
+ : port(port1), streams(), locationInfo(false), thread()
{
- startServer();
+ startServer();
}
void SocketHubAppender::activateOptions(Pool& /* p */ )
{
- startServer();
+ startServer();
}
void SocketHubAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
- {
- setPort(OptionConverter::toInt(value, DEFAULT_PORT));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, true));
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
+ {
+ setPort(OptionConverter::toInt(value, DEFAULT_PORT));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, true));
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void SocketHubAppender::close()
{
- {
- LOCK_W sync(mutex);
+ {
+ LOCK_W sync(mutex);
- if (closed)
- {
- return;
- }
+ if (closed)
+ {
+ return;
+ }
- closed = true;
- }
+ closed = true;
+ }
- LogLog::debug(LOG4CXX_STR("closing SocketHubAppender ") + getName());
- //
- // wait until the server thread completes
- //
- thread.join();
+ LogLog::debug(LOG4CXX_STR("closing SocketHubAppender ") + getName());
+ //
+ // wait until the server thread completes
+ //
+ thread.join();
- LOCK_W sync(mutex);
- // close all of the connections
- LogLog::debug(LOG4CXX_STR("closing client connections"));
+ LOCK_W sync(mutex);
+ // close all of the connections
+ LogLog::debug(LOG4CXX_STR("closing client connections"));
- for (std::vector<helpers::ObjectOutputStreamPtr>::iterator iter = streams.begin();
- iter != streams.end();
- iter++)
- {
- if ( (*iter) != NULL)
- {
- try
- {
- (*iter)->close(pool);
- }
- catch (SocketException& e)
- {
- LogLog::error(LOG4CXX_STR("could not close socket: "), e);
- }
- }
- }
+ for (std::vector<helpers::ObjectOutputStreamPtr>::iterator iter = streams.begin();
+ iter != streams.end();
+ iter++)
+ {
+ if ( (*iter) != NULL)
+ {
+ try
+ {
+ (*iter)->close(pool);
+ }
+ catch (SocketException& e)
+ {
+ LogLog::error(LOG4CXX_STR("could not close socket: "), e);
+ }
+ }
+ }
- streams.erase(streams.begin(), streams.end());
+ streams.erase(streams.begin(), streams.end());
- LogLog::debug(LOG4CXX_STR("SocketHubAppender ")
- + getName() + LOG4CXX_STR(" closed"));
+ LogLog::debug(LOG4CXX_STR("SocketHubAppender ")
+ + getName() + LOG4CXX_STR(" closed"));
}
void SocketHubAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
- // if no open connections, exit now
- if (streams.empty())
- {
- return;
- }
+ // if no open connections, exit now
+ if (streams.empty())
+ {
+ return;
+ }
- LogString ndcVal;
- event->getNDC(ndcVal);
- event->getThreadName();
- // Get a copy of this thread's MDC.
- event->getMDCCopy();
+ LogString ndcVal;
+ event->getNDC(ndcVal);
+ event->getThreadName();
+ // Get a copy of this thread's MDC.
+ event->getMDCCopy();
- // loop through the current set of open connections, appending the event to each
- std::vector<ObjectOutputStreamPtr>::iterator it = streams.begin();
- std::vector<ObjectOutputStreamPtr>::iterator itEnd = streams.end();
+ // loop through the current set of open connections, appending the event to each
+ std::vector<ObjectOutputStreamPtr>::iterator it = streams.begin();
+ std::vector<ObjectOutputStreamPtr>::iterator itEnd = streams.end();
- while (it != itEnd)
- {
- // list size changed unexpectedly? Just exit the append.
- if (*it == 0)
- {
- break;
- }
+ while (it != itEnd)
+ {
+ // list size changed unexpectedly? Just exit the append.
+ if (*it == 0)
+ {
+ break;
+ }
- try
- {
- event->write(**it, p);
- (*it)->flush(p);
- it++;
- }
- catch (std::exception& e)
- {
- // there was an io exception so just drop the connection
- it = streams.erase(it);
- itEnd = streams.end();
- LogLog::debug(LOG4CXX_STR("dropped connection"), e);
- }
- }
+ try
+ {
+ event->write(**it, p);
+ (*it)->flush(p);
+ it++;
+ }
+ catch (std::exception& e)
+ {
+ // there was an io exception so just drop the connection
+ it = streams.erase(it);
+ itEnd = streams.end();
+ LogLog::debug(LOG4CXX_STR("dropped connection"), e);
+ }
+ }
}
void SocketHubAppender::startServer()
{
- thread.run(monitor, this);
+ thread.run(monitor, this);
}
void* APR_THREAD_FUNC SocketHubAppender::monitor(apr_thread_t* /* thread */, void* data)
{
- SocketHubAppender* pThis = (SocketHubAppender*) data;
+ SocketHubAppender* pThis = (SocketHubAppender*) data;
- ServerSocket* serverSocket = 0;
+ ServerSocket* serverSocket = 0;
- try
- {
- serverSocket = new ServerSocket(pThis->port);
- serverSocket->setSoTimeout(1000);
- }
- catch (SocketException& e)
- {
- LogLog::error(LOG4CXX_STR("exception setting timeout, shutting down server socket."), e);
- delete serverSocket;
- return NULL;
- }
+ try
+ {
+ serverSocket = new ServerSocket(pThis->port);
+ serverSocket->setSoTimeout(1000);
+ }
+ catch (SocketException& e)
+ {
+ LogLog::error(LOG4CXX_STR("exception setting timeout, shutting down server socket."), e);
+ delete serverSocket;
+ return NULL;
+ }
- bool stopRunning = pThis->closed;
+ bool stopRunning = pThis->closed;
- while (!stopRunning)
- {
- SocketPtr socket;
+ while (!stopRunning)
+ {
+ SocketPtr socket;
- try
- {
- socket = serverSocket->accept();
- }
- catch (InterruptedIOException&)
- {
- // timeout occurred, so just loop
- }
- catch (SocketException& e)
- {
- LogLog::error(LOG4CXX_STR("exception accepting socket, shutting down server socket."), e);
- stopRunning = true;
- }
- catch (IOException& e)
- {
- LogLog::error(LOG4CXX_STR("exception accepting socket."), e);
- }
+ try
+ {
+ socket = serverSocket->accept();
+ }
+ catch (InterruptedIOException&)
+ {
+ // timeout occurred, so just loop
+ }
+ catch (SocketException& e)
+ {
+ LogLog::error(LOG4CXX_STR("exception accepting socket, shutting down server socket."), e);
+ stopRunning = true;
+ }
+ catch (IOException& e)
+ {
+ LogLog::error(LOG4CXX_STR("exception accepting socket."), e);
+ }
- // if there was a socket accepted
- if (socket != 0)
- {
- try
- {
- InetAddressPtr remoteAddress = socket->getInetAddress();
- LogLog::debug(LOG4CXX_STR("accepting connection from ")
- + remoteAddress->getHostName()
- + LOG4CXX_STR(" (")
- + remoteAddress->getHostAddress()
- + LOG4CXX_STR(")"));
+ // if there was a socket accepted
+ if (socket != 0)
+ {
+ try
+ {
+ InetAddressPtr remoteAddress = socket->getInetAddress();
+ LogLog::debug(LOG4CXX_STR("accepting connection from ")
+ + remoteAddress->getHostName()
+ + LOG4CXX_STR(" (")
+ + remoteAddress->getHostAddress()
+ + LOG4CXX_STR(")"));
- // add it to the oosList.
- LOCK_W sync(pThis->mutex);
- OutputStreamPtr os(new SocketOutputStream(socket));
- Pool p;
- ObjectOutputStreamPtr oos(new ObjectOutputStream(os, p));
- pThis->streams.push_back(oos);
- }
- catch (IOException& e)
- {
- LogLog::error(LOG4CXX_STR("exception creating output stream on socket."), e);
- }
- }
+ // add it to the oosList.
+ LOCK_W sync(pThis->mutex);
+ OutputStreamPtr os(new SocketOutputStream(socket));
+ Pool p;
+ ObjectOutputStreamPtr oos(new ObjectOutputStream(os, p));
+ pThis->streams.push_back(oos);
+ }
+ catch (IOException& e)
+ {
+ LogLog::error(LOG4CXX_STR("exception creating output stream on socket."), e);
+ }
+ }
- stopRunning = (stopRunning || pThis->closed);
- }
+ stopRunning = (stopRunning || pThis->closed);
+ }
- delete serverSocket;
- return NULL;
+ delete serverSocket;
+ return NULL;
}
#endif
diff --git a/src/main/cpp/socketoutputstream.cpp b/src/main/cpp/socketoutputstream.cpp
index bf19ebe..250ddd3 100644
--- a/src/main/cpp/socketoutputstream.cpp
+++ b/src/main/cpp/socketoutputstream.cpp
@@ -29,7 +29,7 @@
IMPLEMENT_LOG4CXX_OBJECT(SocketOutputStream)
SocketOutputStream::SocketOutputStream(const SocketPtr& socket1)
- : socket(socket1)
+ : socket(socket1)
{
}
@@ -39,29 +39,29 @@
void SocketOutputStream::close(Pool& p)
{
- flush(p);
- socket->close();
+ flush(p);
+ socket->close();
}
void SocketOutputStream::flush(Pool& /* p */)
{
- if (array.size() > 0)
- {
- ByteBuffer buf((char*) &array[0], array.size());
- socket->write(buf);
- array.resize(0);
- }
+ if (array.size() > 0)
+ {
+ ByteBuffer buf((char*) &array[0], array.size());
+ socket->write(buf);
+ array.resize(0);
+ }
}
void SocketOutputStream::write(ByteBuffer& buf, Pool& /* p */ )
{
- if (buf.remaining() > 0)
- {
- size_t sz = array.size();
- array.resize(sz + buf.remaining());
- memcpy(&array[sz], buf.current(), buf.remaining());
- buf.position(buf.limit());
- }
+ if (buf.remaining() > 0)
+ {
+ size_t sz = array.size();
+ array.resize(sz + buf.remaining());
+ memcpy(&array[sz], buf.current(), buf.remaining());
+ buf.position(buf.limit());
+ }
}
diff --git a/src/main/cpp/strftimedateformat.cpp b/src/main/cpp/strftimedateformat.cpp
index a8bf3c0..f3a1c4d 100644
--- a/src/main/cpp/strftimedateformat.cpp
+++ b/src/main/cpp/strftimedateformat.cpp
@@ -26,9 +26,9 @@
StrftimeDateFormat::StrftimeDateFormat(const LogString& fmt)
- : timeZone(TimeZone::getDefault())
+ : timeZone(TimeZone::getDefault())
{
- log4cxx::helpers::Transcoder::encode(fmt, pattern);
+ log4cxx::helpers::Transcoder::encode(fmt, pattern);
}
StrftimeDateFormat::~StrftimeDateFormat()
@@ -38,26 +38,26 @@
void StrftimeDateFormat::format(LogString& s, log4cxx_time_t time, Pool& /* p */ ) const
{
- apr_time_exp_t exploded;
- apr_status_t stat = timeZone->explode(&exploded, time);
+ apr_time_exp_t exploded;
+ apr_status_t stat = timeZone->explode(&exploded, time);
- if (stat == APR_SUCCESS)
- {
- const apr_size_t bufSize = 255;
- char buf[bufSize];
- apr_size_t bufLen;
- stat = apr_strftime(buf, &bufLen, bufSize, pattern.c_str(), &exploded);
+ if (stat == APR_SUCCESS)
+ {
+ const apr_size_t bufSize = 255;
+ char buf[bufSize];
+ apr_size_t bufLen;
+ stat = apr_strftime(buf, &bufLen, bufSize, pattern.c_str(), &exploded);
- if (stat == APR_SUCCESS)
- {
- log4cxx::helpers::Transcoder::decode(std::string(buf, bufLen), s);
- }
- }
+ if (stat == APR_SUCCESS)
+ {
+ log4cxx::helpers::Transcoder::decode(std::string(buf, bufLen), s);
+ }
+ }
}
void StrftimeDateFormat::setTimeZone(const TimeZonePtr& zone)
{
- timeZone = zone;
+ timeZone = zone;
}
diff --git a/src/main/cpp/stringhelper.cpp b/src/main/cpp/stringhelper.cpp
index 4964d32..6dcce0e 100644
--- a/src/main/cpp/stringhelper.cpp
+++ b/src/main/cpp/stringhelper.cpp
@@ -24,7 +24,7 @@
#include <apr_strings.h>
#include <log4cxx/helpers/pool.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#include <cctype>
@@ -32,7 +32,7 @@
#include <apr.h>
//LOG4CXX-417: need stdlib.h for atoi on some systems.
#ifdef APR_HAVE_STDLIB_H
- #include <stdlib.h>
+ #include <stdlib.h>
#endif
@@ -41,168 +41,168 @@
bool StringHelper::equalsIgnoreCase(const LogString& s1, const logchar* upper, const logchar* lower)
{
- for (LogString::const_iterator iter = s1.begin();
- iter != s1.end();
- iter++, upper++, lower++)
- {
- if (*iter != *upper && *iter != * lower)
- {
- return false;
- }
- }
+ for (LogString::const_iterator iter = s1.begin();
+ iter != s1.end();
+ iter++, upper++, lower++)
+ {
+ if (*iter != *upper && *iter != * lower)
+ {
+ return false;
+ }
+ }
- return (*upper == 0);
+ return (*upper == 0);
}
bool StringHelper::equalsIgnoreCase(const LogString& s1, const LogString& upper, const LogString& lower)
{
- LogString::const_iterator u = upper.begin();
- LogString::const_iterator l = lower.begin();
- LogString::const_iterator iter = s1.begin();
+ LogString::const_iterator u = upper.begin();
+ LogString::const_iterator l = lower.begin();
+ LogString::const_iterator iter = s1.begin();
- for (;
- iter != s1.end() && u != upper.end() && l != lower.end();
- iter++, u++, l++)
- {
- if (*iter != *u && *iter != *l)
- {
- return false;
- }
- }
+ for (;
+ iter != s1.end() && u != upper.end() && l != lower.end();
+ iter++, u++, l++)
+ {
+ if (*iter != *u && *iter != *l)
+ {
+ return false;
+ }
+ }
- return u == upper.end() && iter == s1.end();
+ return u == upper.end() && iter == s1.end();
}
LogString StringHelper::toLowerCase(const LogString& s)
{
- LogString d;
- std::transform(s.begin(), s.end(),
- std::insert_iterator<LogString>(d, d.begin()), tolower);
- return d;
+ LogString d;
+ std::transform(s.begin(), s.end(),
+ std::insert_iterator<LogString>(d, d.begin()), tolower);
+ return d;
}
LogString StringHelper::trim(const LogString& s)
{
- LogString::size_type pos = s.find_first_not_of(' ');
+ LogString::size_type pos = s.find_first_not_of(' ');
- if (pos == std::string::npos)
- {
- return LogString();
- }
+ if (pos == std::string::npos)
+ {
+ return LogString();
+ }
- LogString::size_type n = s.find_last_not_of(' ') - pos + 1;
- return s.substr(pos, n);
+ LogString::size_type n = s.find_last_not_of(' ') - pos + 1;
+ return s.substr(pos, n);
}
bool StringHelper::startsWith(const LogString& s, const LogString& prefix)
{
- if (s.length() < prefix.length())
- {
- return false;
- }
+ if (s.length() < prefix.length())
+ {
+ return false;
+ }
- return s.compare(0, prefix.length(), prefix) == 0;
+ return s.compare(0, prefix.length(), prefix) == 0;
}
bool StringHelper::endsWith(const LogString& s, const LogString& suffix)
{
- if (suffix.length() <= s.length())
- {
- return s.compare(s.length() - suffix.length(), suffix.length(), suffix) == 0;
- }
+ if (suffix.length() <= s.length())
+ {
+ return s.compare(s.length() - suffix.length(), suffix.length(), suffix) == 0;
+ }
- return false;
+ return false;
}
int StringHelper::toInt(const LogString& s)
{
- std::string as;
- Transcoder::encode(s, as);
- return atoi(as.c_str());
+ std::string as;
+ Transcoder::encode(s, as);
+ return atoi(as.c_str());
}
log4cxx_int64_t StringHelper::toInt64(const LogString& s)
{
- std::string as;
- Transcoder::encode(s, as);
- return apr_atoi64(as.c_str());
+ std::string as;
+ Transcoder::encode(s, as);
+ return apr_atoi64(as.c_str());
}
void StringHelper::toString(int n, Pool& pool, LogString& s)
{
- char* fmt = pool.itoa(n);
- Transcoder::decode(fmt, s);
+ char* fmt = pool.itoa(n);
+ Transcoder::decode(fmt, s);
}
void StringHelper::toString(bool val, LogString& dst)
{
- if (val)
- {
- dst.append(LOG4CXX_STR("true"));
- }
- else
- {
- dst.append(LOG4CXX_STR("false"));
- }
+ if (val)
+ {
+ dst.append(LOG4CXX_STR("true"));
+ }
+ else
+ {
+ dst.append(LOG4CXX_STR("false"));
+ }
}
void StringHelper::toString(log4cxx_int64_t n, Pool& pool, LogString& dst)
{
- if (n >= INT_MIN && n <= INT_MAX)
- {
- toString((int) n, pool, dst);
- }
- else
- {
- const log4cxx_int64_t BILLION = APR_INT64_C(1000000000);
- int billions = (int) (n / BILLION);
- char* upper = pool.itoa(billions);
- int remain = (int) (n - billions * BILLION);
+ if (n >= INT_MIN && n <= INT_MAX)
+ {
+ toString((int) n, pool, dst);
+ }
+ else
+ {
+ const log4cxx_int64_t BILLION = APR_INT64_C(1000000000);
+ int billions = (int) (n / BILLION);
+ char* upper = pool.itoa(billions);
+ int remain = (int) (n - billions * BILLION);
- if (remain < 0)
- {
- remain *= -1;
- }
+ if (remain < 0)
+ {
+ remain *= -1;
+ }
- char* lower = pool.itoa(remain);
- Transcoder::decode(upper, dst);
- dst.append(9 - strlen(lower), 0x30 /* '0' */);
- Transcoder::decode(lower, dst);
- }
+ char* lower = pool.itoa(remain);
+ Transcoder::decode(upper, dst);
+ dst.append(9 - strlen(lower), 0x30 /* '0' */);
+ Transcoder::decode(lower, dst);
+ }
}
void StringHelper::toString(size_t n, Pool& pool, LogString& s)
{
- toString((log4cxx_int64_t) n, pool, s);
+ toString((log4cxx_int64_t) n, pool, s);
}
LogString StringHelper::format(const LogString& pattern, const std::vector<LogString>& params)
{
- LogString result;
- int i = 0;
+ LogString result;
+ int i = 0;
- while (pattern[i] != 0)
- {
- if (pattern[i] == 0x7B /* '{' */ && pattern[i + 1] >= 0x30 /* '0' */ &&
- pattern[i + 1] <= 0x39 /* '9' */ && pattern[i + 2] == 0x7D /* '}' */)
- {
- int arg = pattern[i + 1] - 0x30 /* '0' */;
- result = result + params[arg];
- i += 3;
- }
- else
- {
- result = result + pattern[i];
- i++;
- }
- }
+ while (pattern[i] != 0)
+ {
+ if (pattern[i] == 0x7B /* '{' */ && pattern[i + 1] >= 0x30 /* '0' */ &&
+ pattern[i + 1] <= 0x39 /* '9' */ && pattern[i + 2] == 0x7D /* '}' */)
+ {
+ int arg = pattern[i + 1] - 0x30 /* '0' */;
+ result = result + params[arg];
+ i += 3;
+ }
+ else
+ {
+ result = result + pattern[i];
+ i++;
+ }
+ }
- return result;
+ return result;
}
diff --git a/src/main/cpp/stringmatchfilter.cpp b/src/main/cpp/stringmatchfilter.cpp
index de8c006..978a708 100644
--- a/src/main/cpp/stringmatchfilter.cpp
+++ b/src/main/cpp/stringmatchfilter.cpp
@@ -29,53 +29,53 @@
IMPLEMENT_LOG4CXX_OBJECT(StringMatchFilter)
StringMatchFilter::StringMatchFilter() :
- acceptOnMatch(true),
- stringToMatch()
+ acceptOnMatch(true),
+ stringToMatch()
{
}
void StringMatchFilter::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("STRINGTOMATCH"), LOG4CXX_STR("stringtomatch")))
- {
- stringToMatch = value;
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
- {
- acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
- }
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("STRINGTOMATCH"), LOG4CXX_STR("stringtomatch")))
+ {
+ stringToMatch = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
+ {
+ acceptOnMatch = OptionConverter::toBoolean(value, acceptOnMatch);
+ }
}
Filter::FilterDecision StringMatchFilter::decide(
- const log4cxx::spi::LoggingEventPtr& event) const
+ const log4cxx::spi::LoggingEventPtr& event) const
{
- const LogString& msg = event->getRenderedMessage();
+ const LogString& msg = event->getRenderedMessage();
- if (msg.empty() || stringToMatch.empty())
- {
- return Filter::NEUTRAL;
- }
+ if (msg.empty() || stringToMatch.empty())
+ {
+ return Filter::NEUTRAL;
+ }
- if ( msg.find(stringToMatch) == LogString::npos )
- {
- return Filter::NEUTRAL;
- }
- else
- {
- // we've got a match
- if (acceptOnMatch)
- {
- return Filter::ACCEPT;
- }
- else
- {
- return Filter::DENY;
- }
- }
+ if ( msg.find(stringToMatch) == LogString::npos )
+ {
+ return Filter::NEUTRAL;
+ }
+ else
+ {
+ // we've got a match
+ if (acceptOnMatch)
+ {
+ return Filter::ACCEPT;
+ }
+ else
+ {
+ return Filter::DENY;
+ }
+ }
}
diff --git a/src/main/cpp/stringtokenizer.cpp b/src/main/cpp/stringtokenizer.cpp
index 18880cb..5ac0b79 100644
--- a/src/main/cpp/stringtokenizer.cpp
+++ b/src/main/cpp/stringtokenizer.cpp
@@ -19,7 +19,7 @@
#include <log4cxx/helpers/stringtokenizer.h>
#include <log4cxx/helpers/exception.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -27,7 +27,7 @@
using namespace log4cxx::helpers;
StringTokenizer::StringTokenizer(const LogString& str, const LogString& delim1)
- : src(str), delim(delim1), pos(0)
+ : src(str), delim(delim1), pos(0)
{
}
@@ -37,31 +37,31 @@
bool StringTokenizer::hasMoreTokens() const
{
- return (pos != LogString::npos
- && src.find_first_not_of(delim, pos) != LogString::npos);
+ return (pos != LogString::npos
+ && src.find_first_not_of(delim, pos) != LogString::npos);
}
LogString StringTokenizer::nextToken()
{
- if (pos != LogString::npos)
- {
- size_t nextPos = src.find_first_not_of(delim, pos);
+ if (pos != LogString::npos)
+ {
+ size_t nextPos = src.find_first_not_of(delim, pos);
- if (nextPos != LogString::npos)
- {
- pos = src.find_first_of(delim, nextPos);
+ if (nextPos != LogString::npos)
+ {
+ pos = src.find_first_of(delim, nextPos);
- if (pos == LogString::npos)
- {
- return src.substr(nextPos);
- }
+ if (pos == LogString::npos)
+ {
+ return src.substr(nextPos);
+ }
- return src.substr(nextPos, pos - nextPos);
- }
- }
+ return src.substr(nextPos, pos - nextPos);
+ }
+ }
- throw NoSuchElementException();
+ throw NoSuchElementException();
#if LOG4CXX_RETURN_AFTER_THROW
- return LogString();
+ return LogString();
#endif
}
diff --git a/src/main/cpp/synchronized.cpp b/src/main/cpp/synchronized.cpp
index 7939c9c..03a130a 100644
--- a/src/main/cpp/synchronized.cpp
+++ b/src/main/cpp/synchronized.cpp
@@ -26,31 +26,31 @@
using namespace log4cxx;
synchronized::synchronized(const Mutex& mutex1)
- : mutex(mutex1.getAPRMutex())
+ : mutex(mutex1.getAPRMutex())
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_mutex_lock(
- (apr_thread_mutex_t*) this->mutex);
+ apr_status_t stat = apr_thread_mutex_lock(
+ (apr_thread_mutex_t*) this->mutex);
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
synchronized::synchronized(apr_thread_mutex_t* mutex1)
- : mutex(mutex1)
+ : mutex(mutex1)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_mutex_lock(
- (apr_thread_mutex_t*) this->mutex);
+ apr_status_t stat = apr_thread_mutex_lock(
+ (apr_thread_mutex_t*) this->mutex);
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -58,13 +58,13 @@
synchronized::~synchronized()
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_thread_mutex_unlock(
- (apr_thread_mutex_t*) mutex);
+ apr_status_t stat = apr_thread_mutex_unlock(
+ (apr_thread_mutex_t*) mutex);
- if (stat != APR_SUCCESS)
- {
- throw MutexException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw MutexException(stat);
+ }
#endif
}
@@ -72,25 +72,25 @@
#if defined(RW_MUTEX)
synchronized_read::synchronized_read(const RWMutex& mutex1)
- : mutex(mutex1)
+ : mutex(mutex1)
{
- mutex.rdLock();
+ mutex.rdLock();
}
synchronized_read::~synchronized_read()
{
- mutex.rdUnlock();
+ mutex.rdUnlock();
}
synchronized_write::synchronized_write(const RWMutex& mutex1)
- : mutex(mutex1)
+ : mutex(mutex1)
{
- mutex.wrLock();
+ mutex.wrLock();
}
synchronized_write::~synchronized_write()
{
- mutex.wrUnlock();
+ mutex.wrUnlock();
}
#endif // RW_MUTEX
diff --git a/src/main/cpp/syslogappender.cpp b/src/main/cpp/syslogappender.cpp
index abf7998..f330e44 100644
--- a/src/main/cpp/syslogappender.cpp
+++ b/src/main/cpp/syslogappender.cpp
@@ -23,36 +23,36 @@
#include <log4cxx/level.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#if LOG4CXX_HAVE_SYSLOG
- #include <syslog.h>
+ #include <syslog.h>
#else
- /* facility codes */
- #define LOG_KERN (0<<3) /* kernel messages */
- #define LOG_USER (1<<3) /* random user-level messages */
- #define LOG_MAIL (2<<3) /* mail system */
- #define LOG_DAEMON (3<<3) /* system daemons */
- #define LOG_AUTH (4<<3) /* security/authorization messages */
- #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
- #define LOG_LPR (6<<3) /* line printer subsystem */
- #define LOG_NEWS (7<<3) /* network news subsystem */
- #define LOG_UUCP (8<<3) /* UUCP subsystem */
- #define LOG_CRON (9<<3) /* clock daemon */
- #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
- #define LOG_FTP (11<<3) /* ftp daemon */
+ /* facility codes */
+ #define LOG_KERN (0<<3) /* kernel messages */
+ #define LOG_USER (1<<3) /* random user-level messages */
+ #define LOG_MAIL (2<<3) /* mail system */
+ #define LOG_DAEMON (3<<3) /* system daemons */
+ #define LOG_AUTH (4<<3) /* security/authorization messages */
+ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
+ #define LOG_LPR (6<<3) /* line printer subsystem */
+ #define LOG_NEWS (7<<3) /* network news subsystem */
+ #define LOG_UUCP (8<<3) /* UUCP subsystem */
+ #define LOG_CRON (9<<3) /* clock daemon */
+ #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
+ #define LOG_FTP (11<<3) /* ftp daemon */
- /* other codes through 15 reserved for system use */
- #define LOG_LOCAL0 (16<<3) /* reserved for local use */
- #define LOG_LOCAL1 (17<<3) /* reserved for local use */
- #define LOG_LOCAL2 (18<<3) /* reserved for local use */
- #define LOG_LOCAL3 (19<<3) /* reserved for local use */
- #define LOG_LOCAL4 (20<<3) /* reserved for local use */
- #define LOG_LOCAL5 (21<<3) /* reserved for local use */
- #define LOG_LOCAL6 (22<<3) /* reserved for local use */
- #define LOG_LOCAL7 (23<<3) /* reserved for local use */
+ /* other codes through 15 reserved for system use */
+ #define LOG_LOCAL0 (16<<3) /* reserved for local use */
+ #define LOG_LOCAL1 (17<<3) /* reserved for local use */
+ #define LOG_LOCAL2 (18<<3) /* reserved for local use */
+ #define LOG_LOCAL3 (19<<3) /* reserved for local use */
+ #define LOG_LOCAL4 (20<<3) /* reserved for local use */
+ #define LOG_LOCAL5 (21<<3) /* reserved for local use */
+ #define LOG_LOCAL6 (22<<3) /* reserved for local use */
+ #define LOG_LOCAL7 (23<<3) /* reserved for local use */
#endif
#define LOG_UNDEF -1
@@ -64,64 +64,64 @@
IMPLEMENT_LOG4CXX_OBJECT(SyslogAppender)
SyslogAppender::SyslogAppender()
- : syslogFacility(LOG_USER), facilityPrinting(false), sw(0)
+ : syslogFacility(LOG_USER), facilityPrinting(false), sw(0)
{
- this->initSyslogFacilityStr();
+ this->initSyslogFacilityStr();
}
SyslogAppender::SyslogAppender(const LayoutPtr& layout1,
- int syslogFacility1)
- : syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
+ int syslogFacility1)
+ : syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
{
- this->layout = layout1;
- this->initSyslogFacilityStr();
+ this->layout = layout1;
+ this->initSyslogFacilityStr();
}
SyslogAppender::SyslogAppender(const LayoutPtr& layout1,
- const LogString& syslogHost1, int syslogFacility1)
- : syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
+ const LogString& syslogHost1, int syslogFacility1)
+ : syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
{
- this->layout = layout1;
- this->initSyslogFacilityStr();
- setSyslogHost(syslogHost1);
+ this->layout = layout1;
+ this->initSyslogFacilityStr();
+ setSyslogHost(syslogHost1);
}
SyslogAppender::~SyslogAppender()
{
- finalize();
+ finalize();
}
/** Release any resources held by this SyslogAppender.*/
void SyslogAppender::close()
{
- closed = true;
+ closed = true;
- if (sw != 0)
- {
- delete sw;
- sw = 0;
- }
+ if (sw != 0)
+ {
+ delete sw;
+ sw = 0;
+ }
}
void SyslogAppender::initSyslogFacilityStr()
{
- facilityStr = getFacilityString(this->syslogFacility);
+ facilityStr = getFacilityString(this->syslogFacility);
- if (facilityStr.empty())
- {
- Pool p;
- LogString msg(LOG4CXX_STR("\""));
- StringHelper::toString(syslogFacility, p, msg);
- msg.append(LOG4CXX_STR("\" is an unknown syslog facility. Defaulting to \"USER\"."));
- LogLog::error(msg);
- this->syslogFacility = LOG_USER;
- facilityStr = LOG4CXX_STR("user:");
- }
- else
- {
- facilityStr += LOG4CXX_STR(":");
- }
+ if (facilityStr.empty())
+ {
+ Pool p;
+ LogString msg(LOG4CXX_STR("\""));
+ StringHelper::toString(syslogFacility, p, msg);
+ msg.append(LOG4CXX_STR("\" is an unknown syslog facility. Defaulting to \"USER\"."));
+ LogLog::error(msg);
+ this->syslogFacility = LOG_USER;
+ facilityStr = LOG4CXX_STR("user:");
+ }
+ else
+ {
+ facilityStr += LOG4CXX_STR(":");
+ }
}
/**
@@ -129,222 +129,222 @@
e.g. "kern", "user", etc.
*/
LogString SyslogAppender::getFacilityString(
- int syslogFacility)
+ int syslogFacility)
{
- switch (syslogFacility)
- {
- case LOG_KERN:
- return LOG4CXX_STR("kern");
+ switch (syslogFacility)
+ {
+ case LOG_KERN:
+ return LOG4CXX_STR("kern");
- case LOG_USER:
- return LOG4CXX_STR("user");
+ case LOG_USER:
+ return LOG4CXX_STR("user");
- case LOG_MAIL:
- return LOG4CXX_STR("mail");
+ case LOG_MAIL:
+ return LOG4CXX_STR("mail");
- case LOG_DAEMON:
- return LOG4CXX_STR("daemon");
+ case LOG_DAEMON:
+ return LOG4CXX_STR("daemon");
- case LOG_AUTH:
- return LOG4CXX_STR("auth");
+ case LOG_AUTH:
+ return LOG4CXX_STR("auth");
- case LOG_SYSLOG:
- return LOG4CXX_STR("syslog");
+ case LOG_SYSLOG:
+ return LOG4CXX_STR("syslog");
- case LOG_LPR:
- return LOG4CXX_STR("lpr");
+ case LOG_LPR:
+ return LOG4CXX_STR("lpr");
- case LOG_NEWS:
- return LOG4CXX_STR("news");
+ case LOG_NEWS:
+ return LOG4CXX_STR("news");
- case LOG_UUCP:
- return LOG4CXX_STR("uucp");
+ case LOG_UUCP:
+ return LOG4CXX_STR("uucp");
- case LOG_CRON:
- return LOG4CXX_STR("cron");
+ case LOG_CRON:
+ return LOG4CXX_STR("cron");
#ifdef LOG_AUTHPRIV
- case LOG_AUTHPRIV:
- return LOG4CXX_STR("authpriv");
+ case LOG_AUTHPRIV:
+ return LOG4CXX_STR("authpriv");
#endif
#ifdef LOG_FTP
- case LOG_FTP:
- return LOG4CXX_STR("ftp");
+ case LOG_FTP:
+ return LOG4CXX_STR("ftp");
#endif
- case LOG_LOCAL0:
- return LOG4CXX_STR("local0");
+ case LOG_LOCAL0:
+ return LOG4CXX_STR("local0");
- case LOG_LOCAL1:
- return LOG4CXX_STR("local1");
+ case LOG_LOCAL1:
+ return LOG4CXX_STR("local1");
- case LOG_LOCAL2:
- return LOG4CXX_STR("local2");
+ case LOG_LOCAL2:
+ return LOG4CXX_STR("local2");
- case LOG_LOCAL3:
- return LOG4CXX_STR("local3");
+ case LOG_LOCAL3:
+ return LOG4CXX_STR("local3");
- case LOG_LOCAL4:
- return LOG4CXX_STR("local4");
+ case LOG_LOCAL4:
+ return LOG4CXX_STR("local4");
- case LOG_LOCAL5:
- return LOG4CXX_STR("local5");
+ case LOG_LOCAL5:
+ return LOG4CXX_STR("local5");
- case LOG_LOCAL6:
- return LOG4CXX_STR("local6");
+ case LOG_LOCAL6:
+ return LOG4CXX_STR("local6");
- case LOG_LOCAL7:
- return LOG4CXX_STR("local7");
+ case LOG_LOCAL7:
+ return LOG4CXX_STR("local7");
- default:
- return LogString();
- }
+ default:
+ return LogString();
+ }
}
int SyslogAppender::getFacility(
- const LogString& s)
+ const LogString& s)
{
- if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("KERN"), LOG4CXX_STR("kern")))
- {
- return LOG_KERN;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("USER"), LOG4CXX_STR("user")))
- {
- return LOG_USER;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("MAIL"), LOG4CXX_STR("mail")))
- {
- return LOG_MAIL;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("DAEMON"), LOG4CXX_STR("daemon")))
- {
- return LOG_DAEMON;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTH"), LOG4CXX_STR("auth")))
- {
- return LOG_AUTH;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("SYSLOG"), LOG4CXX_STR("syslog")))
- {
- return LOG_SYSLOG;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LPR"), LOG4CXX_STR("lpr")))
- {
- return LOG_LPR;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("NEWS"), LOG4CXX_STR("news")))
- {
- return LOG_NEWS;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("UUCP"), LOG4CXX_STR("uucp")))
- {
- return LOG_UUCP;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("CRON"), LOG4CXX_STR("cron")))
- {
- return LOG_CRON;
- }
+ if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("KERN"), LOG4CXX_STR("kern")))
+ {
+ return LOG_KERN;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("USER"), LOG4CXX_STR("user")))
+ {
+ return LOG_USER;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("MAIL"), LOG4CXX_STR("mail")))
+ {
+ return LOG_MAIL;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("DAEMON"), LOG4CXX_STR("daemon")))
+ {
+ return LOG_DAEMON;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTH"), LOG4CXX_STR("auth")))
+ {
+ return LOG_AUTH;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("SYSLOG"), LOG4CXX_STR("syslog")))
+ {
+ return LOG_SYSLOG;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LPR"), LOG4CXX_STR("lpr")))
+ {
+ return LOG_LPR;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("NEWS"), LOG4CXX_STR("news")))
+ {
+ return LOG_NEWS;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("UUCP"), LOG4CXX_STR("uucp")))
+ {
+ return LOG_UUCP;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("CRON"), LOG4CXX_STR("cron")))
+ {
+ return LOG_CRON;
+ }
#ifdef LOG_AUTHPRIV
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTHPRIV"), LOG4CXX_STR("authpriv")))
- {
- return LOG_AUTHPRIV;
- }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTHPRIV"), LOG4CXX_STR("authpriv")))
+ {
+ return LOG_AUTHPRIV;
+ }
#endif
#ifdef LOG_FTP
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("FTP"), LOG4CXX_STR("ftp")))
- {
- return LOG_FTP;
- }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("FTP"), LOG4CXX_STR("ftp")))
+ {
+ return LOG_FTP;
+ }
#endif
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL0"), LOG4CXX_STR("local0")))
- {
- return LOG_LOCAL0;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local1")))
- {
- return LOG_LOCAL1;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL2"), LOG4CXX_STR("local2")))
- {
- return LOG_LOCAL2;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL3"), LOG4CXX_STR("local3")))
- {
- return LOG_LOCAL3;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL4"), LOG4CXX_STR("local4")))
- {
- return LOG_LOCAL4;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL5"), LOG4CXX_STR("local5")))
- {
- return LOG_LOCAL5;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL6"), LOG4CXX_STR("local6")))
- {
- return LOG_LOCAL6;
- }
- else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL7"), LOG4CXX_STR("local7")))
- {
- return LOG_LOCAL7;
- }
- else
- {
- return LOG_UNDEF;
- }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL0"), LOG4CXX_STR("local0")))
+ {
+ return LOG_LOCAL0;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local1")))
+ {
+ return LOG_LOCAL1;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL2"), LOG4CXX_STR("local2")))
+ {
+ return LOG_LOCAL2;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL3"), LOG4CXX_STR("local3")))
+ {
+ return LOG_LOCAL3;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL4"), LOG4CXX_STR("local4")))
+ {
+ return LOG_LOCAL4;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL5"), LOG4CXX_STR("local5")))
+ {
+ return LOG_LOCAL5;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL6"), LOG4CXX_STR("local6")))
+ {
+ return LOG_LOCAL6;
+ }
+ else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL7"), LOG4CXX_STR("local7")))
+ {
+ return LOG_LOCAL7;
+ }
+ else
+ {
+ return LOG_UNDEF;
+ }
}
void SyslogAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
- if (!isAsSevereAsThreshold(event->getLevel()))
- {
- return;
- }
+ if (!isAsSevereAsThreshold(event->getLevel()))
+ {
+ return;
+ }
- LogString msg;
- layout->format(msg, event, p);
+ LogString msg;
+ layout->format(msg, event, p);
- // On the local host, we can directly use the system function 'syslog'
- // if it is available
+ // On the local host, we can directly use the system function 'syslog'
+ // if it is available
#if LOG4CXX_HAVE_SYSLOG
- if (sw == 0)
- {
- std::string sbuf;
- Transcoder::encode(msg, sbuf);
+ if (sw == 0)
+ {
+ std::string sbuf;
+ Transcoder::encode(msg, sbuf);
- // use of "%s" to avoid a security hole
- ::syslog(syslogFacility | event->getLevel()->getSyslogEquivalent(),
- "%s", sbuf.c_str());
+ // use of "%s" to avoid a security hole
+ ::syslog(syslogFacility | event->getLevel()->getSyslogEquivalent(),
+ "%s", sbuf.c_str());
- return;
- }
+ return;
+ }
#endif
- // We must not attempt to append if sw is null.
- if (sw == 0)
- {
- errorHandler->error(LOG4CXX_STR("No syslog host is set for SyslogAppedender named \"") +
- this->name + LOG4CXX_STR("\"."));
- return;
- }
+ // We must not attempt to append if sw is null.
+ if (sw == 0)
+ {
+ errorHandler->error(LOG4CXX_STR("No syslog host is set for SyslogAppedender named \"") +
+ this->name + LOG4CXX_STR("\"."));
+ return;
+ }
- LogString sbuf(1, 0x3C /* '<' */);
- StringHelper::toString((syslogFacility | event->getLevel()->getSyslogEquivalent()), p, sbuf);
- sbuf.append(1, (logchar) 0x3E /* '>' */);
+ LogString sbuf(1, 0x3C /* '<' */);
+ StringHelper::toString((syslogFacility | event->getLevel()->getSyslogEquivalent()), p, sbuf);
+ sbuf.append(1, (logchar) 0x3E /* '>' */);
- if (facilityPrinting)
- {
- sbuf.append(facilityStr);
- }
+ if (facilityPrinting)
+ {
+ sbuf.append(facilityStr);
+ }
- sbuf.append(msg);
- sw->write(sbuf);
+ sbuf.append(msg);
+ sw->write(sbuf);
}
void SyslogAppender::activateOptions(Pool&)
@@ -353,78 +353,78 @@
void SyslogAppender::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SYSLOGHOST"), LOG4CXX_STR("sysloghost")))
- {
- setSyslogHost(value);
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FACILITY"), LOG4CXX_STR("facility")))
- {
- setFacility(value);
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SYSLOGHOST"), LOG4CXX_STR("sysloghost")))
+ {
+ setSyslogHost(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FACILITY"), LOG4CXX_STR("facility")))
+ {
+ setFacility(value);
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void SyslogAppender::setSyslogHost(const LogString& syslogHost1)
{
- if (this->sw != 0)
- {
- delete this->sw;
- this->sw = 0;
- }
+ if (this->sw != 0)
+ {
+ delete this->sw;
+ this->sw = 0;
+ }
- LogString slHost = syslogHost1;
- int slHostPort = -1;
+ LogString slHost = syslogHost1;
+ int slHostPort = -1;
- LogString::size_type colonPos = 0;
- colonPos = slHost.rfind(':');
+ LogString::size_type colonPos = 0;
+ colonPos = slHost.rfind(':');
- if (colonPos != LogString::npos)
- {
- slHostPort = StringHelper::toInt(slHost.substr(colonPos + 1));
- // Erase the :port part of the host name
- slHost.erase( colonPos );
- }
+ if (colonPos != LogString::npos)
+ {
+ slHostPort = StringHelper::toInt(slHost.substr(colonPos + 1));
+ // Erase the :port part of the host name
+ slHost.erase( colonPos );
+ }
- // On the local host, we can directly use the system function 'syslog'
- // if it is available (cf. append)
+ // On the local host, we can directly use the system function 'syslog'
+ // if it is available (cf. append)
#if LOG4CXX_HAVE_SYSLOG
- if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 != LOG4CXX_STR("127.0.0.1")
- && !syslogHost1.empty())
+ if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 != LOG4CXX_STR("127.0.0.1")
+ && !syslogHost1.empty())
#endif
- if (slHostPort >= 0)
- {
- this->sw = new SyslogWriter(slHost, slHostPort);
- }
- else
- {
- this->sw = new SyslogWriter(slHost);
- }
+ if (slHostPort >= 0)
+ {
+ this->sw = new SyslogWriter(slHost, slHostPort);
+ }
+ else
+ {
+ this->sw = new SyslogWriter(slHost);
+ }
- this->syslogHost = slHost;
- this->syslogHostPort = slHostPort;
+ this->syslogHost = slHost;
+ this->syslogHostPort = slHostPort;
}
void SyslogAppender::setFacility(const LogString& facilityName)
{
- if (facilityName.empty())
- {
- return;
- }
+ if (facilityName.empty())
+ {
+ return;
+ }
- syslogFacility = getFacility(facilityName);
+ syslogFacility = getFacility(facilityName);
- if (syslogFacility == LOG_UNDEF)
- {
- LogLog::error(LOG4CXX_STR("[") + facilityName +
- LOG4CXX_STR("] is an unknown syslog facility. Defaulting to [USER]."));
- syslogFacility = LOG_USER;
- }
+ if (syslogFacility == LOG_UNDEF)
+ {
+ LogLog::error(LOG4CXX_STR("[") + facilityName +
+ LOG4CXX_STR("] is an unknown syslog facility. Defaulting to [USER]."));
+ syslogFacility = LOG_USER;
+ }
- this->initSyslogFacilityStr();
+ this->initSyslogFacilityStr();
}
diff --git a/src/main/cpp/syslogwriter.cpp b/src/main/cpp/syslogwriter.cpp
index a92d1fb..42c7094 100644
--- a/src/main/cpp/syslogwriter.cpp
+++ b/src/main/cpp/syslogwriter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -30,39 +30,39 @@
using namespace log4cxx::helpers;
SyslogWriter::SyslogWriter(const LogString& syslogHost1, int syslogHostPort1)
- : syslogHost(syslogHost1), syslogHostPort(syslogHostPort1)
+ : syslogHost(syslogHost1), syslogHostPort(syslogHostPort1)
{
- try
- {
- this->address = InetAddress::getByName(syslogHost1);
- }
- catch (UnknownHostException& e)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Could not find ")) + syslogHost1 +
- LOG4CXX_STR(". All logging will FAIL."), e);
- }
+ try
+ {
+ this->address = InetAddress::getByName(syslogHost1);
+ }
+ catch (UnknownHostException& e)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Could not find ")) + syslogHost1 +
+ LOG4CXX_STR(". All logging will FAIL."), e);
+ }
- try
- {
- this->ds = new DatagramSocket();
- }
- catch (SocketException& e)
- {
- LogLog::error(((LogString) LOG4CXX_STR("Could not instantiate DatagramSocket to ")) + syslogHost1 +
- LOG4CXX_STR(". All logging will FAIL."), e);
- }
+ try
+ {
+ this->ds = new DatagramSocket();
+ }
+ catch (SocketException& e)
+ {
+ LogLog::error(((LogString) LOG4CXX_STR("Could not instantiate DatagramSocket to ")) + syslogHost1 +
+ LOG4CXX_STR(". All logging will FAIL."), e);
+ }
}
void SyslogWriter::write(const LogString& source)
{
- if (this->ds != 0 && this->address != 0)
- {
- LOG4CXX_ENCODE_CHAR(data, source);
+ if (this->ds != 0 && this->address != 0)
+ {
+ LOG4CXX_ENCODE_CHAR(data, source);
- DatagramPacketPtr packet(
- new DatagramPacket((void*) data.data(), data.length(),
- address, syslogHostPort));
+ DatagramPacketPtr packet(
+ new DatagramPacket((void*) data.data(), data.length(),
+ address, syslogHostPort));
- ds->send(packet);
- }
+ ds->send(packet);
+ }
}
diff --git a/src/main/cpp/system.cpp b/src/main/cpp/system.cpp
index 6bbe057..67239f5 100644
--- a/src/main/cpp/system.cpp
+++ b/src/main/cpp/system.cpp
@@ -31,92 +31,92 @@
LogString System::getProperty(const LogString& lkey)
{
- if (lkey.empty())
- {
- throw IllegalArgumentException(LOG4CXX_STR("key is empty"));
- }
+ if (lkey.empty())
+ {
+ throw IllegalArgumentException(LOG4CXX_STR("key is empty"));
+ }
- LogString rv;
+ LogString rv;
- if (lkey == LOG4CXX_STR("java.io.tmpdir"))
- {
- Pool p;
- const char* dir = NULL;
- apr_status_t stat = apr_temp_dir_get(&dir, p.getAPRPool());
+ if (lkey == LOG4CXX_STR("java.io.tmpdir"))
+ {
+ Pool p;
+ const char* dir = NULL;
+ apr_status_t stat = apr_temp_dir_get(&dir, p.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- Transcoder::decode(dir, rv);
- }
+ if (stat == APR_SUCCESS)
+ {
+ Transcoder::decode(dir, rv);
+ }
- return rv;
- }
+ return rv;
+ }
- if (lkey == LOG4CXX_STR("user.dir"))
- {
- Pool p;
- char* dir = NULL;
- apr_status_t stat = apr_filepath_get(&dir, APR_FILEPATH_NATIVE,
- p.getAPRPool());
+ if (lkey == LOG4CXX_STR("user.dir"))
+ {
+ Pool p;
+ char* dir = NULL;
+ apr_status_t stat = apr_filepath_get(&dir, APR_FILEPATH_NATIVE,
+ p.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- Transcoder::decode(dir, rv);
- }
+ if (stat == APR_SUCCESS)
+ {
+ Transcoder::decode(dir, rv);
+ }
- return rv;
- }
+ return rv;
+ }
#if APR_HAS_USER
- if (lkey == LOG4CXX_STR("user.home") || lkey == LOG4CXX_STR("user.name"))
- {
- Pool pool;
- apr_uid_t userid;
- apr_gid_t groupid;
- apr_pool_t* p = pool.getAPRPool();
- apr_status_t stat = apr_uid_current(&userid, &groupid, p);
+ if (lkey == LOG4CXX_STR("user.home") || lkey == LOG4CXX_STR("user.name"))
+ {
+ Pool pool;
+ apr_uid_t userid;
+ apr_gid_t groupid;
+ apr_pool_t* p = pool.getAPRPool();
+ apr_status_t stat = apr_uid_current(&userid, &groupid, p);
- if (stat == APR_SUCCESS)
- {
- char* username = NULL;
- stat = apr_uid_name_get(&username, userid, p);
+ if (stat == APR_SUCCESS)
+ {
+ char* username = NULL;
+ stat = apr_uid_name_get(&username, userid, p);
- if (stat == APR_SUCCESS)
- {
- if (lkey == LOG4CXX_STR("user.name"))
- {
- Transcoder::decode(username, rv);
- }
- else
- {
- char* dirname = NULL;
- stat = apr_uid_homepath_get(&dirname, username, p);
+ if (stat == APR_SUCCESS)
+ {
+ if (lkey == LOG4CXX_STR("user.name"))
+ {
+ Transcoder::decode(username, rv);
+ }
+ else
+ {
+ char* dirname = NULL;
+ stat = apr_uid_homepath_get(&dirname, username, p);
- if (stat == APR_SUCCESS)
- {
- Transcoder::decode(dirname, rv);
- }
- }
- }
- }
+ if (stat == APR_SUCCESS)
+ {
+ Transcoder::decode(dirname, rv);
+ }
+ }
+ }
+ }
- return rv;
- }
+ return rv;
+ }
#endif
- LOG4CXX_ENCODE_CHAR(key, lkey);
- Pool p;
- char* value = NULL;
- apr_status_t stat = apr_env_get(&value, key.c_str(),
- p.getAPRPool());
+ LOG4CXX_ENCODE_CHAR(key, lkey);
+ Pool p;
+ char* value = NULL;
+ apr_status_t stat = apr_env_get(&value, key.c_str(),
+ p.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- Transcoder::decode((const char*) value, rv);
- }
+ if (stat == APR_SUCCESS)
+ {
+ Transcoder::decode((const char*) value, rv);
+ }
- return rv;
+ return rv;
}
diff --git a/src/main/cpp/systemerrwriter.cpp b/src/main/cpp/systemerrwriter.cpp
index cce411a..21b8dc2 100644
--- a/src/main/cpp/systemerrwriter.cpp
+++ b/src/main/cpp/systemerrwriter.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <stdio.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -43,22 +43,22 @@
void SystemErrWriter::flush(Pool& /* p */)
{
- flush();
+ flush();
}
void SystemErrWriter::write(const LogString& str, Pool& /* p */)
{
- write(str);
+ write(str);
}
bool SystemErrWriter::isWide()
{
#if LOG4CXX_FORCE_WIDE_CONSOLE
- return true;
+ return true;
#elif LOG4CXX_FORCE_BYTE_CONSOLE || !LOG4CXX_HAS_FWIDE
- return false;
+ return false;
#else
- return fwide(stderr, 0) > 0;
+ return fwide(stderr, 0) > 0;
#endif
}
@@ -66,19 +66,19 @@
{
#if LOG4CXX_WCHAR_T_API
- if (isWide())
- {
- LOG4CXX_ENCODE_WCHAR(msg, str);
- fputws(msg.c_str(), stderr);
- return;
- }
+ if (isWide())
+ {
+ LOG4CXX_ENCODE_WCHAR(msg, str);
+ fputws(msg.c_str(), stderr);
+ return;
+ }
#endif
- LOG4CXX_ENCODE_CHAR(msg, str);
- fputs(msg.c_str(), stderr);
+ LOG4CXX_ENCODE_CHAR(msg, str);
+ fputs(msg.c_str(), stderr);
}
void SystemErrWriter::flush()
{
- fflush(stderr);
+ fflush(stderr);
}
diff --git a/src/main/cpp/systemoutwriter.cpp b/src/main/cpp/systemoutwriter.cpp
index 83e0ae8..eecd6b4 100644
--- a/src/main/cpp/systemoutwriter.cpp
+++ b/src/main/cpp/systemoutwriter.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <stdio.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
@@ -43,22 +43,22 @@
void SystemOutWriter::flush(Pool& /* p */ )
{
- flush();
+ flush();
}
void SystemOutWriter::write(const LogString& str, Pool& /* p */ )
{
- write(str);
+ write(str);
}
bool SystemOutWriter::isWide()
{
#if LOG4CXX_FORCE_WIDE_CONSOLE
- return true;
+ return true;
#elif LOG4CXX_FORCE_BYTE_CONSOLE || !LOG4CXX_HAS_FWIDE
- return false;
+ return false;
#else
- return fwide(stdout, 0) > 0;
+ return fwide(stdout, 0) > 0;
#endif
}
@@ -66,19 +66,19 @@
{
#if LOG4CXX_WCHAR_T_API
- if (isWide())
- {
- LOG4CXX_ENCODE_WCHAR(msg, str);
- fputws(msg.c_str(), stdout);
- return;
- }
+ if (isWide())
+ {
+ LOG4CXX_ENCODE_WCHAR(msg, str);
+ fputws(msg.c_str(), stdout);
+ return;
+ }
#endif
- LOG4CXX_ENCODE_CHAR(msg, str);
- fputs(msg.c_str(), stdout);
+ LOG4CXX_ENCODE_CHAR(msg, str);
+ fputs(msg.c_str(), stdout);
}
void SystemOutWriter::flush()
{
- fflush(stdout);
+ fflush(stdout);
}
diff --git a/src/main/cpp/telnetappender.cpp b/src/main/cpp/telnetappender.cpp
index 81aaaf9..438616c 100644
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@ -41,265 +41,265 @@
const int TelnetAppender::MAX_CONNECTIONS = 20;
TelnetAppender::TelnetAppender()
- : port(DEFAULT_PORT), connections(MAX_CONNECTIONS),
- encoding(LOG4CXX_STR("UTF-8")),
- encoder(CharsetEncoder::getUTF8Encoder()),
- serverSocket(NULL), sh()
+ : port(DEFAULT_PORT), connections(MAX_CONNECTIONS),
+ encoding(LOG4CXX_STR("UTF-8")),
+ encoder(CharsetEncoder::getUTF8Encoder()),
+ serverSocket(NULL), sh()
{
- LOCK_W sync(mutex);
- activeConnections = 0;
+ LOCK_W sync(mutex);
+ activeConnections = 0;
}
TelnetAppender::~TelnetAppender()
{
- finalize();
- delete serverSocket;
+ finalize();
+ delete serverSocket;
}
void TelnetAppender::activateOptions(Pool& /* p */)
{
- if (serverSocket == NULL)
- {
- serverSocket = new ServerSocket(port);
- serverSocket->setSoTimeout(1000);
- }
+ if (serverSocket == NULL)
+ {
+ serverSocket = new ServerSocket(port);
+ serverSocket->setSoTimeout(1000);
+ }
- sh.run(acceptConnections, this);
+ sh.run(acceptConnections, this);
}
void TelnetAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
- {
- setPort(OptionConverter::toInt(value, DEFAULT_PORT));
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("ENCODING"), LOG4CXX_STR("encoding")))
- {
- setEncoding(value);
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PORT"), LOG4CXX_STR("port")))
+ {
+ setPort(OptionConverter::toInt(value, DEFAULT_PORT));
+ }
+ else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("ENCODING"), LOG4CXX_STR("encoding")))
+ {
+ setEncoding(value);
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
LogString TelnetAppender::getEncoding() const
{
- LOCK_W sync(mutex);
- return encoding;
+ LOCK_W sync(mutex);
+ return encoding;
}
void TelnetAppender::setEncoding(const LogString& value)
{
- LOCK_W sync(mutex);
- encoder = CharsetEncoder::getEncoder(value);
- encoding = value;
+ LOCK_W sync(mutex);
+ encoder = CharsetEncoder::getEncoder(value);
+ encoding = value;
}
void TelnetAppender::close()
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (closed)
- {
- return;
- }
+ if (closed)
+ {
+ return;
+ }
- closed = true;
+ closed = true;
- SocketPtr nullSocket;
+ SocketPtr nullSocket;
- for (ConnectionList::iterator iter = connections.begin();
- iter != connections.end();
- iter++)
- {
- if (*iter != 0)
- {
- (*iter)->close();
- *iter = nullSocket;
- }
- }
+ for (ConnectionList::iterator iter = connections.begin();
+ iter != connections.end();
+ iter++)
+ {
+ if (*iter != 0)
+ {
+ (*iter)->close();
+ *iter = nullSocket;
+ }
+ }
- if (serverSocket != NULL)
- {
- try
- {
- serverSocket->close();
- }
- catch (Exception&)
- {
- }
- }
+ if (serverSocket != NULL)
+ {
+ try
+ {
+ serverSocket->close();
+ }
+ catch (Exception&)
+ {
+ }
+ }
- try
- {
- sh.join();
- }
- catch (Exception& ex)
- {
- }
+ try
+ {
+ sh.join();
+ }
+ catch (Exception& ex)
+ {
+ }
- activeConnections = 0;
+ activeConnections = 0;
}
void TelnetAppender::write(ByteBuffer& buf)
{
- for (ConnectionList::iterator iter = connections.begin();
- iter != connections.end();
- iter++)
- {
- if (*iter != 0)
- {
- try
- {
- ByteBuffer b(buf.current(), buf.remaining());
- (*iter)->write(b);
- }
- catch (Exception& ex)
- {
- // The client has closed the connection, remove it from our list:
- *iter = 0;
- activeConnections--;
- }
- }
- }
+ for (ConnectionList::iterator iter = connections.begin();
+ iter != connections.end();
+ iter++)
+ {
+ if (*iter != 0)
+ {
+ try
+ {
+ ByteBuffer b(buf.current(), buf.remaining());
+ (*iter)->write(b);
+ }
+ catch (Exception& ex)
+ {
+ // The client has closed the connection, remove it from our list:
+ *iter = 0;
+ activeConnections--;
+ }
+ }
+ }
}
void TelnetAppender::writeStatus(const SocketPtr& socket, const LogString& msg, Pool& p)
{
- size_t bytesSize = msg.size() * 2;
- char* bytes = p.pstralloc(bytesSize);
+ size_t bytesSize = msg.size() * 2;
+ char* bytes = p.pstralloc(bytesSize);
- LogString::const_iterator msgIter(msg.begin());
- ByteBuffer buf(bytes, bytesSize);
+ LogString::const_iterator msgIter(msg.begin());
+ ByteBuffer buf(bytes, bytesSize);
- while (msgIter != msg.end())
- {
- encoder->encode(msg, msgIter, buf);
- buf.flip();
- socket->write(buf);
- buf.clear();
- }
+ while (msgIter != msg.end())
+ {
+ encoder->encode(msg, msgIter, buf);
+ buf.flip();
+ socket->write(buf);
+ buf.clear();
+ }
}
void TelnetAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
- size_t count = activeConnections;
+ size_t count = activeConnections;
- if (count > 0)
- {
- LogString msg;
- this->layout->format(msg, event, pool);
- msg.append(LOG4CXX_STR("\r\n"));
- size_t bytesSize = msg.size() * 2;
- char* bytes = p.pstralloc(bytesSize);
+ if (count > 0)
+ {
+ LogString msg;
+ this->layout->format(msg, event, pool);
+ msg.append(LOG4CXX_STR("\r\n"));
+ size_t bytesSize = msg.size() * 2;
+ char* bytes = p.pstralloc(bytesSize);
- LogString::const_iterator msgIter(msg.begin());
- ByteBuffer buf(bytes, bytesSize);
+ LogString::const_iterator msgIter(msg.begin());
+ ByteBuffer buf(bytes, bytesSize);
- LOCK_W sync(this->mutex);
+ LOCK_W sync(this->mutex);
- while (msgIter != msg.end())
- {
- log4cxx_status_t stat = encoder->encode(msg, msgIter, buf);
- buf.flip();
- write(buf);
- buf.clear();
+ while (msgIter != msg.end())
+ {
+ log4cxx_status_t stat = encoder->encode(msg, msgIter, buf);
+ buf.flip();
+ write(buf);
+ buf.clear();
- if (CharsetEncoder::isError(stat))
- {
- LogString unrepresented(1, 0x3F /* '?' */);
- LogString::const_iterator unrepresentedIter(unrepresented.begin());
- stat = encoder->encode(unrepresented, unrepresentedIter, buf);
- buf.flip();
- write(buf);
- buf.clear();
- msgIter++;
- }
- }
- }
+ if (CharsetEncoder::isError(stat))
+ {
+ LogString unrepresented(1, 0x3F /* '?' */);
+ LogString::const_iterator unrepresentedIter(unrepresented.begin());
+ stat = encoder->encode(unrepresented, unrepresentedIter, buf);
+ buf.flip();
+ write(buf);
+ buf.clear();
+ msgIter++;
+ }
+ }
+ }
}
void* APR_THREAD_FUNC TelnetAppender::acceptConnections(apr_thread_t* /* thread */, void* data)
{
- TelnetAppender* pThis = (TelnetAppender*) data;
+ TelnetAppender* pThis = (TelnetAppender*) data;
- // main loop; is left when This->closed is != 0 after an accept()
- while (true)
- {
- try
- {
- SocketPtr newClient = pThis->serverSocket->accept();
- bool done = pThis->closed;
+ // main loop; is left when This->closed is != 0 after an accept()
+ while (true)
+ {
+ try
+ {
+ SocketPtr newClient = pThis->serverSocket->accept();
+ bool done = pThis->closed;
- if (done)
- {
- Pool p;
- pThis->writeStatus(newClient, LOG4CXX_STR("Log closed.\r\n"), p);
- newClient->close();
+ if (done)
+ {
+ Pool p;
+ pThis->writeStatus(newClient, LOG4CXX_STR("Log closed.\r\n"), p);
+ newClient->close();
- break;
- }
+ break;
+ }
- size_t count = pThis->activeConnections;
+ size_t count = pThis->activeConnections;
- if (count >= pThis->connections.size())
- {
- Pool p;
- pThis->writeStatus(newClient, LOG4CXX_STR("Too many connections.\r\n"), p);
- newClient->close();
- }
- else
- {
- //
- // find unoccupied connection
- //
- LOCK_W sync(pThis->mutex);
+ if (count >= pThis->connections.size())
+ {
+ Pool p;
+ pThis->writeStatus(newClient, LOG4CXX_STR("Too many connections.\r\n"), p);
+ newClient->close();
+ }
+ else
+ {
+ //
+ // find unoccupied connection
+ //
+ LOCK_W sync(pThis->mutex);
- for (ConnectionList::iterator iter = pThis->connections.begin();
- iter != pThis->connections.end();
- iter++)
- {
- if (*iter == NULL)
- {
- *iter = newClient;
- pThis->activeConnections++;
+ for (ConnectionList::iterator iter = pThis->connections.begin();
+ iter != pThis->connections.end();
+ iter++)
+ {
+ if (*iter == NULL)
+ {
+ *iter = newClient;
+ pThis->activeConnections++;
- break;
- }
- }
+ break;
+ }
+ }
- Pool p;
- LogString oss(LOG4CXX_STR("TelnetAppender v1.0 ("));
- StringHelper::toString((int) count + 1, p, oss);
- oss += LOG4CXX_STR(" active connections)\r\n\r\n");
- pThis->writeStatus(newClient, oss, p);
- }
- }
- catch (InterruptedIOException& e)
- {
- if (pThis->closed)
- {
- break;
- }
- }
- catch (Exception& e)
- {
- if (!pThis->closed)
- {
- LogLog::error(LOG4CXX_STR("Encountered error while in SocketHandler loop."), e);
- }
- else
- {
- break;
- }
- }
- }
+ Pool p;
+ LogString oss(LOG4CXX_STR("TelnetAppender v1.0 ("));
+ StringHelper::toString((int) count + 1, p, oss);
+ oss += LOG4CXX_STR(" active connections)\r\n\r\n");
+ pThis->writeStatus(newClient, oss, p);
+ }
+ }
+ catch (InterruptedIOException& e)
+ {
+ if (pThis->closed)
+ {
+ break;
+ }
+ }
+ catch (Exception& e)
+ {
+ if (!pThis->closed)
+ {
+ LogLog::error(LOG4CXX_STR("Encountered error while in SocketHandler loop."), e);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
#endif
diff --git a/src/main/cpp/threadcxx.cpp b/src/main/cpp/threadcxx.cpp
index 9977135..8d17776 100644
--- a/src/main/cpp/threadcxx.cpp
+++ b/src/main/cpp/threadcxx.cpp
@@ -38,60 +38,60 @@
*/
class LaunchPackage
{
- public:
- /**
- * Placement new to create LaunchPackage in specified pool.
- * LaunchPackage needs to be dynamically allocated since
- * since a stack allocated instance may go out of scope
- * before thread is launched.
- */
- static void* operator new (size_t sz, Pool& p)
- {
- return p.palloc(sz);
- }
- /**
- * operator delete would be called if exception during construction.
- */
- static void operator delete (void*, Pool& p)
- {
- }
- /**
- * Create new instance.
- */
- LaunchPackage(Thread* t, Runnable r, void* d) : thread(t), runnable(r), data(d)
- {
- }
- /**
- * Gets thread parameter.
- * @return thread.
- */
- Thread* getThread() const
- {
- return thread;
- }
+ public:
+ /**
+ * Placement new to create LaunchPackage in specified pool.
+ * LaunchPackage needs to be dynamically allocated since
+ * since a stack allocated instance may go out of scope
+ * before thread is launched.
+ */
+ static void* operator new (size_t sz, Pool& p)
+ {
+ return p.palloc(sz);
+ }
+ /**
+ * operator delete would be called if exception during construction.
+ */
+ static void operator delete (void*, Pool& p)
+ {
+ }
+ /**
+ * Create new instance.
+ */
+ LaunchPackage(Thread* t, Runnable r, void* d) : thread(t), runnable(r), data(d)
+ {
+ }
+ /**
+ * Gets thread parameter.
+ * @return thread.
+ */
+ Thread* getThread() const
+ {
+ return thread;
+ }
- /**
- * Gets runnable parameter.
- * @return runnable.
- */
- Runnable getRunnable() const
- {
- return runnable;
- }
- /**
- * gets data parameter.
- * @return thread.
- */
- void* getData() const
- {
- return data;
- }
- private:
- LaunchPackage(const LaunchPackage&);
- LaunchPackage& operator=(const LaunchPackage&);
- Thread* thread;
- Runnable runnable;
- void* data;
+ /**
+ * Gets runnable parameter.
+ * @return runnable.
+ */
+ Runnable getRunnable() const
+ {
+ return runnable;
+ }
+ /**
+ * gets data parameter.
+ * @return thread.
+ */
+ void* getData() const
+ {
+ return data;
+ }
+ private:
+ LaunchPackage(const LaunchPackage&);
+ LaunchPackage& operator=(const LaunchPackage&);
+ Thread* thread;
+ Runnable runnable;
+ void* data;
};
/**
@@ -101,27 +101,27 @@
*/
class LaunchStatus
{
- public:
- /*
- * Construct new instance.
- * @param p address of memory to set to non-zero on construction, zero on destruction.
- */
- LaunchStatus(volatile unsigned int* p) : alive(p)
- {
- apr_atomic_set32(alive, 0xFFFFFFFF);
- }
- /**
- * Destructor.
- */
- ~LaunchStatus()
- {
- apr_atomic_set32(alive, 0);
- }
+ public:
+ /*
+ * Construct new instance.
+ * @param p address of memory to set to non-zero on construction, zero on destruction.
+ */
+ LaunchStatus(volatile unsigned int* p) : alive(p)
+ {
+ apr_atomic_set32(alive, 0xFFFFFFFF);
+ }
+ /**
+ * Destructor.
+ */
+ ~LaunchStatus()
+ {
+ apr_atomic_set32(alive, 0);
+ }
- private:
- LaunchStatus(const LaunchStatus&);
- LaunchStatus& operator=(const LaunchStatus&);
- volatile unsigned int* alive;
+ private:
+ LaunchStatus(const LaunchStatus&);
+ LaunchStatus& operator=(const LaunchStatus&);
+ volatile unsigned int* alive;
};
/**
@@ -130,34 +130,34 @@
*/
ThreadLocal& getThreadLocal()
{
- static ThreadLocal tls;
- return tls;
+ static ThreadLocal tls;
+ return tls;
}
}
void* LOG4CXX_THREAD_FUNC ThreadLaunch::launcher(apr_thread_t* thread, void* data)
{
- LaunchPackage* package = (LaunchPackage*) data;
- ThreadLocal& tls = getThreadLocal();
- tls.set(package->getThread());
- {
- (package->getRunnable())(thread, package->getData());
- package->getThread()->ending();
- }
- apr_thread_exit(thread, 0); // this function never returns !
- return 0;
+ LaunchPackage* package = (LaunchPackage*) data;
+ ThreadLocal& tls = getThreadLocal();
+ tls.set(package->getThread());
+ {
+ (package->getRunnable())(thread, package->getData());
+ package->getThread()->ending();
+ }
+ apr_thread_exit(thread, 0); // this function never returns !
+ return 0;
}
#endif
Thread::Thread() : thread(NULL), alive(0), interruptedStatus(0),
- interruptedMutex(NULL), interruptedCondition(NULL)
+ interruptedMutex(NULL), interruptedCondition(NULL)
{
}
Thread::~Thread()
{
- join();
+ join();
}
@@ -166,60 +166,60 @@
{
#if APR_HAS_THREADS
- // Try to join first if previous instance did exit
- if ( isActive() && !isAlive() )
- {
- join();
- }
+ // Try to join first if previous instance did exit
+ if ( isActive() && !isAlive() )
+ {
+ join();
+ }
- // now we're ready to create the thread again
- //
- // if attempting a second run method on the same Thread object
- // throw an exception
- //
- if (thread != NULL)
- {
- throw IllegalStateException();
- }
+ // now we're ready to create the thread again
+ //
+ // if attempting a second run method on the same Thread object
+ // throw an exception
+ //
+ if (thread != NULL)
+ {
+ throw IllegalStateException();
+ }
- apr_threadattr_t* attrs;
- apr_status_t stat = apr_threadattr_create(&attrs, p.getAPRPool());
+ apr_threadattr_t* attrs;
+ apr_status_t stat = apr_threadattr_create(&attrs, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
- stat = apr_thread_cond_create(&interruptedCondition, p.getAPRPool());
+ stat = apr_thread_cond_create(&interruptedCondition, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
- stat = apr_thread_mutex_create(&interruptedMutex, APR_THREAD_MUTEX_NESTED,
- p.getAPRPool());
+ stat = apr_thread_mutex_create(&interruptedMutex, APR_THREAD_MUTEX_NESTED,
+ p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
- // create LaunchPackage on the thread's memory pool
- LaunchPackage* package = new (p) LaunchPackage(this, start, data);
- stat = apr_thread_create(&thread, attrs,
- ThreadLaunch::launcher, package, p.getAPRPool());
+ // create LaunchPackage on the thread's memory pool
+ LaunchPackage* package = new (p) LaunchPackage(this, start, data);
+ stat = apr_thread_create(&thread, attrs,
+ ThreadLaunch::launcher, package, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
- // we need to set alive here already, since we use isAlive() to check
- // if run() has been called in a thread-safe way.
- apr_atomic_set32(&alive, 0xFFFFFFFF);
+ // we need to set alive here already, since we use isAlive() to check
+ // if run() has been called in a thread-safe way.
+ apr_atomic_set32(&alive, 0xFFFFFFFF);
#else
- throw ThreadException(LOG4CXX_STR("APR_HAS_THREADS is not true"));
+ throw ThreadException(LOG4CXX_STR("APR_HAS_THREADS is not true"));
#endif
}
@@ -227,17 +227,17 @@
{
#if APR_HAS_THREADS
- if (thread != NULL)
- {
- apr_status_t startStat;
- apr_status_t stat = apr_thread_join(&startStat, thread);
- thread = NULL;
+ if (thread != NULL)
+ {
+ apr_status_t startStat;
+ apr_status_t stat = apr_thread_join(&startStat, thread);
+ thread = NULL;
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
+ }
#endif
}
@@ -245,31 +245,31 @@
void Thread::currentThreadInterrupt()
{
#if APR_HAS_THREADS
- void* tls = getThreadLocal().get();
+ void* tls = getThreadLocal().get();
- if (tls != 0)
- {
- ((Thread*) tls)->interrupt();
- }
+ if (tls != 0)
+ {
+ ((Thread*) tls)->interrupt();
+ }
#endif
}
void Thread::interrupt()
{
- apr_atomic_set32(&interruptedStatus, 0xFFFFFFFF);
+ apr_atomic_set32(&interruptedStatus, 0xFFFFFFFF);
#if APR_HAS_THREADS
- if (interruptedMutex != NULL)
- {
- synchronized sync(interruptedMutex);
- apr_status_t stat = apr_thread_cond_signal(interruptedCondition);
+ if (interruptedMutex != NULL)
+ {
+ synchronized sync(interruptedMutex);
+ apr_status_t stat = apr_thread_cond_signal(interruptedCondition);
- if (stat != APR_SUCCESS)
- {
- throw ThreadException(stat);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw ThreadException(stat);
+ }
+ }
#endif
}
@@ -277,35 +277,35 @@
bool Thread::interrupted()
{
#if APR_HAS_THREADS
- void* tls = getThreadLocal().get();
+ void* tls = getThreadLocal().get();
- if (tls != 0)
- {
- return apr_atomic_xchg32(&(((Thread*) tls)->interruptedStatus), 0) != 0;
- }
+ if (tls != 0)
+ {
+ return apr_atomic_xchg32(&(((Thread*) tls)->interruptedStatus), 0) != 0;
+ }
#endif
- return false;
+ return false;
}
bool Thread::isCurrentThread() const
{
#if APR_HAS_THREADS
- const void* tls = getThreadLocal().get();
- return (tls == this);
+ const void* tls = getThreadLocal().get();
+ return (tls == this);
#else
- return true;
+ return true;
#endif
}
bool Thread::isAlive()
{
- return apr_atomic_read32(&alive) != 0;
+ return apr_atomic_read32(&alive) != 0;
}
void Thread::ending()
{
- apr_atomic_set32(&alive, 0);
+ apr_atomic_set32(&alive, 0);
}
@@ -313,43 +313,43 @@
{
#if APR_HAS_THREADS
- if (interrupted())
- {
- throw InterruptedException();
- }
+ if (interrupted())
+ {
+ throw InterruptedException();
+ }
- if (duration > 0)
- {
- Thread* pThis = (Thread*) getThreadLocal().get();
+ if (duration > 0)
+ {
+ Thread* pThis = (Thread*) getThreadLocal().get();
- if (pThis == NULL)
- {
- apr_sleep(duration * 1000);
- }
- else
- {
- synchronized sync(pThis->interruptedMutex);
- apr_status_t stat = apr_thread_cond_timedwait(pThis->interruptedCondition,
- pThis->interruptedMutex, duration * 1000);
+ if (pThis == NULL)
+ {
+ apr_sleep(duration * 1000);
+ }
+ else
+ {
+ synchronized sync(pThis->interruptedMutex);
+ apr_status_t stat = apr_thread_cond_timedwait(pThis->interruptedCondition,
+ pThis->interruptedMutex, duration * 1000);
- if (stat != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(stat))
- {
- throw ThreadException(stat);
- }
+ if (stat != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(stat))
+ {
+ throw ThreadException(stat);
+ }
- if (interrupted())
- {
- throw InterruptedException();
- }
- }
- }
+ if (interrupted())
+ {
+ throw InterruptedException();
+ }
+ }
+ }
#else
- if (duration > 0)
- {
- apr_sleep(duration * 1000);
- }
+ if (duration > 0)
+ {
+ apr_sleep(duration * 1000);
+ }
#endif
}
diff --git a/src/main/cpp/threadlocal.cpp b/src/main/cpp/threadlocal.cpp
index 87ae0d8..e17234a 100644
--- a/src/main/cpp/threadlocal.cpp
+++ b/src/main/cpp/threadlocal.cpp
@@ -24,17 +24,17 @@
apr_threadkey_t* ThreadLocal::create(Pool& p)
{
- apr_threadkey_t* key = 0;
+ apr_threadkey_t* key = 0;
#if APR_HAS_THREADS
- apr_status_t stat = apr_threadkey_private_create(&key, 0, p.getAPRPool());
+ apr_status_t stat = apr_threadkey_private_create(&key, 0, p.getAPRPool());
- if (stat != APR_SUCCESS)
- {
- throw RuntimeException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw RuntimeException(stat);
+ }
#endif
- return key;
+ return key;
}
ThreadLocal::ThreadLocal() : p(), key(create(p))
@@ -48,27 +48,27 @@
void ThreadLocal::set(void* priv)
{
#if APR_HAS_THREADS
- apr_status_t stat = apr_threadkey_private_set(priv, key);
+ apr_status_t stat = apr_threadkey_private_set(priv, key);
- if (stat != APR_SUCCESS)
- {
- throw RuntimeException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw RuntimeException(stat);
+ }
#endif
}
void* ThreadLocal::get()
{
- void* retval = 0;
+ void* retval = 0;
#if APR_HAS_THREADS
- apr_status_t stat = apr_threadkey_private_get(&retval, key);
+ apr_status_t stat = apr_threadkey_private_get(&retval, key);
- if (stat != APR_SUCCESS)
- {
- throw RuntimeException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw RuntimeException(stat);
+ }
#endif
- return retval;
+ return retval;
}
diff --git a/src/main/cpp/threadpatternconverter.cpp b/src/main/cpp/threadpatternconverter.cpp
index 085f924..47323dd 100644
--- a/src/main/cpp/threadpatternconverter.cpp
+++ b/src/main/cpp/threadpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -31,23 +31,23 @@
IMPLEMENT_LOG4CXX_OBJECT(ThreadPatternConverter)
ThreadPatternConverter::ThreadPatternConverter() :
- LoggingEventPatternConverter(LOG4CXX_STR("Thread"),
- LOG4CXX_STR("Thread"))
+ LoggingEventPatternConverter(LOG4CXX_STR("Thread"),
+ LOG4CXX_STR("Thread"))
{
}
PatternConverterPtr ThreadPatternConverter::newInstance(
- const std::vector<LogString>& /* options */)
+ const std::vector<LogString>& /* options */)
{
- static PatternConverterPtr def(new ThreadPatternConverter());
- return def;
+ static PatternConverterPtr def(new ThreadPatternConverter());
+ return def;
}
void ThreadPatternConverter::format(
- const LoggingEventPtr& event,
- LogString& toAppendTo,
- Pool& /* p */) const
+ const LoggingEventPtr& event,
+ LogString& toAppendTo,
+ Pool& /* p */) const
{
- toAppendTo.append(event->getThreadName());
+ toAppendTo.append(event->getThreadName());
}
diff --git a/src/main/cpp/threadspecificdata.cpp b/src/main/cpp/threadspecificdata.cpp
index b165509..04b4c41 100644
--- a/src/main/cpp/threadspecificdata.cpp
+++ b/src/main/cpp/threadspecificdata.cpp
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/exception.h>
#include <apr_thread_proc.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/helpers/aprinitializer.h>
@@ -29,7 +29,7 @@
ThreadSpecificData::ThreadSpecificData()
- : ndcStack(), mdcMap()
+ : ndcStack(), mdcMap()
{
}
@@ -40,28 +40,28 @@
log4cxx::NDC::Stack& ThreadSpecificData::getStack()
{
- return ndcStack;
+ return ndcStack;
}
log4cxx::MDC::Map& ThreadSpecificData::getMap()
{
- return mdcMap;
+ return mdcMap;
}
ThreadSpecificData& ThreadSpecificData::getDataNoThreads()
{
- static ThreadSpecificData noThreadData;
- return noThreadData;
+ static ThreadSpecificData noThreadData;
+ return noThreadData;
}
ThreadSpecificData* ThreadSpecificData::getCurrentData()
{
#if APR_HAS_THREADS
- void* pData = NULL;
- apr_threadkey_private_get(&pData, APRInitializer::getTlsKey());
- return (ThreadSpecificData*) pData;
+ void* pData = NULL;
+ apr_threadkey_private_get(&pData, APRInitializer::getTlsKey());
+ return (ThreadSpecificData*) pData;
#else
- return &getDataNoThreads();
+ return &getDataNoThreads();
#endif
}
@@ -69,38 +69,38 @@
{
#if APR_HAS_THREADS
- if (ndcStack.empty() && mdcMap.empty())
- {
- void* pData = NULL;
- apr_status_t stat = apr_threadkey_private_get(&pData, APRInitializer::getTlsKey());
+ if (ndcStack.empty() && mdcMap.empty())
+ {
+ void* pData = NULL;
+ apr_status_t stat = apr_threadkey_private_get(&pData, APRInitializer::getTlsKey());
- if (stat == APR_SUCCESS && pData == this)
- {
- stat = apr_threadkey_private_set(0, APRInitializer::getTlsKey());
+ if (stat == APR_SUCCESS && pData == this)
+ {
+ stat = apr_threadkey_private_set(0, APRInitializer::getTlsKey());
- if (stat == APR_SUCCESS)
- {
- delete this;
- }
- }
- }
+ if (stat == APR_SUCCESS)
+ {
+ delete this;
+ }
+ }
+ }
#endif
}
void ThreadSpecificData::put(const LogString& key, const LogString& val)
{
- ThreadSpecificData* data = getCurrentData();
+ ThreadSpecificData* data = getCurrentData();
- if (data == 0)
- {
- data = createCurrentData();
- }
+ if (data == 0)
+ {
+ data = createCurrentData();
+ }
- if (data != 0)
- {
- data->getMap()[key] = val;
- }
+ if (data != 0)
+ {
+ data->getMap()[key] = val;
+ }
}
@@ -108,44 +108,44 @@
void ThreadSpecificData::push(const LogString& val)
{
- ThreadSpecificData* data = getCurrentData();
+ ThreadSpecificData* data = getCurrentData();
- if (data == 0)
- {
- data = createCurrentData();
- }
+ if (data == 0)
+ {
+ data = createCurrentData();
+ }
- if (data != 0)
- {
- NDC::Stack& stack = data->getStack();
+ if (data != 0)
+ {
+ NDC::Stack& stack = data->getStack();
- if (stack.empty())
- {
- stack.push(NDC::DiagnosticContext(val, val));
- }
- else
- {
- LogString fullMessage(stack.top().second);
- fullMessage.append(1, (logchar) 0x20);
- fullMessage.append(val);
- stack.push(NDC::DiagnosticContext(val, fullMessage));
- }
- }
+ if (stack.empty())
+ {
+ stack.push(NDC::DiagnosticContext(val, val));
+ }
+ else
+ {
+ LogString fullMessage(stack.top().second);
+ fullMessage.append(1, (logchar) 0x20);
+ fullMessage.append(val);
+ stack.push(NDC::DiagnosticContext(val, fullMessage));
+ }
+ }
}
void ThreadSpecificData::inherit(const NDC::Stack& src)
{
- ThreadSpecificData* data = getCurrentData();
+ ThreadSpecificData* data = getCurrentData();
- if (data == 0)
- {
- data = createCurrentData();
- }
+ if (data == 0)
+ {
+ data = createCurrentData();
+ }
- if (data != 0)
- {
- data->getStack() = src;
- }
+ if (data != 0)
+ {
+ data->getStack() = src;
+ }
}
@@ -153,17 +153,17 @@
ThreadSpecificData* ThreadSpecificData::createCurrentData()
{
#if APR_HAS_THREADS
- ThreadSpecificData* newData = new ThreadSpecificData();
- apr_status_t stat = apr_threadkey_private_set(newData, APRInitializer::getTlsKey());
+ ThreadSpecificData* newData = new ThreadSpecificData();
+ apr_status_t stat = apr_threadkey_private_set(newData, APRInitializer::getTlsKey());
- if (stat != APR_SUCCESS)
- {
- delete newData;
- newData = NULL;
- }
+ if (stat != APR_SUCCESS)
+ {
+ delete newData;
+ newData = NULL;
+ }
- return newData;
+ return newData;
#else
- return 0;
+ return 0;
#endif
}
diff --git a/src/main/cpp/throwableinformationpatternconverter.cpp b/src/main/cpp/throwableinformationpatternconverter.cpp
index 81a1cc2..5f1f68f 100644
--- a/src/main/cpp/throwableinformationpatternconverter.cpp
+++ b/src/main/cpp/throwableinformationpatternconverter.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -34,29 +34,29 @@
IMPLEMENT_LOG4CXX_OBJECT(ThrowableInformationPatternConverter)
ThrowableInformationPatternConverter::ThrowableInformationPatternConverter(bool shortReport1) :
- LoggingEventPatternConverter(LOG4CXX_STR("Throwable"),
- LOG4CXX_STR("throwable")),
- shortReport(shortReport1)
+ LoggingEventPatternConverter(LOG4CXX_STR("Throwable"),
+ LOG4CXX_STR("throwable")),
+ shortReport(shortReport1)
{
}
PatternConverterPtr ThrowableInformationPatternConverter::newInstance(
- const std::vector<LogString>& options)
+ const std::vector<LogString>& options)
{
- if (options.size() > 0 && options[0].compare(LOG4CXX_STR("short")) == 0)
- {
- static PatternConverterPtr shortConverter(new ThrowableInformationPatternConverter(true));
- return shortConverter;
- }
+ if (options.size() > 0 && options[0].compare(LOG4CXX_STR("short")) == 0)
+ {
+ static PatternConverterPtr shortConverter(new ThrowableInformationPatternConverter(true));
+ return shortConverter;
+ }
- static PatternConverterPtr converter(new ThrowableInformationPatternConverter(false));
- return converter;
+ static PatternConverterPtr converter(new ThrowableInformationPatternConverter(false));
+ return converter;
}
void ThrowableInformationPatternConverter::format(
- const LoggingEventPtr& /* event */,
- LogString& /* toAppendTo */,
- Pool& /* p */) const
+ const LoggingEventPtr& /* event */,
+ LogString& /* toAppendTo */,
+ Pool& /* p */) const
{
}
@@ -66,5 +66,5 @@
*/
bool ThrowableInformationPatternConverter::handlesThrowable() const
{
- return true;
+ return true;
}
diff --git a/src/main/cpp/timebasedrollingpolicy.cpp b/src/main/cpp/timebasedrollingpolicy.cpp
index 1fe8a20..2c29b6c 100644
--- a/src/main/cpp/timebasedrollingpolicy.cpp
+++ b/src/main/cpp/timebasedrollingpolicy.cpp
@@ -15,11 +15,11 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#ifdef LOG4CXX_MULTI_PROCESS
- #include <libgen.h>
+ #include <libgen.h>
#endif
#include <log4cxx/logstring.h>
@@ -35,7 +35,7 @@
#include<iostream>
#ifndef INT64_C
- #define INT64_C(x) x ## LL
+ #define INT64_C(x) x ## LL
#endif
#include <apr_time.h>
@@ -54,121 +54,121 @@
bool TimeBasedRollingPolicy::isMapFileEmpty(log4cxx::helpers::Pool& pool)
{
- apr_finfo_t finfo;
- apr_status_t st = apr_stat(&finfo, _mapFileName.c_str(), APR_FINFO_SIZE, pool.getAPRPool());
+ apr_finfo_t finfo;
+ apr_status_t st = apr_stat(&finfo, _mapFileName.c_str(), APR_FINFO_SIZE, pool.getAPRPool());
- if (st != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_stat failed."));
- }
+ if (st != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_stat failed."));
+ }
- if (st == APR_SUCCESS && !finfo.size)
- {
- return true;
- }
+ if (st == APR_SUCCESS && !finfo.size)
+ {
+ return true;
+ }
- return false;
+ return false;
}
void TimeBasedRollingPolicy::initMMapFile(const LogString& lastFileName, log4cxx::helpers::Pool& pool)
{
- int iRet = 0;
+ int iRet = 0;
- if (!_mmap)
- {
- iRet = createMMapFile(std::string(_fileNamePattern), pool);
- }
+ if (!_mmap)
+ {
+ iRet = createMMapFile(std::string(_fileNamePattern), pool);
+ }
- if (!iRet && isMapFileEmpty(pool))
- {
- lockMMapFile(APR_FLOCK_EXCLUSIVE);
- memset(_mmap->mm, 0, MAX_FILE_LEN);
- memcpy(_mmap->mm, std::string(lastFileName).c_str(), std::string(lastFileName).size());
- unLockMMapFile();
- }
+ if (!iRet && isMapFileEmpty(pool))
+ {
+ lockMMapFile(APR_FLOCK_EXCLUSIVE);
+ memset(_mmap->mm, 0, MAX_FILE_LEN);
+ memcpy(_mmap->mm, std::string(lastFileName).c_str(), std::string(lastFileName).size());
+ unLockMMapFile();
+ }
}
const std::string TimeBasedRollingPolicy::createFile(const std::string& fileName, const std::string& suffix, log4cxx::helpers::Pool& pool)
{
- char szUid[MAX_FILE_LEN] = {'\0'};
- char szBaseName[MAX_FILE_LEN] = {'\0'};
- char szDirName[MAX_FILE_LEN] = {'\0'};
- memcpy(szDirName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
- memcpy(szBaseName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
+ char szUid[MAX_FILE_LEN] = {'\0'};
+ char szBaseName[MAX_FILE_LEN] = {'\0'};
+ char szDirName[MAX_FILE_LEN] = {'\0'};
+ memcpy(szDirName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
+ memcpy(szBaseName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size());
- apr_uid_t uid;
- apr_gid_t groupid;
- apr_status_t stat = apr_uid_current(&uid, &groupid, pool.getAPRPool());
+ apr_uid_t uid;
+ apr_gid_t groupid;
+ apr_status_t stat = apr_uid_current(&uid, &groupid, pool.getAPRPool());
- if (stat == APR_SUCCESS)
- {
- snprintf(szUid, MAX_FILE_LEN, "%u", uid);
- }
+ if (stat == APR_SUCCESS)
+ {
+ snprintf(szUid, MAX_FILE_LEN, "%u", uid);
+ }
- return std::string(::dirname(szDirName)) + "/." + ::basename(szBaseName) + szUid + suffix;
+ return std::string(::dirname(szDirName)) + "/." + ::basename(szBaseName) + szUid + suffix;
}
int TimeBasedRollingPolicy::createMMapFile(const std::string& fileName, log4cxx::helpers::Pool& pool)
{
- _mapFileName = createFile(fileName, MMAP_FILE_SUFFIX, pool);
+ _mapFileName = createFile(fileName, MMAP_FILE_SUFFIX, pool);
- apr_status_t stat = apr_file_open(&_file_map, _mapFileName.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, _mmapPool->getAPRPool());
+ apr_status_t stat = apr_file_open(&_file_map, _mapFileName.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, _mmapPool->getAPRPool());
- if (stat != APR_SUCCESS)
- {
- std::string err(std::string("open mmap file failed. ") + std::string(strerror(errno)) + ". Check the privilege or try to remove " + _mapFileName + " if exist.");
- LogLog::warn(LOG4CXX_STR(err.c_str()));
- return -1;
- }
+ if (stat != APR_SUCCESS)
+ {
+ std::string err(std::string("open mmap file failed. ") + std::string(strerror(errno)) + ". Check the privilege or try to remove " + _mapFileName + " if exist.");
+ LogLog::warn(LOG4CXX_STR(err.c_str()));
+ return -1;
+ }
- if (isMapFileEmpty(pool))
- {
- stat = apr_file_trunc(_file_map, MAX_FILE_LEN + 1);
+ if (isMapFileEmpty(pool))
+ {
+ stat = apr_file_trunc(_file_map, MAX_FILE_LEN + 1);
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_file_trunc failed."));
- apr_file_close(_file_map);
- return -1;
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_file_trunc failed."));
+ apr_file_close(_file_map);
+ return -1;
+ }
+ }
- stat = apr_mmap_create(&_mmap, _file_map, 0, MAX_FILE_LEN, APR_MMAP_WRITE | APR_MMAP_READ, _mmapPool->getAPRPool());
+ stat = apr_mmap_create(&_mmap, _file_map, 0, MAX_FILE_LEN, APR_MMAP_WRITE | APR_MMAP_READ, _mmapPool->getAPRPool());
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("mmap failed."));
- apr_file_close(_file_map);
- return -1;
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("mmap failed."));
+ apr_file_close(_file_map);
+ return -1;
+ }
- return 0;
+ return 0;
}
int TimeBasedRollingPolicy::lockMMapFile(int type)
{
- apr_status_t stat = apr_file_lock(_lock_file, type);
+ apr_status_t stat = apr_file_lock(_lock_file, type);
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_file_lock for mmap failed."));
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_file_lock for mmap failed."));
+ }
}
int TimeBasedRollingPolicy::unLockMMapFile()
{
- apr_status_t stat = apr_file_unlock(_lock_file);
+ apr_status_t stat = apr_file_unlock(_lock_file);
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("apr_file_unlock for mmap failed."));
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("apr_file_unlock for mmap failed."));
+ }
}
#endif
TimeBasedRollingPolicy::TimeBasedRollingPolicy()
#ifdef LOG4CXX_MULTI_PROCESS
- : _mmap(NULL), _file_map(NULL), bAlreadyInitialized(false), _mmapPool(new Pool()), _lock_file(NULL), bRefreshCurFile(false)
+ : _mmap(NULL), _file_map(NULL), bAlreadyInitialized(false), _mmapPool(new Pool()), _lock_file(NULL), bRefreshCurFile(false)
#endif
{
}
@@ -176,253 +176,253 @@
#ifdef LOG4CXX_MULTI_PROCESS
TimeBasedRollingPolicy::~TimeBasedRollingPolicy()
{
- //no-need to delete mmap
- delete _mmapPool;
+ //no-need to delete mmap
+ delete _mmapPool;
}
#endif
void TimeBasedRollingPolicy::addRef() const
{
- TriggeringPolicy::addRef();
+ TriggeringPolicy::addRef();
}
void TimeBasedRollingPolicy::releaseRef() const
{
- TriggeringPolicy::releaseRef();
+ TriggeringPolicy::releaseRef();
}
void TimeBasedRollingPolicy::activateOptions(log4cxx::helpers::Pool& pool)
{
- // find out period from the filename pattern
- if (getFileNamePattern().length() > 0)
- {
- parseFileNamePattern();
- }
- else
- {
- LogLog::warn(
- LOG4CXX_STR("The FileNamePattern option must be set before using TimeBasedRollingPolicy. "));
- throw IllegalStateException();
- }
+ // find out period from the filename pattern
+ if (getFileNamePattern().length() > 0)
+ {
+ parseFileNamePattern();
+ }
+ else
+ {
+ LogLog::warn(
+ LOG4CXX_STR("The FileNamePattern option must be set before using TimeBasedRollingPolicy. "));
+ throw IllegalStateException();
+ }
- PatternConverterPtr dtc(getDatePatternConverter());
+ PatternConverterPtr dtc(getDatePatternConverter());
- if (dtc == NULL)
- {
- throw IllegalStateException();
- }
+ if (dtc == NULL)
+ {
+ throw IllegalStateException();
+ }
- apr_time_t n = apr_time_now();
- LogString buf;
- ObjectPtr obj(new Date(n));
- formatFileName(obj, buf, pool);
- lastFileName = buf;
+ apr_time_t n = apr_time_now();
+ LogString buf;
+ ObjectPtr obj(new Date(n));
+ formatFileName(obj, buf, pool);
+ lastFileName = buf;
#ifdef LOG4CXX_MULTI_PROCESS
- if (getPatternConverterList().size())
- {
- (*(getPatternConverterList().begin()))->format(obj, _fileNamePattern, pool);
- }
- else
- {
- _fileNamePattern = lastFileName;
- }
+ if (getPatternConverterList().size())
+ {
+ (*(getPatternConverterList().begin()))->format(obj, _fileNamePattern, pool);
+ }
+ else
+ {
+ _fileNamePattern = lastFileName;
+ }
- if (!_lock_file)
- {
- const std::string lockname = createFile(std::string(_fileNamePattern), LOCK_FILE_SUFFIX, *_mmapPool);
- apr_status_t stat = apr_file_open(&_lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, (*_mmapPool).getAPRPool());
+ if (!_lock_file)
+ {
+ const std::string lockname = createFile(std::string(_fileNamePattern), LOCK_FILE_SUFFIX, *_mmapPool);
+ apr_status_t stat = apr_file_open(&_lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, (*_mmapPool).getAPRPool());
- if (stat != APR_SUCCESS)
- {
- LogLog::warn(LOG4CXX_STR("open lock file failed."));
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ LogLog::warn(LOG4CXX_STR("open lock file failed."));
+ }
+ }
- initMMapFile(lastFileName, *_mmapPool);
+ initMMapFile(lastFileName, *_mmapPool);
#endif
- suffixLength = 0;
+ suffixLength = 0;
- if (lastFileName.length() >= 3)
- {
- if (lastFileName.compare(lastFileName.length() - 3, 3, LOG4CXX_STR(".gz")) == 0)
- {
- suffixLength = 3;
- }
- else if (lastFileName.length() >= 4 && lastFileName.compare(lastFileName.length() - 4, 4, LOG4CXX_STR(".zip")) == 0)
- {
- suffixLength = 4;
- }
- }
+ if (lastFileName.length() >= 3)
+ {
+ if (lastFileName.compare(lastFileName.length() - 3, 3, LOG4CXX_STR(".gz")) == 0)
+ {
+ suffixLength = 3;
+ }
+ else if (lastFileName.length() >= 4 && lastFileName.compare(lastFileName.length() - 4, 4, LOG4CXX_STR(".zip")) == 0)
+ {
+ suffixLength = 4;
+ }
+ }
}
#define RULES_PUT(spec, cls) \
- specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
+ specs.insert(PatternMap::value_type(LogString(LOG4CXX_STR(spec)), (PatternConstructor) cls ::newInstance))
log4cxx::pattern::PatternMap TimeBasedRollingPolicy::getFormatSpecifiers() const
{
- PatternMap specs;
- RULES_PUT("d", FileDatePatternConverter);
- RULES_PUT("date", FileDatePatternConverter);
- return specs;
+ PatternMap specs;
+ RULES_PUT("d", FileDatePatternConverter);
+ RULES_PUT("date", FileDatePatternConverter);
+ return specs;
}
/**
* {@inheritDoc}
*/
RolloverDescriptionPtr TimeBasedRollingPolicy::initialize(
- const LogString& currentActiveFile,
- const bool append,
- Pool& pool)
+ const LogString& currentActiveFile,
+ const bool append,
+ Pool& pool)
{
- apr_time_t n = apr_time_now();
- nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
+ apr_time_t n = apr_time_now();
+ nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
- File currentFile(currentActiveFile);
+ File currentFile(currentActiveFile);
- LogString buf;
- ObjectPtr obj(new Date(currentFile.exists(pool) ? currentFile.lastModified(pool) : n));
- formatFileName(obj, buf, pool);
- lastFileName = buf;
+ LogString buf;
+ ObjectPtr obj(new Date(currentFile.exists(pool) ? currentFile.lastModified(pool) : n));
+ formatFileName(obj, buf, pool);
+ lastFileName = buf;
- ActionPtr noAction;
+ ActionPtr noAction;
- if (currentActiveFile.length() > 0)
- {
- return new RolloverDescription(
- currentActiveFile, append, noAction, noAction);
- }
- else
- {
- bRefreshCurFile = true;
- return new RolloverDescription(
- lastFileName.substr(0, lastFileName.length() - suffixLength), append,
- noAction, noAction);
- }
+ if (currentActiveFile.length() > 0)
+ {
+ return new RolloverDescription(
+ currentActiveFile, append, noAction, noAction);
+ }
+ else
+ {
+ bRefreshCurFile = true;
+ return new RolloverDescription(
+ lastFileName.substr(0, lastFileName.length() - suffixLength), append,
+ noAction, noAction);
+ }
}
RolloverDescriptionPtr TimeBasedRollingPolicy::rollover(
- const LogString& currentActiveFile,
- const bool append,
- Pool& pool)
+ const LogString& currentActiveFile,
+ const bool append,
+ Pool& pool)
{
- apr_time_t n = apr_time_now();
- nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
+ apr_time_t n = apr_time_now();
+ nextCheck = ((n / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC;
- LogString buf;
- ObjectPtr obj(new Date(n));
- formatFileName(obj, buf, pool);
+ LogString buf;
+ ObjectPtr obj(new Date(n));
+ formatFileName(obj, buf, pool);
- LogString newFileName(buf);
+ LogString newFileName(buf);
#ifdef LOG4CXX_MULTI_PROCESS
- bAlreadyInitialized = true;
+ bAlreadyInitialized = true;
- if (_mmap && !isMapFileEmpty(*_mmapPool))
- {
- lockMMapFile(APR_FLOCK_SHARED);
- LogString mapLastFile((char*)_mmap->mm);
- lastFileName = mapLastFile;
- unLockMMapFile();
- }
- else
- {
- _mmap = NULL;
- initMMapFile(lastFileName, *_mmapPool);
- }
+ if (_mmap && !isMapFileEmpty(*_mmapPool))
+ {
+ lockMMapFile(APR_FLOCK_SHARED);
+ LogString mapLastFile((char*)_mmap->mm);
+ lastFileName = mapLastFile;
+ unLockMMapFile();
+ }
+ else
+ {
+ _mmap = NULL;
+ initMMapFile(lastFileName, *_mmapPool);
+ }
#endif
- //
- // if file names haven't changed, no rollover
- //
- if (newFileName == lastFileName)
- {
- RolloverDescriptionPtr desc;
- return desc;
- }
+ //
+ // if file names haven't changed, no rollover
+ //
+ if (newFileName == lastFileName)
+ {
+ RolloverDescriptionPtr desc;
+ return desc;
+ }
- ActionPtr renameAction;
- ActionPtr compressAction;
- LogString lastBaseName(
- lastFileName.substr(0, lastFileName.length() - suffixLength));
- LogString nextActiveFile(
- newFileName.substr(0, newFileName.length() - suffixLength));
+ ActionPtr renameAction;
+ ActionPtr compressAction;
+ LogString lastBaseName(
+ lastFileName.substr(0, lastFileName.length() - suffixLength));
+ LogString nextActiveFile(
+ newFileName.substr(0, newFileName.length() - suffixLength));
- //
- // if currentActiveFile is not lastBaseName then
- // active file name is not following file pattern
- // and requires a rename plus maintaining the same name
- if (currentActiveFile != lastBaseName)
- {
- renameAction =
- new FileRenameAction(
- File().setPath(currentActiveFile), File().setPath(lastBaseName), true);
- nextActiveFile = currentActiveFile;
- }
+ //
+ // if currentActiveFile is not lastBaseName then
+ // active file name is not following file pattern
+ // and requires a rename plus maintaining the same name
+ if (currentActiveFile != lastBaseName)
+ {
+ renameAction =
+ new FileRenameAction(
+ File().setPath(currentActiveFile), File().setPath(lastBaseName), true);
+ nextActiveFile = currentActiveFile;
+ }
- if (suffixLength == 3)
- {
- compressAction =
- new GZCompressAction(
- File().setPath(lastBaseName), File().setPath(lastFileName), true);
- }
+ if (suffixLength == 3)
+ {
+ compressAction =
+ new GZCompressAction(
+ File().setPath(lastBaseName), File().setPath(lastFileName), true);
+ }
- if (suffixLength == 4)
- {
- compressAction =
- new ZipCompressAction(
- File().setPath(lastBaseName), File().setPath(lastFileName), true);
- }
+ if (suffixLength == 4)
+ {
+ compressAction =
+ new ZipCompressAction(
+ File().setPath(lastBaseName), File().setPath(lastFileName), true);
+ }
#ifdef LOG4CXX_MULTI_PROCESS
- if (_mmap && !isMapFileEmpty(*_mmapPool))
- {
- lockMMapFile(APR_FLOCK_EXCLUSIVE);
- memset(_mmap->mm, 0, MAX_FILE_LEN);
- memcpy(_mmap->mm, std::string(newFileName).c_str(), std::string(newFileName).size());
- unLockMMapFile();
- }
- else
- {
- _mmap = NULL;
- initMMapFile(newFileName, *_mmapPool);
- }
+ if (_mmap && !isMapFileEmpty(*_mmapPool))
+ {
+ lockMMapFile(APR_FLOCK_EXCLUSIVE);
+ memset(_mmap->mm, 0, MAX_FILE_LEN);
+ memcpy(_mmap->mm, std::string(newFileName).c_str(), std::string(newFileName).size());
+ unLockMMapFile();
+ }
+ else
+ {
+ _mmap = NULL;
+ initMMapFile(newFileName, *_mmapPool);
+ }
#else
- lastFileName = newFileName;
+ lastFileName = newFileName;
#endif
- return new RolloverDescription(nextActiveFile, append, renameAction, compressAction);
+ return new RolloverDescription(nextActiveFile, append, renameAction, compressAction);
}
bool TimeBasedRollingPolicy::isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& /* event */,
- const LogString& filename,
- size_t /* fileLength */)
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& /* event */,
+ const LogString& filename,
+ size_t /* fileLength */)
{
#ifdef LOG4CXX_MULTI_PROCESS
- if (bRefreshCurFile && _mmap && !isMapFileEmpty(*_mmapPool))
- {
- lockMMapFile(APR_FLOCK_SHARED);
- LogString mapCurrent((char*)_mmap->mm);
- unLockMMapFile();
- LogString mapCurrentBase(mapCurrent.substr(0, mapCurrent.length() - suffixLength));
+ if (bRefreshCurFile && _mmap && !isMapFileEmpty(*_mmapPool))
+ {
+ lockMMapFile(APR_FLOCK_SHARED);
+ LogString mapCurrent((char*)_mmap->mm);
+ unLockMMapFile();
+ LogString mapCurrentBase(mapCurrent.substr(0, mapCurrent.length() - suffixLength));
- if (!mapCurrentBase.empty() && mapCurrentBase != filename)
- {
- dynamic_cast<FileAppender*>(appender)->setFile(mapCurrentBase);
- }
- }
+ if (!mapCurrentBase.empty() && mapCurrentBase != filename)
+ {
+ dynamic_cast<FileAppender*>(appender)->setFile(mapCurrentBase);
+ }
+ }
- return ((apr_time_now()) > nextCheck) || (!bAlreadyInitialized);
+ return ((apr_time_now()) > nextCheck) || (!bAlreadyInitialized);
#else
- return apr_time_now() > nextCheck;
+ return apr_time_now() > nextCheck;
#endif
}
diff --git a/src/main/cpp/timezone.cpp b/src/main/cpp/timezone.cpp
index 822bbbe..4809944 100644
--- a/src/main/cpp/timezone.cpp
+++ b/src/main/cpp/timezone.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
#if defined(_MSC_VER)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -46,39 +46,39 @@
/** Time zone object that represents GMT. */
class GMTTimeZone : public TimeZone
{
- public:
- /** Class factory. */
- static const TimeZonePtr& getInstance()
- {
- static TimeZonePtr tz( new GMTTimeZone() );
- return tz;
- }
+ public:
+ /** Class factory. */
+ static const TimeZonePtr& getInstance()
+ {
+ static TimeZonePtr tz( new GMTTimeZone() );
+ return tz;
+ }
- /** Explode time to human readable form. */
- log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
- {
- apr_status_t stat;
+ /** Explode time to human readable form. */
+ log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
+ {
+ apr_status_t stat;
- // APR 1.1 and early mishandles microseconds on dates
- // before 1970, APR bug 32520
- if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
- {
- apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
- stat = apr_time_exp_gmt(result, floorTime);
- result->tm_usec = (int) (input - floorTime);
- }
- else
- {
- stat = apr_time_exp_gmt( result, input );
- }
+ // APR 1.1 and early mishandles microseconds on dates
+ // before 1970, APR bug 32520
+ if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
+ {
+ apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
+ stat = apr_time_exp_gmt(result, floorTime);
+ result->tm_usec = (int) (input - floorTime);
+ }
+ else
+ {
+ stat = apr_time_exp_gmt( result, input );
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- GMTTimeZone() : TimeZone( LOG4CXX_STR("GMT") )
- {
- }
+ private:
+ GMTTimeZone() : TimeZone( LOG4CXX_STR("GMT") )
+ {
+ }
};
@@ -86,60 +86,60 @@
/** Time zone object that represents GMT. */
class LocalTimeZone : public TimeZone
{
- public:
- /** Class factory. */
- static const TimeZonePtr& getInstance()
- {
- static TimeZonePtr tz( new LocalTimeZone() );
- return tz;
- }
+ public:
+ /** Class factory. */
+ static const TimeZonePtr& getInstance()
+ {
+ static TimeZonePtr tz( new LocalTimeZone() );
+ return tz;
+ }
- /** Explode time to human readable form. */
- log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
- {
- apr_status_t stat;
+ /** Explode time to human readable form. */
+ log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
+ {
+ apr_status_t stat;
- // APR 1.1 and early mishandles microseconds on dates
- // before 1970, APR bug 32520
- if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
- {
- apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
- stat = apr_time_exp_lt(result, floorTime);
- result->tm_usec = (int) (input - floorTime);
- }
- else
- {
- stat = apr_time_exp_lt( result, input );
- }
+ // APR 1.1 and early mishandles microseconds on dates
+ // before 1970, APR bug 32520
+ if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
+ {
+ apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
+ stat = apr_time_exp_lt(result, floorTime);
+ result->tm_usec = (int) (input - floorTime);
+ }
+ else
+ {
+ stat = apr_time_exp_lt( result, input );
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- LocalTimeZone() : TimeZone( getTimeZoneName() )
- {
- }
+ private:
+ LocalTimeZone() : TimeZone( getTimeZoneName() )
+ {
+ }
- static const LogString getTimeZoneName()
- {
- const int MAX_TZ_LENGTH = 255;
- char tzName[MAX_TZ_LENGTH];
- apr_size_t tzLength;
- apr_time_exp_t tm;
- apr_time_exp_lt(&tm, 0);
- apr_strftime(tzName, &tzLength, MAX_TZ_LENGTH, "%Z", &tm);
+ static const LogString getTimeZoneName()
+ {
+ const int MAX_TZ_LENGTH = 255;
+ char tzName[MAX_TZ_LENGTH];
+ apr_size_t tzLength;
+ apr_time_exp_t tm;
+ apr_time_exp_lt(&tm, 0);
+ apr_strftime(tzName, &tzLength, MAX_TZ_LENGTH, "%Z", &tm);
- if (tzLength == 0)
- {
- apr_strftime(tzName, &tzLength, MAX_TZ_LENGTH, "%z", &tm);
- }
+ if (tzLength == 0)
+ {
+ apr_strftime(tzName, &tzLength, MAX_TZ_LENGTH, "%z", &tm);
+ }
- tzName[tzLength] = 0;
- LogString retval;
- log4cxx::helpers::Transcoder::decode(tzName, retval);
- return retval;
- }
+ tzName[tzLength] = 0;
+ LogString retval;
+ log4cxx::helpers::Transcoder::decode(tzName, retval);
+ return retval;
+ }
};
@@ -148,35 +148,35 @@
/** Time zone object that represents a fixed offset from GMT. */
class FixedTimeZone : public TimeZone
{
- public:
- FixedTimeZone( const LogString& name, apr_int32_t offset1 ) : TimeZone( name ), offset( offset1 )
- {
- }
+ public:
+ FixedTimeZone( const LogString& name, apr_int32_t offset1 ) : TimeZone( name ), offset( offset1 )
+ {
+ }
- /** Explode time to human readable form. */
- log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
- {
- apr_status_t stat;
+ /** Explode time to human readable form. */
+ log4cxx_status_t explode( apr_time_exp_t* result, log4cxx_time_t input ) const
+ {
+ apr_status_t stat;
- // APR 1.1 and early mishandles microseconds on dates
- // before 1970, APR bug 32520
- if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
- {
- apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
- stat = apr_time_exp_tz(result, floorTime, offset);
- result->tm_usec = (int) (input - floorTime);
- }
- else
- {
- stat = apr_time_exp_tz( result, input, offset );
- }
+ // APR 1.1 and early mishandles microseconds on dates
+ // before 1970, APR bug 32520
+ if (LOG4CXX_UNLIKELY(input < 0 && apr_time_usec(input) < 0))
+ {
+ apr_time_t floorTime = (apr_time_sec(input) - 1) * APR_USEC_PER_SEC;
+ stat = apr_time_exp_tz(result, floorTime, offset);
+ result->tm_usec = (int) (input - floorTime);
+ }
+ else
+ {
+ stat = apr_time_exp_tz( result, input, offset );
+ }
- return stat;
- }
+ return stat;
+ }
- private:
- const apr_int32_t offset;
+ private:
+ const apr_int32_t offset;
};
}
@@ -195,97 +195,97 @@
const TimeZonePtr& TimeZone::getDefault()
{
- return log4cxx::helpers::TimeZoneImpl::LocalTimeZone::getInstance();
+ return log4cxx::helpers::TimeZoneImpl::LocalTimeZone::getInstance();
}
const TimeZonePtr& TimeZone::getGMT()
{
- return log4cxx::helpers::TimeZoneImpl::GMTTimeZone::getInstance();
+ return log4cxx::helpers::TimeZoneImpl::GMTTimeZone::getInstance();
}
const TimeZonePtr TimeZone::getTimeZone( const LogString& id )
{
- const logchar gmt[] = { 0x47, 0x4D, 0x54, 0 };
+ const logchar gmt[] = { 0x47, 0x4D, 0x54, 0 };
- if ( id == gmt )
- {
- return log4cxx::helpers::TimeZoneImpl::GMTTimeZone::getInstance();
- }
+ if ( id == gmt )
+ {
+ return log4cxx::helpers::TimeZoneImpl::GMTTimeZone::getInstance();
+ }
- if ( id.length() >= 5 && id.substr( 0, 3 ) == gmt )
- {
- int hours = 0;
- int minutes = 0;
- int sign = 1;
+ if ( id.length() >= 5 && id.substr( 0, 3 ) == gmt )
+ {
+ int hours = 0;
+ int minutes = 0;
+ int sign = 1;
- if (id[3] == 0x2D /* '-' */)
- {
- sign = -1;
- }
+ if (id[3] == 0x2D /* '-' */)
+ {
+ sign = -1;
+ }
- LogString off( id.substr( 4 ) );
+ LogString off( id.substr( 4 ) );
- if ( id.length() >= 7 )
- {
- size_t colonPos = off.find( 0x3A /* ':' */);
+ if ( id.length() >= 7 )
+ {
+ size_t colonPos = off.find( 0x3A /* ':' */);
- if ( colonPos == LogString::npos )
- {
- minutes = StringHelper::toInt(off.substr(off.length() - 2));
- hours = StringHelper::toInt(off.substr(0, off.length() - 2));
- }
- else
- {
- minutes = StringHelper::toInt(off.substr(colonPos + 1));
- hours = StringHelper::toInt(off.substr(0, colonPos));
- }
- }
- else
- {
- hours = StringHelper::toInt(off);
- }
+ if ( colonPos == LogString::npos )
+ {
+ minutes = StringHelper::toInt(off.substr(off.length() - 2));
+ hours = StringHelper::toInt(off.substr(0, off.length() - 2));
+ }
+ else
+ {
+ minutes = StringHelper::toInt(off.substr(colonPos + 1));
+ hours = StringHelper::toInt(off.substr(0, colonPos));
+ }
+ }
+ else
+ {
+ hours = StringHelper::toInt(off);
+ }
- LogString s(gmt);
- Pool p;
- LogString hh;
- StringHelper::toString(hours, p, hh);
+ LogString s(gmt);
+ Pool p;
+ LogString hh;
+ StringHelper::toString(hours, p, hh);
- if (sign > 0)
- {
- s.append(1, (logchar) 0x2B /* '+' */);
- }
- else
- {
- s.append(1, (logchar) 0x2D /* '-' */);
- }
+ if (sign > 0)
+ {
+ s.append(1, (logchar) 0x2B /* '+' */);
+ }
+ else
+ {
+ s.append(1, (logchar) 0x2D /* '-' */);
+ }
- if (hh.length() == 1)
- {
- s.append(1, (logchar) 0x30 /* '0' */);
- }
+ if (hh.length() == 1)
+ {
+ s.append(1, (logchar) 0x30 /* '0' */);
+ }
- s.append(hh);
- s.append(1, (logchar) 0x3A /*' :' */);
- LogString mm;
- StringHelper::toString(minutes, p, mm);
+ s.append(hh);
+ s.append(1, (logchar) 0x3A /*' :' */);
+ LogString mm;
+ StringHelper::toString(minutes, p, mm);
- if (mm.length() == 1)
- {
- s.append(1, (logchar) 0x30 /* '0' */);
- }
+ if (mm.length() == 1)
+ {
+ s.append(1, (logchar) 0x30 /* '0' */);
+ }
- s.append(mm);
- apr_int32_t offset = sign * (hours * 3600 + minutes * 60);
- return new log4cxx::helpers::TimeZoneImpl::FixedTimeZone( s, offset );
- }
+ s.append(mm);
+ apr_int32_t offset = sign * (hours * 3600 + minutes * 60);
+ return new log4cxx::helpers::TimeZoneImpl::FixedTimeZone( s, offset );
+ }
- const TimeZonePtr& ltz = getDefault();
+ const TimeZonePtr& ltz = getDefault();
- if ( ltz->getID() == id )
- {
- return ltz;
- }
+ if ( ltz->getID() == id )
+ {
+ return ltz;
+ }
- return getGMT();
+ return getGMT();
}
diff --git a/src/main/cpp/transcoder.cpp b/src/main/cpp/transcoder.cpp
index ac58d3f..d423fb4 100644
--- a/src/main/cpp/transcoder.cpp
+++ b/src/main/cpp/transcoder.cpp
@@ -27,12 +27,12 @@
#include <apr.h>
#include <apr_strings.h>
#if !defined(LOG4CXX)
- #define LOG4CXX 1
+ #define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#if LOG4CXX_LOGCHAR_IS_UNICHAR || LOG4CXX_CFSTRING_API || LOG4CXX_UNICHAR_API
- #include <CoreFoundation/CFString.h>
+ #include <CoreFoundation/CFString.h>
#endif
using namespace log4cxx;
@@ -41,45 +41,45 @@
void Transcoder::decodeUTF8(const std::string& src, LogString& dst)
{
- std::string::const_iterator iter = src.begin();
+ std::string::const_iterator iter = src.begin();
- while (iter != src.end())
- {
- unsigned int sv = decode(src, iter);
+ while (iter != src.end())
+ {
+ unsigned int sv = decode(src, iter);
- if (sv != 0xFFFF)
- {
- encode(sv, dst);
- }
- else
- {
- dst.append(1, LOSSCHAR);
- iter++;
- }
- }
+ if (sv != 0xFFFF)
+ {
+ encode(sv, dst);
+ }
+ else
+ {
+ dst.append(1, LOSSCHAR);
+ iter++;
+ }
+ }
}
void Transcoder::encodeUTF8(const LogString& src, std::string& dst)
{
#if LOG4CXX_LOGCHAR_IS_UTF8
- dst.append(src);
+ dst.append(src);
#else
- LogString::const_iterator iter = src.begin();
+ LogString::const_iterator iter = src.begin();
- while (iter != src.end())
- {
- unsigned int sv = decode(src, iter);
+ while (iter != src.end())
+ {
+ unsigned int sv = decode(src, iter);
- if (sv != 0xFFFF)
- {
- encode(sv, dst);
- }
- else
- {
- dst.append(1, LOSSCHAR);
- iter++;
- }
- }
+ if (sv != 0xFFFF)
+ {
+ encode(sv, dst);
+ }
+ else
+ {
+ dst.append(1, LOSSCHAR);
+ iter++;
+ }
+ }
#endif
}
@@ -87,266 +87,266 @@
char* Transcoder::encodeUTF8(const LogString& src, Pool& p)
{
#if LOG4CXX_LOGCHAR_IS_UTF8
- return p.pstrdup(src);
+ return p.pstrdup(src);
#else
- std::string tmp;
- encodeUTF8(src, tmp);
- return p.pstrdup(tmp);
+ std::string tmp;
+ encodeUTF8(src, tmp);
+ return p.pstrdup(tmp);
#endif
}
void Transcoder::encodeUTF8(unsigned int sv, ByteBuffer& dst)
{
- size_t bytes = encodeUTF8(sv, dst.current());
- dst.position(dst.position() + bytes);
+ size_t bytes = encodeUTF8(sv, dst.current());
+ dst.position(dst.position() + bytes);
}
size_t Transcoder::encodeUTF8(unsigned int ch, char* dst)
{
- if (ch < 0x80)
- {
- dst[0] = (char) ch;
- return 1;
- }
- else if (ch < 0x800)
- {
- dst[0] = (char) (0xC0 + (ch >> 6));
- dst[1] = (char) (0x80 + (ch & 0x3F));
- return 2;
- }
- else if (ch < 0x10000)
- {
- dst[0] = (char) (0xE0 + (ch >> 12));
- dst[1] = (char) (0x80 + ((ch >> 6) & 0x3F));
- dst[2] = (char) (0x80 + (ch & 0x3F));
- return 3;
- }
- else if (ch <= 0x10FFFF)
- {
- dst[0] = (char) (0xF0 + (ch >> 18));
- dst[1] = (char) (0x80 + ((ch >> 12) & 0x3F));
- dst[2] = (char) (0x80 + ((ch >> 6) & 0x3F));
- dst[3] = (char) (0x80 + (ch & 0x3F));
- return 4;
- }
- else
- {
- //
- // output UTF-8 encoding of 0xFFFF
- //
- dst[0] = (char) 0xEF;
- dst[1] = (char) 0xBF;
- dst[2] = (char) 0xBF;
- return 3;
- }
+ if (ch < 0x80)
+ {
+ dst[0] = (char) ch;
+ return 1;
+ }
+ else if (ch < 0x800)
+ {
+ dst[0] = (char) (0xC0 + (ch >> 6));
+ dst[1] = (char) (0x80 + (ch & 0x3F));
+ return 2;
+ }
+ else if (ch < 0x10000)
+ {
+ dst[0] = (char) (0xE0 + (ch >> 12));
+ dst[1] = (char) (0x80 + ((ch >> 6) & 0x3F));
+ dst[2] = (char) (0x80 + (ch & 0x3F));
+ return 3;
+ }
+ else if (ch <= 0x10FFFF)
+ {
+ dst[0] = (char) (0xF0 + (ch >> 18));
+ dst[1] = (char) (0x80 + ((ch >> 12) & 0x3F));
+ dst[2] = (char) (0x80 + ((ch >> 6) & 0x3F));
+ dst[3] = (char) (0x80 + (ch & 0x3F));
+ return 4;
+ }
+ else
+ {
+ //
+ // output UTF-8 encoding of 0xFFFF
+ //
+ dst[0] = (char) 0xEF;
+ dst[1] = (char) 0xBF;
+ dst[2] = (char) 0xBF;
+ return 3;
+ }
}
void Transcoder::encodeUTF16BE(unsigned int sv, ByteBuffer& dst)
{
- size_t bytes = encodeUTF16BE(sv, dst.current());
- dst.position(dst.position() + bytes);
+ size_t bytes = encodeUTF16BE(sv, dst.current());
+ dst.position(dst.position() + bytes);
}
size_t Transcoder::encodeUTF16BE(unsigned int ch, char* dst)
{
- if (ch <= 0xFFFF)
- {
- dst[0] = (char) (ch >> 8);
- dst[1] = (char) (ch & 0xFF);
- return 2;
- }
+ if (ch <= 0xFFFF)
+ {
+ dst[0] = (char) (ch >> 8);
+ dst[1] = (char) (ch & 0xFF);
+ return 2;
+ }
- if (ch <= 0x10FFFF)
- {
- unsigned char w = (unsigned char) ((ch >> 16) - 1);
- dst[0] = (char) (0xD8 + (w >> 2));
- dst[1] = (char) (((w & 0x03) << 6) + ((ch >> 10) & 0x3F));
- dst[2] = (char) (0xDC + ((ch & 0x30) >> 4));
- dst[3] = (char) (ch & 0xFF);
- return 4;
- }
+ if (ch <= 0x10FFFF)
+ {
+ unsigned char w = (unsigned char) ((ch >> 16) - 1);
+ dst[0] = (char) (0xD8 + (w >> 2));
+ dst[1] = (char) (((w & 0x03) << 6) + ((ch >> 10) & 0x3F));
+ dst[2] = (char) (0xDC + ((ch & 0x30) >> 4));
+ dst[3] = (char) (ch & 0xFF);
+ return 4;
+ }
- dst[0] = dst[1] = (char) 0xFF;
- return 2;
+ dst[0] = dst[1] = (char) 0xFF;
+ return 2;
}
void Transcoder::encodeUTF16LE(unsigned int sv, ByteBuffer& dst)
{
- size_t bytes = encodeUTF16LE(sv, dst.current());
- dst.position(dst.position() + bytes);
+ size_t bytes = encodeUTF16LE(sv, dst.current());
+ dst.position(dst.position() + bytes);
}
size_t Transcoder::encodeUTF16LE(unsigned int ch, char* dst)
{
- if (ch <= 0xFFFF)
- {
- dst[1] = (char) (ch >> 8);
- dst[0] = (char) (ch & 0xFF);
- return 2;
- }
+ if (ch <= 0xFFFF)
+ {
+ dst[1] = (char) (ch >> 8);
+ dst[0] = (char) (ch & 0xFF);
+ return 2;
+ }
- if (ch <= 0x10FFFF)
- {
- unsigned char w = (unsigned char) ((ch >> 16) - 1);
- dst[1] = (char) (0xD8 + (w >> 2));
- dst[0] = (char) (((w & 0x03) << 6) + ((ch >> 10) & 0x3F));
- dst[3] = (char) (0xDC + ((ch & 0x30) >> 4));
- dst[2] = (char) (ch & 0xFF);
- return 4;
- }
+ if (ch <= 0x10FFFF)
+ {
+ unsigned char w = (unsigned char) ((ch >> 16) - 1);
+ dst[1] = (char) (0xD8 + (w >> 2));
+ dst[0] = (char) (((w & 0x03) << 6) + ((ch >> 10) & 0x3F));
+ dst[3] = (char) (0xDC + ((ch & 0x30) >> 4));
+ dst[2] = (char) (ch & 0xFF);
+ return 4;
+ }
- dst[0] = dst[1] = (char) 0xFF;
- return 2;
+ dst[0] = dst[1] = (char) 0xFF;
+ return 2;
}
unsigned int Transcoder::decode(const std::string& src,
- std::string::const_iterator& iter)
+ std::string::const_iterator& iter)
{
- std::string::const_iterator start(iter);
- unsigned char ch1 = *(iter++);
+ std::string::const_iterator start(iter);
+ unsigned char ch1 = *(iter++);
- if (ch1 <= 0x7F)
- {
- return ch1;
- }
+ if (ch1 <= 0x7F)
+ {
+ return ch1;
+ }
- //
- // should not have continuation character here
- //
- if ((ch1 & 0xC0) != 0x80 && iter != src.end())
- {
- unsigned char ch2 = *(iter++);
+ //
+ // should not have continuation character here
+ //
+ if ((ch1 & 0xC0) != 0x80 && iter != src.end())
+ {
+ unsigned char ch2 = *(iter++);
- //
- // should be continuation
- if ((ch2 & 0xC0) != 0x80)
- {
- iter = start;
- return 0xFFFF;
- }
+ //
+ // should be continuation
+ if ((ch2 & 0xC0) != 0x80)
+ {
+ iter = start;
+ return 0xFFFF;
+ }
- if ((ch1 & 0xE0) == 0xC0)
- {
- if ((ch2 & 0xC0) == 0x80)
- {
- unsigned int rv = ((ch1 & 0x1F) << 6) + (ch2 & 0x3F);
+ if ((ch1 & 0xE0) == 0xC0)
+ {
+ if ((ch2 & 0xC0) == 0x80)
+ {
+ unsigned int rv = ((ch1 & 0x1F) << 6) + (ch2 & 0x3F);
- if (rv >= 0x80)
- {
- return rv;
- }
- }
+ if (rv >= 0x80)
+ {
+ return rv;
+ }
+ }
- iter = start;
- return 0xFFFF;
- }
+ iter = start;
+ return 0xFFFF;
+ }
- if (iter != src.end())
- {
- unsigned char ch3 = *(iter++);
+ if (iter != src.end())
+ {
+ unsigned char ch3 = *(iter++);
- //
- // should be continuation
- //
- if ((ch3 & 0xC0) != 0x80)
- {
- iter = start;
- return 0xFFFF;
- }
+ //
+ // should be continuation
+ //
+ if ((ch3 & 0xC0) != 0x80)
+ {
+ iter = start;
+ return 0xFFFF;
+ }
- if ((ch1 & 0xF0) == 0xE0)
- {
- unsigned rv = ((ch1 & 0x0F) << 12)
- + ((ch2 & 0x3F) << 6)
- + (ch3 & 0x3F);
+ if ((ch1 & 0xF0) == 0xE0)
+ {
+ unsigned rv = ((ch1 & 0x0F) << 12)
+ + ((ch2 & 0x3F) << 6)
+ + (ch3 & 0x3F);
- if (rv <= 0x800)
- {
- iter = start;
- return 0xFFFF;
- }
+ if (rv <= 0x800)
+ {
+ iter = start;
+ return 0xFFFF;
+ }
- return rv;
- }
+ return rv;
+ }
- if (iter != src.end())
- {
- unsigned char ch4 = *(iter++);
+ if (iter != src.end())
+ {
+ unsigned char ch4 = *(iter++);
- if ((ch4 & 0xC0) != 0x80)
- {
- iter = start;
- return 0xFFFF;
- }
+ if ((ch4 & 0xC0) != 0x80)
+ {
+ iter = start;
+ return 0xFFFF;
+ }
- unsigned int rv = ((ch1 & 0x07) << 18)
- + ((ch2 & 0x3F) << 12)
- + ((ch3 & 0x3F) << 6)
- + (ch4 & 0x3F);
+ unsigned int rv = ((ch1 & 0x07) << 18)
+ + ((ch2 & 0x3F) << 12)
+ + ((ch3 & 0x3F) << 6)
+ + (ch4 & 0x3F);
- if (rv > 0xFFFF)
- {
- return rv;
- }
+ if (rv > 0xFFFF)
+ {
+ return rv;
+ }
- }
- }
- }
+ }
+ }
+ }
- iter = start;
- return 0xFFFF;
+ iter = start;
+ return 0xFFFF;
}
void Transcoder::encode(unsigned int sv, std::string& dst)
{
- char tmp[8];
- size_t bytes = encodeUTF8(sv, tmp);
- dst.append(tmp, bytes);
+ char tmp[8];
+ size_t bytes = encodeUTF8(sv, tmp);
+ dst.append(tmp, bytes);
}
void Transcoder::decode(const std::string& src, LogString& dst)
{
#if LOG4CXX_CHARSET_UTF8 && LOG4CXX_LOGCHAR_IS_UTF8
- dst.append(src);
+ dst.append(src);
#else
- static CharsetDecoderPtr decoder(CharsetDecoder::getDefaultDecoder());
- dst.reserve(dst.size() + src.size());
- std::string::const_iterator iter = src.begin();
+ static CharsetDecoderPtr decoder(CharsetDecoder::getDefaultDecoder());
+ dst.reserve(dst.size() + src.size());
+ std::string::const_iterator iter = src.begin();
#if !LOG4CXX_CHARSET_EBCDIC
- for (;
- iter != src.end() && ((unsigned char) *iter) < 0x80;
- iter++)
- {
- dst.append(1, *iter);
- }
+ for (;
+ iter != src.end() && ((unsigned char) *iter) < 0x80;
+ iter++)
+ {
+ dst.append(1, *iter);
+ }
#endif
- if (iter != src.end())
- {
- size_t offset = iter - src.begin();
- ByteBuffer buf(const_cast<char*>(src.data() + offset), src.size() - offset);
+ if (iter != src.end())
+ {
+ size_t offset = iter - src.begin();
+ ByteBuffer buf(const_cast<char*>(src.data() + offset), src.size() - offset);
- while (buf.remaining() > 0)
- {
- log4cxx_status_t stat = decoder->decode(buf, dst);
+ while (buf.remaining() > 0)
+ {
+ log4cxx_status_t stat = decoder->decode(buf, dst);
- if (CharsetDecoder::isError(stat))
- {
- dst.append(1, LOSSCHAR);
- buf.position(buf.position() + 1);
- }
- }
+ if (CharsetDecoder::isError(stat))
+ {
+ dst.append(1, LOSSCHAR);
+ buf.position(buf.position() + 1);
+ }
+ }
- decoder->decode(buf, dst);
- }
+ decoder->decode(buf, dst);
+ }
#endif
}
@@ -354,11 +354,11 @@
char* Transcoder::encode(const LogString& src, Pool& p)
{
#if LOG4CXX_CHARSET_UTF8 && LOG4CXX_LOGCHAR_IS_UTF8
- return p.pstrdup(src);
+ return p.pstrdup(src);
#else
- std::string tmp;
- encode(src, tmp);
- return p.pstrdup(tmp);
+ std::string tmp;
+ encode(src, tmp);
+ return p.pstrdup(tmp);
#endif
}
@@ -367,43 +367,43 @@
void Transcoder::encode(const LogString& src, std::string& dst)
{
#if LOG4CXX_CHARSET_UTF8 && LOG4CXX_LOGCHAR_IS_UTF8
- dst.append(src);
+ dst.append(src);
#else
- static CharsetEncoderPtr encoder(CharsetEncoder::getDefaultEncoder());
- dst.reserve(dst.size() + src.size());
- LogString::const_iterator iter = src.begin();
+ static CharsetEncoderPtr encoder(CharsetEncoder::getDefaultEncoder());
+ dst.reserve(dst.size() + src.size());
+ LogString::const_iterator iter = src.begin();
#if !LOG4CXX_CHARSET_EBCDIC
- for (;
- iter != src.end() && ((unsigned int) *iter) < 0x80;
- iter++)
- {
- dst.append(1, *iter);
- }
+ for (;
+ iter != src.end() && ((unsigned int) *iter) < 0x80;
+ iter++)
+ {
+ dst.append(1, *iter);
+ }
#endif
- if (iter != src.end())
- {
- char buf[BUFSIZE];
- ByteBuffer out(buf, BUFSIZE);
+ if (iter != src.end())
+ {
+ char buf[BUFSIZE];
+ ByteBuffer out(buf, BUFSIZE);
- while (iter != src.end())
- {
- log4cxx_status_t stat = encoder->encode(src, iter, out);
- out.flip();
- dst.append(out.data(), out.limit());
- out.clear();
+ while (iter != src.end())
+ {
+ log4cxx_status_t stat = encoder->encode(src, iter, out);
+ out.flip();
+ dst.append(out.data(), out.limit());
+ out.clear();
- if (CharsetEncoder::isError(stat))
- {
- dst.append(1, LOSSCHAR);
- iter++;
- }
- }
+ if (CharsetEncoder::isError(stat))
+ {
+ dst.append(1, LOSSCHAR);
+ iter++;
+ }
+ }
- encoder->encode(src, iter, out);
- }
+ encoder->encode(src, iter, out);
+ }
#endif
}
@@ -412,67 +412,67 @@
template<class String, class Iterator>
static unsigned int decodeUTF16(const String& in, Iterator& iter)
{
- unsigned int ch1 = *iter;
+ unsigned int ch1 = *iter;
- //
- // if not surrogate pair
- //
- if (ch1 < 0xD800 || ch1 > 0xDFFF)
- {
- //
- // then advance iterator and return wchar_t value
- //
- if (ch1 != 0xFFFF)
- {
- iter++;
- }
+ //
+ // if not surrogate pair
+ //
+ if (ch1 < 0xD800 || ch1 > 0xDFFF)
+ {
+ //
+ // then advance iterator and return wchar_t value
+ //
+ if (ch1 != 0xFFFF)
+ {
+ iter++;
+ }
- return ch1;
- }
- else if (ch1 < 0xDC00)
- {
- //
- // started with high-surrogate value
- // if there is an additional wchar_t
- Iterator iter2 = iter + 1;
+ return ch1;
+ }
+ else if (ch1 < 0xDC00)
+ {
+ //
+ // started with high-surrogate value
+ // if there is an additional wchar_t
+ Iterator iter2 = iter + 1;
- if (iter2 != in.end())
- {
- unsigned int ch2 = *iter2;
+ if (iter2 != in.end())
+ {
+ unsigned int ch2 = *iter2;
- //
- // if it is a matching low surrogate then
- // advance the iterator and return the scalar value
- if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
- {
- iter += 2;
- return (ch1 - 0xD800) * 0x400 + (ch2 - 0xDC00) + 0x10000;
- }
- }
- }
+ //
+ // if it is a matching low surrogate then
+ // advance the iterator and return the scalar value
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
+ {
+ iter += 2;
+ return (ch1 - 0xD800) * 0x400 + (ch2 - 0xDC00) + 0x10000;
+ }
+ }
+ }
- //
- // unrecognized value, do not advance iterator
- //
- return 0xFFFF;
+ //
+ // unrecognized value, do not advance iterator
+ //
+ return 0xFFFF;
}
template<class String>
static void encodeUTF16(unsigned int sv, String& dst)
{
- if (sv < 0x10000)
- {
- dst.append(1, sv);
- }
- else
- {
- unsigned char u = (unsigned char) (sv >> 16);
- unsigned char w = (unsigned char) (u - 1);
- unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10));
- unsigned short ls = (0xDC00 + (sv & 0x3FF));
- dst.append(1, hs);
- dst.append(1, ls);
- }
+ if (sv < 0x10000)
+ {
+ dst.append(1, sv);
+ }
+ else
+ {
+ unsigned char u = (unsigned char) (sv >> 16);
+ unsigned char w = (unsigned char) (u - 1);
+ unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10));
+ unsigned short ls = (0xDC00 + (sv & 0x3FF));
+ dst.append(1, hs);
+ dst.append(1, ls);
+ }
}
@@ -481,24 +481,24 @@
void Transcoder::decode(const std::wstring& src, LogString& dst)
{
#if LOG4CXX_LOGCHAR_IS_WCHAR_T
- dst.append(src, len);
+ dst.append(src, len);
#else
- std::wstring::const_iterator i = src.begin();
+ std::wstring::const_iterator i = src.begin();
- while (i != src.end())
- {
- unsigned int cp = decode(src, i);
+ while (i != src.end())
+ {
+ unsigned int cp = decode(src, i);
- if (cp != 0xFFFF)
- {
- encode(cp, dst);
- }
- else
- {
- dst.append(1, LOSSCHAR);
- i++;
- }
- }
+ if (cp != 0xFFFF)
+ {
+ encode(cp, dst);
+ }
+ else
+ {
+ dst.append(1, LOSSCHAR);
+ i++;
+ }
+ }
#endif
}
@@ -506,15 +506,15 @@
void Transcoder::encode(const LogString& src, std::wstring& dst)
{
#if LOG4CXX_LOGCHAR_IS_WCHAR_T
- dst.append(src);
+ dst.append(src);
#else
- for (LogString::const_iterator i = src.begin();
- i != src.end();)
- {
- unsigned int cp = Transcoder::decode(src, i);
- encode(cp, dst);
- }
+ for (LogString::const_iterator i = src.begin();
+ i != src.end();)
+ {
+ unsigned int cp = Transcoder::decode(src, i);
+ encode(cp, dst);
+ }
#endif
}
@@ -522,25 +522,25 @@
wchar_t* Transcoder::wencode(const LogString& src, Pool& p)
{
#if LOG4CXX_LOGCHAR_IS_WCHAR_T
- std::wstring& tmp = src;
+ std::wstring& tmp = src;
#else
- std::wstring tmp;
- encode(src, tmp);
+ std::wstring tmp;
+ encode(src, tmp);
#endif
- wchar_t* dst = (wchar_t*) p.palloc((tmp.length() + 1) * sizeof(wchar_t));
- dst[tmp.length()] = 0;
- memcpy(dst, tmp.data(), tmp.length() * sizeof(wchar_t));
- return dst;
+ wchar_t* dst = (wchar_t*) p.palloc((tmp.length() + 1) * sizeof(wchar_t));
+ dst[tmp.length()] = 0;
+ memcpy(dst, tmp.data(), tmp.length() * sizeof(wchar_t));
+ return dst;
}
unsigned int Transcoder::decode(const std::wstring& in,
- std::wstring::const_iterator& iter)
+ std::wstring::const_iterator& iter)
{
#if defined(__STDC_ISO_10646__)
- return *(iter++);
+ return *(iter++);
#else
- return decodeUTF16(in, iter);
+ return decodeUTF16(in, iter);
#endif
}
@@ -548,17 +548,17 @@
void Transcoder::encode(unsigned int sv, std::wstring& dst)
{
#if defined(__STDC_ISO_10646__)
- dst.append(1, sv);
+ dst.append(1, sv);
#else
- if (sizeof(wchar_t) == 4)
- {
- dst.append(1, sv);
- }
- else
- {
- encodeUTF16(sv, dst);
- }
+ if (sizeof(wchar_t) == 4)
+ {
+ dst.append(1, sv);
+ }
+ else
+ {
+ encodeUTF16(sv, dst);
+ }
#endif
}
@@ -571,15 +571,15 @@
void Transcoder::decode(const std::basic_string<UniChar>& src, LogString& dst)
{
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- dst.append(src);
+ dst.append(src);
#else
- for (std::basic_string<UniChar>::const_iterator i = src.begin();
- i != src.end();)
- {
- unsigned int cp = decode(src, i);
- encode(cp, dst);
- }
+ for (std::basic_string<UniChar>::const_iterator i = src.begin();
+ i != src.end();)
+ {
+ unsigned int cp = decode(src, i);
+ encode(cp, dst);
+ }
#endif
}
@@ -587,28 +587,28 @@
void Transcoder::encode(const LogString& src, std::basic_string<UniChar>& dst)
{
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- dst.append(src);
+ dst.append(src);
#else
- for (LogString::const_iterator i = src.begin();
- i != src.end();)
- {
- unsigned int cp = decode(src, i);
- encode(cp, dst);
- }
+ for (LogString::const_iterator i = src.begin();
+ i != src.end();)
+ {
+ unsigned int cp = decode(src, i);
+ encode(cp, dst);
+ }
#endif
}
unsigned int Transcoder::decode(const std::basic_string<UniChar>& in,
- std::basic_string<UniChar>::const_iterator& iter)
+ std::basic_string<UniChar>::const_iterator& iter)
{
- return decodeUTF16(in, iter);
+ return decodeUTF16(in, iter);
}
void Transcoder::encode(unsigned int sv, std::basic_string<UniChar>& dst)
{
- encodeUTF16(sv, dst);
+ encodeUTF16(sv, dst);
}
#endif
@@ -616,33 +616,33 @@
#if LOG4CXX_CFSTRING_API
void Transcoder::decode(const CFStringRef& src, LogString& dst)
{
- const UniChar* chars = CFStringGetCharactersPtr(src);
+ const UniChar* chars = CFStringGetCharactersPtr(src);
- if (chars)
- {
- decode(chars, dst);
- }
- else
- {
- size_t length = CFStringGetLength(src);
+ if (chars)
+ {
+ decode(chars, dst);
+ }
+ else
+ {
+ size_t length = CFStringGetLength(src);
- if (length > 0)
- {
- std::vector<UniChar> tmp(length);
- CFStringGetCharacters(src, CFRangeMake(0, length), &tmp[0]);
+ if (length > 0)
+ {
+ std::vector<UniChar> tmp(length);
+ CFStringGetCharacters(src, CFRangeMake(0, length), &tmp[0]);
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- dst.append(&tmp[0], tmp.size());
+ dst.append(&tmp[0], tmp.size());
#else
- decode(std::basic_string<UniChar>(&tmp[0], tmp.size()), dst);
+ decode(std::basic_string<UniChar>(&tmp[0], tmp.size()), dst);
#endif
- }
- }
+ }
+ }
}
CFStringRef Transcoder::encode(const LogString& src)
{
- LOG4CXX_ENCODE_UNICHAR(tmp, src);
- return CFStringCreateWithCharacters(kCFAllocatorDefault, tmp.data(), tmp.size());
+ LOG4CXX_ENCODE_UNICHAR(tmp, src);
+ return CFStringCreateWithCharacters(kCFAllocatorDefault, tmp.data(), tmp.size());
}
#endif
@@ -650,50 +650,50 @@
logchar Transcoder::decode(char val)
{
#if LOG4CXX_CHARSET_EBCDIC
- LogString dst;
- Transcoder::decode(std::string(1, val), dst);
- return dst[0];
+ LogString dst;
+ Transcoder::decode(std::string(1, val), dst);
+ return dst[0];
#else
- return val;
+ return val;
#endif
}
LogString Transcoder::decode(const char* val)
{
#if LOG4CXX_LOGCHAR_IS_UTF8 && !LOG4CXX_CHARSET_EBCDIC
- return val;
+ return val;
#else
- LogString dst;
- Transcoder::decode(val, dst);
- return dst;
+ LogString dst;
+ Transcoder::decode(val, dst);
+ return dst;
#endif
}
std::string Transcoder::encodeCharsetName(const LogString& val)
{
- char asciiTable[] = { ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'
- };
- std::string out;
+ char asciiTable[] = { ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'
+ };
+ std::string out;
- for (LogString::const_iterator iter = val.begin();
- iter != val.end();
- iter++)
- {
- if (*iter >= 0x20 && *iter < 0x7F)
- {
- out.append(1, asciiTable[*iter - 0x20]);
- }
- else
- {
- out.append(1, LOSSCHAR);
- }
- }
+ for (LogString::const_iterator iter = val.begin();
+ iter != val.end();
+ iter++)
+ {
+ if (*iter >= 0x20 && *iter < 0x7F)
+ {
+ out.append(1, asciiTable[*iter - 0x20]);
+ }
+ else
+ {
+ out.append(1, LOSSCHAR);
+ }
+ }
- return out;
+ return out;
}
diff --git a/src/main/cpp/transform.cpp b/src/main/cpp/transform.cpp
index fbae6f8..1d774c7 100644
--- a/src/main/cpp/transform.cpp
+++ b/src/main/cpp/transform.cpp
@@ -24,108 +24,108 @@
void Transform::appendEscapingTags(
- LogString& buf, const LogString& input)
+ LogString& buf, const LogString& input)
{
- //Check if the string is zero length -- if so, return
- //what was sent in.
+ //Check if the string is zero length -- if so, return
+ //what was sent in.
- if (input.length() == 0 )
- {
- return;
- }
+ if (input.length() == 0 )
+ {
+ return;
+ }
- logchar specials[] = { 0x22 /* " */, 0x26 /* & */, 0x3C /* < */, 0x3E /* > */, 0x00 };
- size_t start = 0;
- size_t special = input.find_first_of(specials, start);
+ logchar specials[] = { 0x22 /* " */, 0x26 /* & */, 0x3C /* < */, 0x3E /* > */, 0x00 };
+ size_t start = 0;
+ size_t special = input.find_first_of(specials, start);
- while (special != LogString::npos)
- {
- if (special > start)
- {
- buf.append(input, start, special - start);
- }
+ while (special != LogString::npos)
+ {
+ if (special > start)
+ {
+ buf.append(input, start, special - start);
+ }
- switch (input[special])
- {
- case 0x22:
- buf.append(LOG4CXX_STR("""));
- break;
+ switch (input[special])
+ {
+ case 0x22:
+ buf.append(LOG4CXX_STR("""));
+ break;
- case 0x26:
- buf.append(LOG4CXX_STR("&"));
- break;
+ case 0x26:
+ buf.append(LOG4CXX_STR("&"));
+ break;
- case 0x3C:
- buf.append(LOG4CXX_STR("<"));
- break;
+ case 0x3C:
+ buf.append(LOG4CXX_STR("<"));
+ break;
- case 0x3E:
- buf.append(LOG4CXX_STR(">"));
- break;
+ case 0x3E:
+ buf.append(LOG4CXX_STR(">"));
+ break;
- default:
- buf.append(1, input[special]);
- break;
- }
+ default:
+ buf.append(1, input[special]);
+ break;
+ }
- start = special + 1;
+ start = special + 1;
- if (special < input.size())
- {
- special = input.find_first_of(specials, start);
- }
- else
- {
- special = LogString::npos;
- }
- }
+ if (special < input.size())
+ {
+ special = input.find_first_of(specials, start);
+ }
+ else
+ {
+ special = LogString::npos;
+ }
+ }
- if (start < input.size())
- {
- buf.append(input, start, input.size() - start);
- }
+ if (start < input.size())
+ {
+ buf.append(input, start, input.size() - start);
+ }
}
void Transform::appendEscapingCDATA(
- LogString& buf, const LogString& input)
+ LogString& buf, const LogString& input)
{
- static const LogString CDATA_END(LOG4CXX_STR("]]>"));
- static const LogString CDATA_EMBEDED_END(LOG4CXX_STR("]]>]]><![CDATA["));
+ static const LogString CDATA_END(LOG4CXX_STR("]]>"));
+ static const LogString CDATA_EMBEDED_END(LOG4CXX_STR("]]>]]><![CDATA["));
- const LogString::size_type CDATA_END_LEN = 3;
+ const LogString::size_type CDATA_END_LEN = 3;
- if (input.length() == 0 )
- {
- return;
- }
+ if (input.length() == 0 )
+ {
+ return;
+ }
- LogString::size_type end = input.find(CDATA_END);
+ LogString::size_type end = input.find(CDATA_END);
- if (end == LogString::npos)
- {
- buf.append(input);
- return;
- }
+ if (end == LogString::npos)
+ {
+ buf.append(input);
+ return;
+ }
- LogString::size_type start = 0;
+ LogString::size_type start = 0;
- while (end != LogString::npos)
- {
- buf.append(input, start, end - start);
- buf.append(CDATA_EMBEDED_END);
- start = end + CDATA_END_LEN;
+ while (end != LogString::npos)
+ {
+ buf.append(input, start, end - start);
+ buf.append(CDATA_EMBEDED_END);
+ start = end + CDATA_END_LEN;
- if (start < input.length())
- {
- end = input.find(CDATA_END, start);
- }
- else
- {
- return;
- }
- }
+ if (start < input.length())
+ {
+ end = input.find(CDATA_END, start);
+ }
+ else
+ {
+ return;
+ }
+ }
- buf.append(input, start, input.length() - start);
+ buf.append(input, start, input.length() - start);
}
diff --git a/src/main/cpp/triggeringpolicy.cpp b/src/main/cpp/triggeringpolicy.cpp
index b9ff531..11b130b 100644
--- a/src/main/cpp/triggeringpolicy.cpp
+++ b/src/main/cpp/triggeringpolicy.cpp
@@ -29,10 +29,10 @@
void TriggeringPolicy::addRef() const
{
- ObjectImpl::addRef();
+ ObjectImpl::addRef();
}
void TriggeringPolicy::releaseRef() const
{
- ObjectImpl::releaseRef();
+ ObjectImpl::releaseRef();
}
diff --git a/src/main/cpp/ttcclayout.cpp b/src/main/cpp/ttcclayout.cpp
index 31a2117..4a291a8 100644
--- a/src/main/cpp/ttcclayout.cpp
+++ b/src/main/cpp/ttcclayout.cpp
@@ -29,51 +29,51 @@
IMPLEMENT_LOG4CXX_OBJECT(TTCCLayout)
TTCCLayout::TTCCLayout()
- : DateLayout(LOG4CXX_STR("RELATIVE")), threadPrinting(true), categoryPrefixing(true),
- contextPrinting(true), filePrinting(false)
+ : DateLayout(LOG4CXX_STR("RELATIVE")), threadPrinting(true), categoryPrefixing(true),
+ contextPrinting(true), filePrinting(false)
{
- Pool pool;
- activateOptions(pool);
+ Pool pool;
+ activateOptions(pool);
}
TTCCLayout::TTCCLayout(const LogString& dateFormatType)
- : DateLayout(dateFormatType), threadPrinting(true), categoryPrefixing(true),
- contextPrinting(true), filePrinting(false)
+ : DateLayout(dateFormatType), threadPrinting(true), categoryPrefixing(true),
+ contextPrinting(true), filePrinting(false)
{
- Pool pool;
- activateOptions(pool);
+ Pool pool;
+ activateOptions(pool);
}
void TTCCLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- Pool& p) const
+ const spi::LoggingEventPtr& event,
+ Pool& p) const
{
- formatDate(output, event, p);
+ formatDate(output, event, p);
- if (threadPrinting)
- {
- output.append(1, (logchar) 0x5B /* '[' */);
- output.append(event->getThreadName());
- output.append(1, (logchar) 0x5D /* ']' */);
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
+ if (threadPrinting)
+ {
+ output.append(1, (logchar) 0x5B /* '[' */);
+ output.append(event->getThreadName());
+ output.append(1, (logchar) 0x5D /* ']' */);
+ output.append(1, (logchar) 0x20 /* ' ' */);
+ }
- output.append(event->getLevel()->toString());
- output.append(1, (logchar) 0x20 /* ' ' */);
+ output.append(event->getLevel()->toString());
+ output.append(1, (logchar) 0x20 /* ' ' */);
- if (categoryPrefixing)
- {
- output.append(event->getLoggerName());
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
+ if (categoryPrefixing)
+ {
+ output.append(event->getLoggerName());
+ output.append(1, (logchar) 0x20 /* ' ' */);
+ }
- if (contextPrinting && event->getNDC(output))
- {
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
+ if (contextPrinting && event->getNDC(output))
+ {
+ output.append(1, (logchar) 0x20 /* ' ' */);
+ }
- output.append(1, (logchar) 0x2D /* '-' */);
- output.append(1, (logchar) 0x20 /* ' ' */);
- output.append(event->getRenderedMessage());
- output.append(LOG4CXX_EOL);
+ output.append(1, (logchar) 0x2D /* '-' */);
+ output.append(1, (logchar) 0x20 /* ' ' */);
+ output.append(event->getRenderedMessage());
+ output.append(LOG4CXX_EOL);
}
diff --git a/src/main/cpp/writer.cpp b/src/main/cpp/writer.cpp
index b2dcaf8..312aa52 100644
--- a/src/main/cpp/writer.cpp
+++ b/src/main/cpp/writer.cpp
@@ -34,6 +34,6 @@
#ifdef LOG4CXX_MULTI_PROCESS
OutputStreamPtr Writer::getOutPutStreamPtr()
{
- throw std::logic_error("getOutPutStreamPtr must be implemented in the derived class that you are using");
+ throw std::logic_error("getOutPutStreamPtr must be implemented in the derived class that you are using");
}
#endif
diff --git a/src/main/cpp/writerappender.cpp b/src/main/cpp/writerappender.cpp
index 0b645e8..6b8ee2b 100644
--- a/src/main/cpp/writerappender.cpp
+++ b/src/main/cpp/writerappender.cpp
@@ -29,57 +29,57 @@
WriterAppender::WriterAppender()
{
- LOCK_W sync(mutex);
- immediateFlush = true;
+ LOCK_W sync(mutex);
+ immediateFlush = true;
}
WriterAppender::WriterAppender(const LayoutPtr& layout1,
- log4cxx::helpers::WriterPtr& writer1)
- : AppenderSkeleton(layout1), writer(writer1)
+ log4cxx::helpers::WriterPtr& writer1)
+ : AppenderSkeleton(layout1), writer(writer1)
{
- Pool p;
- LOCK_W sync(mutex);
- immediateFlush = true;
- activateOptions(p);
+ Pool p;
+ LOCK_W sync(mutex);
+ immediateFlush = true;
+ activateOptions(p);
}
WriterAppender::WriterAppender(const LayoutPtr& layout1)
- : AppenderSkeleton(layout1)
+ : AppenderSkeleton(layout1)
{
- LOCK_W sync(mutex);
- immediateFlush = true;
+ LOCK_W sync(mutex);
+ immediateFlush = true;
}
WriterAppender::~WriterAppender()
{
- finalize();
+ finalize();
}
void WriterAppender::activateOptions(Pool& p)
{
- int errors = 0;
+ int errors = 0;
- if (layout == 0)
- {
- errorHandler->error(
- ((LogString) LOG4CXX_STR("No layout set for the appender named ["))
- + name + LOG4CXX_STR("]."));
- errors++;
- }
+ if (layout == 0)
+ {
+ errorHandler->error(
+ ((LogString) LOG4CXX_STR("No layout set for the appender named ["))
+ + name + LOG4CXX_STR("]."));
+ errors++;
+ }
- if (writer == 0)
- {
- errorHandler->error(
- ((LogString) LOG4CXX_STR("No writer set for the appender named ["))
- + name + LOG4CXX_STR("]."));
- errors++;
- }
+ if (writer == 0)
+ {
+ errorHandler->error(
+ ((LogString) LOG4CXX_STR("No writer set for the appender named ["))
+ + name + LOG4CXX_STR("]."));
+ errors++;
+ }
- if (errors == 0)
- {
- AppenderSkeleton::activateOptions(p);
- }
+ if (errors == 0)
+ {
+ AppenderSkeleton::activateOptions(p);
+ }
}
@@ -87,12 +87,12 @@
void WriterAppender::append(const spi::LoggingEventPtr& event, Pool& pool1)
{
- if (!checkEntryConditions())
- {
- return;
- }
+ if (!checkEntryConditions())
+ {
+ return;
+ }
- subAppend(event, pool1);
+ subAppend(event, pool1);
}
/**
@@ -103,42 +103,42 @@
value <code>false</code> is returned. */
bool WriterAppender::checkEntryConditions() const
{
- static bool warnedClosed = false;
- static bool warnedNoWriter = false;
+ static bool warnedClosed = false;
+ static bool warnedNoWriter = false;
- if (closed)
- {
- if (!warnedClosed)
- {
- LogLog::warn(LOG4CXX_STR("Not allowed to write to a closed appender."));
- warnedClosed = true;
- }
+ if (closed)
+ {
+ if (!warnedClosed)
+ {
+ LogLog::warn(LOG4CXX_STR("Not allowed to write to a closed appender."));
+ warnedClosed = true;
+ }
- return false;
- }
+ return false;
+ }
- if (writer == 0)
- {
- if (warnedNoWriter)
- {
- errorHandler->error(
- LogString(LOG4CXX_STR("No output stream or file set for the appender named [")) +
- name + LOG4CXX_STR("]."));
- warnedNoWriter = true;
- }
+ if (writer == 0)
+ {
+ if (warnedNoWriter)
+ {
+ errorHandler->error(
+ LogString(LOG4CXX_STR("No output stream or file set for the appender named [")) +
+ name + LOG4CXX_STR("]."));
+ warnedNoWriter = true;
+ }
- return false;
- }
+ return false;
+ }
- if (layout == 0)
- {
- errorHandler->error(
- LogString(LOG4CXX_STR("No layout set for the appender named [")) +
- name + LOG4CXX_STR("]."));
- return false;
- }
+ if (layout == 0)
+ {
+ errorHandler->error(
+ LogString(LOG4CXX_STR("No layout set for the appender named [")) +
+ name + LOG4CXX_STR("]."));
+ return false;
+ }
- return true;
+ return true;
}
@@ -154,15 +154,15 @@
*/
void WriterAppender::close()
{
- LOCK_W sync(mutex);
+ LOCK_W sync(mutex);
- if (closed)
- {
- return;
- }
+ if (closed)
+ {
+ return;
+ }
- closed = true;
- closeWriter();
+ closed = true;
+ closeWriter();
}
/**
@@ -170,24 +170,24 @@
* */
void WriterAppender::closeWriter()
{
- if (writer != NULL)
- {
- try
- {
- // before closing we have to output out layout's footer
- //
- // Using the object's pool since this is a one-shot operation
- // and pool is likely to be reclaimed soon when appender is destructed.
- //
- writeFooter(pool);
- writer->close(pool);
- writer = 0;
- }
- catch (IOException& e)
- {
- LogLog::error(LogString(LOG4CXX_STR("Could not close writer for WriterAppender named ")) + name, e);
- }
- }
+ if (writer != NULL)
+ {
+ try
+ {
+ // before closing we have to output out layout's footer
+ //
+ // Using the object's pool since this is a one-shot operation
+ // and pool is likely to be reclaimed soon when appender is destructed.
+ //
+ writeFooter(pool);
+ writer->close(pool);
+ writer = 0;
+ }
+ catch (IOException& e)
+ {
+ LogLog::error(LogString(LOG4CXX_STR("Could not close writer for WriterAppender named ")) + name, e);
+ }
+ }
}
@@ -200,117 +200,117 @@
WriterPtr WriterAppender::createWriter(OutputStreamPtr& os)
{
- LogString enc(getEncoding());
+ LogString enc(getEncoding());
- CharsetEncoderPtr encoder;
+ CharsetEncoderPtr encoder;
- if (enc.empty())
- {
- encoder = CharsetEncoder::getDefaultEncoder();
- }
- else
- {
- if (StringHelper::equalsIgnoreCase(enc,
- LOG4CXX_STR("utf-16"), LOG4CXX_STR("UTF-16")))
- {
- encoder = CharsetEncoder::getEncoder(LOG4CXX_STR("UTF-16BE"));
- }
- else
- {
- encoder = CharsetEncoder::getEncoder(enc);
- }
+ if (enc.empty())
+ {
+ encoder = CharsetEncoder::getDefaultEncoder();
+ }
+ else
+ {
+ if (StringHelper::equalsIgnoreCase(enc,
+ LOG4CXX_STR("utf-16"), LOG4CXX_STR("UTF-16")))
+ {
+ encoder = CharsetEncoder::getEncoder(LOG4CXX_STR("UTF-16BE"));
+ }
+ else
+ {
+ encoder = CharsetEncoder::getEncoder(enc);
+ }
- if (encoder == NULL)
- {
- encoder = CharsetEncoder::getDefaultEncoder();
- LogLog::warn(LOG4CXX_STR("Error initializing output writer."));
- LogLog::warn(LOG4CXX_STR("Unsupported encoding?"));
- }
- }
+ if (encoder == NULL)
+ {
+ encoder = CharsetEncoder::getDefaultEncoder();
+ LogLog::warn(LOG4CXX_STR("Error initializing output writer."));
+ LogLog::warn(LOG4CXX_STR("Unsupported encoding?"));
+ }
+ }
- return new OutputStreamWriter(os, encoder);
+ return new OutputStreamWriter(os, encoder);
}
LogString WriterAppender::getEncoding() const
{
- return encoding;
+ return encoding;
}
void WriterAppender::setEncoding(const LogString& enc)
{
- encoding = enc;
+ encoding = enc;
}
void WriterAppender::subAppend(const spi::LoggingEventPtr& event, Pool& p)
{
- LogString msg;
- layout->format(msg, event, p);
- {
- LOCK_W sync(mutex);
+ LogString msg;
+ layout->format(msg, event, p);
+ {
+ LOCK_W sync(mutex);
- if (writer != NULL)
- {
- writer->write(msg, p);
+ if (writer != NULL)
+ {
+ writer->write(msg, p);
- if (immediateFlush)
- {
- writer->flush(p);
- }
- }
- }
+ if (immediateFlush)
+ {
+ writer->flush(p);
+ }
+ }
+ }
}
void WriterAppender::writeFooter(Pool& p)
{
- if (layout != NULL)
- {
- LogString foot;
- layout->appendFooter(foot, p);
- LOCK_W sync(mutex);
- writer->write(foot, p);
- }
+ if (layout != NULL)
+ {
+ LogString foot;
+ layout->appendFooter(foot, p);
+ LOCK_W sync(mutex);
+ writer->write(foot, p);
+ }
}
void WriterAppender::writeHeader(Pool& p)
{
- if (layout != NULL)
- {
- LogString header;
- layout->appendHeader(header, p);
- LOCK_W sync(mutex);
- writer->write(header, p);
- }
+ if (layout != NULL)
+ {
+ LogString header;
+ layout->appendHeader(header, p);
+ LOCK_W sync(mutex);
+ writer->write(header, p);
+ }
}
void WriterAppender::setWriter(const WriterPtr& newWriter)
{
- LOCK_W sync(mutex);
- writer = newWriter;
+ LOCK_W sync(mutex);
+ writer = newWriter;
}
bool WriterAppender::requiresLayout() const
{
- return true;
+ return true;
}
void WriterAppender::setOption(const LogString& option, const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("ENCODING"), LOG4CXX_STR("encoding")))
- {
- setEncoding(value);
- }
- else
- {
- AppenderSkeleton::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("ENCODING"), LOG4CXX_STR("encoding")))
+ {
+ setEncoding(value);
+ }
+ else
+ {
+ AppenderSkeleton::setOption(option, value);
+ }
}
void WriterAppender::setImmediateFlush(bool value)
{
- LOCK_W sync(mutex);
- immediateFlush = value;
+ LOCK_W sync(mutex);
+ immediateFlush = value;
}
diff --git a/src/main/cpp/xmllayout.cpp b/src/main/cpp/xmllayout.cpp
index d7e683b..1cdae41 100644
--- a/src/main/cpp/xmllayout.cpp
+++ b/src/main/cpp/xmllayout.cpp
@@ -35,127 +35,127 @@
IMPLEMENT_LOG4CXX_OBJECT(XMLLayout)
XMLLayout::XMLLayout()
- : locationInfo(false), properties(false)
+ : locationInfo(false), properties(false)
{
}
void XMLLayout::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
- {
- setLocationInfo(OptionConverter::toBoolean(value, false));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")))
+ {
+ setLocationInfo(OptionConverter::toBoolean(value, false));
+ }
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PROPERTIES"), LOG4CXX_STR("properties")))
- {
- setProperties(OptionConverter::toBoolean(value, false));
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("PROPERTIES"), LOG4CXX_STR("properties")))
+ {
+ setProperties(OptionConverter::toBoolean(value, false));
+ }
}
void XMLLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- Pool& p) const
+ const spi::LoggingEventPtr& event,
+ Pool& p) const
{
- output.append(LOG4CXX_STR("<log4j:event logger=\""));
- Transform::appendEscapingTags(output, event->getLoggerName());
- output.append(LOG4CXX_STR("\" timestamp=\""));
- StringHelper::toString(event->getTimeStamp() / 1000L, p, output);
- output.append(LOG4CXX_STR("\" level=\""));
- Transform::appendEscapingTags(output, event->getLevel()->toString());
- output.append(LOG4CXX_STR("\" thread=\""));
- Transform::appendEscapingTags(output, event->getThreadName());
- output.append(LOG4CXX_STR("\">"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<log4j:event logger=\""));
+ Transform::appendEscapingTags(output, event->getLoggerName());
+ output.append(LOG4CXX_STR("\" timestamp=\""));
+ StringHelper::toString(event->getTimeStamp() / 1000L, p, output);
+ output.append(LOG4CXX_STR("\" level=\""));
+ Transform::appendEscapingTags(output, event->getLevel()->toString());
+ output.append(LOG4CXX_STR("\" thread=\""));
+ Transform::appendEscapingTags(output, event->getThreadName());
+ output.append(LOG4CXX_STR("\">"));
+ output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_STR("<log4j:message><![CDATA["));
- // Append the rendered message. Also make sure to escape any
- // existing CDATA sections.
- Transform::appendEscapingCDATA(output, event->getRenderedMessage());
- output.append(LOG4CXX_STR("]]></log4j:message>"));
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("<log4j:message><![CDATA["));
+ // Append the rendered message. Also make sure to escape any
+ // existing CDATA sections.
+ Transform::appendEscapingCDATA(output, event->getRenderedMessage());
+ output.append(LOG4CXX_STR("]]></log4j:message>"));
+ output.append(LOG4CXX_EOL);
- LogString ndc;
+ LogString ndc;
- if (event->getNDC(ndc))
- {
- output.append(LOG4CXX_STR("<log4j:NDC><![CDATA["));
- Transform::appendEscapingCDATA(output, ndc);
- output.append(LOG4CXX_STR("]]></log4j:NDC>"));
- output.append(LOG4CXX_EOL);
- }
+ if (event->getNDC(ndc))
+ {
+ output.append(LOG4CXX_STR("<log4j:NDC><![CDATA["));
+ Transform::appendEscapingCDATA(output, ndc);
+ output.append(LOG4CXX_STR("]]></log4j:NDC>"));
+ output.append(LOG4CXX_EOL);
+ }
- if (locationInfo)
- {
- output.append(LOG4CXX_STR("<log4j:locationInfo class=\""));
- const LocationInfo& locInfo = event->getLocationInformation();
- LOG4CXX_DECODE_CHAR(className, locInfo.getClassName());
- Transform::appendEscapingTags(output, className);
- output.append(LOG4CXX_STR("\" method=\""));
- LOG4CXX_DECODE_CHAR(method, locInfo.getMethodName());
- Transform::appendEscapingTags(output, method);
- output.append(LOG4CXX_STR("\" file=\""));
- LOG4CXX_DECODE_CHAR(fileName, locInfo.getFileName());
- Transform::appendEscapingTags(output, fileName);
- output.append(LOG4CXX_STR("\" line=\""));
- StringHelper::toString(locInfo.getLineNumber(), p, output);
- output.append(LOG4CXX_STR("\"/>"));
- output.append(LOG4CXX_EOL);
- }
+ if (locationInfo)
+ {
+ output.append(LOG4CXX_STR("<log4j:locationInfo class=\""));
+ const LocationInfo& locInfo = event->getLocationInformation();
+ LOG4CXX_DECODE_CHAR(className, locInfo.getClassName());
+ Transform::appendEscapingTags(output, className);
+ output.append(LOG4CXX_STR("\" method=\""));
+ LOG4CXX_DECODE_CHAR(method, locInfo.getMethodName());
+ Transform::appendEscapingTags(output, method);
+ output.append(LOG4CXX_STR("\" file=\""));
+ LOG4CXX_DECODE_CHAR(fileName, locInfo.getFileName());
+ Transform::appendEscapingTags(output, fileName);
+ output.append(LOG4CXX_STR("\" line=\""));
+ StringHelper::toString(locInfo.getLineNumber(), p, output);
+ output.append(LOG4CXX_STR("\"/>"));
+ output.append(LOG4CXX_EOL);
+ }
- if (properties)
- {
- LoggingEvent::KeySet propertySet(event->getPropertyKeySet());
- LoggingEvent::KeySet keySet(event->getMDCKeySet());
+ if (properties)
+ {
+ LoggingEvent::KeySet propertySet(event->getPropertyKeySet());
+ LoggingEvent::KeySet keySet(event->getMDCKeySet());
- if (!(keySet.empty() && propertySet.empty()))
- {
- output.append(LOG4CXX_STR("<log4j:properties>"));
- output.append(LOG4CXX_EOL);
+ if (!(keySet.empty() && propertySet.empty()))
+ {
+ output.append(LOG4CXX_STR("<log4j:properties>"));
+ output.append(LOG4CXX_EOL);
- for (LoggingEvent::KeySet::const_iterator i = keySet.begin();
- i != keySet.end();
- i++)
- {
- LogString key(*i);
- LogString value;
+ for (LoggingEvent::KeySet::const_iterator i = keySet.begin();
+ i != keySet.end();
+ i++)
+ {
+ LogString key(*i);
+ LogString value;
- if (event->getMDC(key, value))
- {
- output.append(LOG4CXX_STR("<log4j:data name=\""));
- Transform::appendEscapingTags(output, key);
- output.append(LOG4CXX_STR("\" value=\""));
- Transform::appendEscapingTags(output, value);
- output.append(LOG4CXX_STR("\"/>"));
- output.append(LOG4CXX_EOL);
- }
- }
+ if (event->getMDC(key, value))
+ {
+ output.append(LOG4CXX_STR("<log4j:data name=\""));
+ Transform::appendEscapingTags(output, key);
+ output.append(LOG4CXX_STR("\" value=\""));
+ Transform::appendEscapingTags(output, value);
+ output.append(LOG4CXX_STR("\"/>"));
+ output.append(LOG4CXX_EOL);
+ }
+ }
- for (LoggingEvent::KeySet::const_iterator i2 = propertySet.begin();
- i2 != propertySet.end();
- i2++)
- {
- LogString key(*i2);
- LogString value;
+ for (LoggingEvent::KeySet::const_iterator i2 = propertySet.begin();
+ i2 != propertySet.end();
+ i2++)
+ {
+ LogString key(*i2);
+ LogString value;
- if (event->getProperty(key, value))
- {
- output.append(LOG4CXX_STR("<log4j:data name=\""));
- Transform::appendEscapingTags(output, key);
- output.append(LOG4CXX_STR("\" value=\""));
- Transform::appendEscapingTags(output, value);
- output.append(LOG4CXX_STR("\"/>"));
- output.append(LOG4CXX_EOL);
- }
- }
+ if (event->getProperty(key, value))
+ {
+ output.append(LOG4CXX_STR("<log4j:data name=\""));
+ Transform::appendEscapingTags(output, key);
+ output.append(LOG4CXX_STR("\" value=\""));
+ Transform::appendEscapingTags(output, value);
+ output.append(LOG4CXX_STR("\"/>"));
+ output.append(LOG4CXX_EOL);
+ }
+ }
- output.append(LOG4CXX_STR("</log4j:properties>"));
- output.append(LOG4CXX_EOL);
- }
- }
+ output.append(LOG4CXX_STR("</log4j:properties>"));
+ output.append(LOG4CXX_EOL);
+ }
+ }
- output.append(LOG4CXX_STR("</log4j:event>"));
- output.append(LOG4CXX_EOL);
- output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_STR("</log4j:event>"));
+ output.append(LOG4CXX_EOL);
+ output.append(LOG4CXX_EOL);
}
diff --git a/src/main/cpp/xmlsocketappender.cpp b/src/main/cpp/xmlsocketappender.cpp
index edecbd2..fe83c4d 100644
--- a/src/main/cpp/xmlsocketappender.cpp
+++ b/src/main/cpp/xmlsocketappender.cpp
@@ -45,89 +45,89 @@
const int XMLSocketAppender::MAX_EVENT_LEN = 1024;
XMLSocketAppender::XMLSocketAppender()
- : SocketAppenderSkeleton(DEFAULT_PORT, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(DEFAULT_PORT, DEFAULT_RECONNECTION_DELAY)
{
- layout = new XMLLayout();
+ layout = new XMLLayout();
}
XMLSocketAppender::XMLSocketAppender(InetAddressPtr address1, int port1)
- : SocketAppenderSkeleton(address1, port1, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(address1, port1, DEFAULT_RECONNECTION_DELAY)
{
- layout = new XMLLayout();
- Pool p;
- activateOptions(p);
+ layout = new XMLLayout();
+ Pool p;
+ activateOptions(p);
}
XMLSocketAppender::XMLSocketAppender(const LogString& host, int port1)
- : SocketAppenderSkeleton(host, port1, DEFAULT_RECONNECTION_DELAY)
+ : SocketAppenderSkeleton(host, port1, DEFAULT_RECONNECTION_DELAY)
{
- layout = new XMLLayout();
- Pool p;
- activateOptions(p);
+ layout = new XMLLayout();
+ Pool p;
+ activateOptions(p);
}
XMLSocketAppender::~XMLSocketAppender()
{
- finalize();
+ finalize();
}
int XMLSocketAppender::getDefaultDelay() const
{
- return DEFAULT_RECONNECTION_DELAY;
+ return DEFAULT_RECONNECTION_DELAY;
}
int XMLSocketAppender::getDefaultPort() const
{
- return DEFAULT_PORT;
+ return DEFAULT_PORT;
}
void XMLSocketAppender::setSocket(log4cxx::helpers::SocketPtr& socket, Pool& p)
{
- OutputStreamPtr os(new SocketOutputStream(socket));
- CharsetEncoderPtr charset(CharsetEncoder::getUTF8Encoder());
- LOCK_W sync(mutex);
- writer = new OutputStreamWriter(os, charset);
+ OutputStreamPtr os(new SocketOutputStream(socket));
+ CharsetEncoderPtr charset(CharsetEncoder::getUTF8Encoder());
+ LOCK_W sync(mutex);
+ writer = new OutputStreamWriter(os, charset);
}
void XMLSocketAppender::cleanUp(Pool& p)
{
- if (writer != 0)
- {
- try
- {
- writer->close(p);
- writer = 0;
- }
- catch (std::exception& e)
- {
- }
- }
+ if (writer != 0)
+ {
+ try
+ {
+ writer->close(p);
+ writer = 0;
+ }
+ catch (std::exception& e)
+ {
+ }
+ }
}
void XMLSocketAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p)
{
- if (writer != 0)
- {
- LogString output;
- layout->format(output, event, p);
+ if (writer != 0)
+ {
+ LogString output;
+ layout->format(output, event, p);
- try
- {
- writer->write(output, p);
- writer->flush(p);
- }
- catch (std::exception& e)
- {
- writer = 0;
- LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e);
+ try
+ {
+ writer->write(output, p);
+ writer->flush(p);
+ }
+ catch (std::exception& e)
+ {
+ writer = 0;
+ LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e);
- if (getReconnectionDelay() > 0)
- {
- fireConnector();
- }
- }
- }
+ if (getReconnectionDelay() > 0)
+ {
+ fireConnector();
+ }
+ }
+ }
}
diff --git a/src/main/cpp/zipcompressaction.cpp b/src/main/cpp/zipcompressaction.cpp
index 8704415..de0ac64 100644
--- a/src/main/cpp/zipcompressaction.cpp
+++ b/src/main/cpp/zipcompressaction.cpp
@@ -28,93 +28,93 @@
IMPLEMENT_LOG4CXX_OBJECT(ZipCompressAction)
ZipCompressAction::ZipCompressAction(const File& src,
- const File& dest,
- bool del)
- : source(src), destination(dest), deleteSource(del)
+ const File& dest,
+ bool del)
+ : source(src), destination(dest), deleteSource(del)
{
}
bool ZipCompressAction::execute(log4cxx::helpers::Pool& p) const
{
- if (!source.exists(p))
- {
- return false;
- }
+ if (!source.exists(p))
+ {
+ return false;
+ }
- apr_pool_t* aprpool = p.getAPRPool();
- apr_procattr_t* attr;
- apr_status_t stat = apr_procattr_create(&attr, aprpool);
+ apr_pool_t* aprpool = p.getAPRPool();
+ apr_procattr_t* attr;
+ apr_status_t stat = apr_procattr_create(&attr, aprpool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, APR_FULL_BLOCK);
+ stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, APR_FULL_BLOCK);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH);
+ stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- //
- // redirect the child's error stream to this processes' error stream
- //
- apr_file_t* child_err;
- stat = apr_file_open_stderr(&child_err, aprpool);
+ //
+ // redirect the child's error stream to this processes' error stream
+ //
+ apr_file_t* child_err;
+ stat = apr_file_open_stderr(&child_err, aprpool);
- if (stat == APR_SUCCESS)
- {
- stat = apr_procattr_child_err_set(attr, child_err, NULL);
+ if (stat == APR_SUCCESS)
+ {
+ stat = apr_procattr_child_err_set(attr, child_err, NULL);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
+ }
- const char** args = (const char**)
- apr_palloc(aprpool, 5 * sizeof(*args));
- int i = 0;
+ const char** args = (const char**)
+ apr_palloc(aprpool, 5 * sizeof(*args));
+ int i = 0;
- args[i++] = "zip";
- args[i++] = "-q";
- args[i++] = Transcoder::encode(destination.getPath(), p);
- args[i++] = Transcoder::encode(source.getPath(), p);
- args[i++] = NULL;
+ args[i++] = "zip";
+ args[i++] = "-q";
+ args[i++] = Transcoder::encode(destination.getPath(), p);
+ args[i++] = Transcoder::encode(source.getPath(), p);
+ args[i++] = NULL;
- if (destination.exists(p))
- {
- destination.deleteFile(p);
- }
+ if (destination.exists(p))
+ {
+ destination.deleteFile(p);
+ }
- apr_proc_t pid;
- stat = apr_proc_create(&pid, "zip", args, NULL, attr, aprpool);
+ apr_proc_t pid;
+ stat = apr_proc_create(&pid, "zip", args, NULL, attr, aprpool);
- if (stat != APR_SUCCESS)
- {
- throw IOException(stat);
- }
+ if (stat != APR_SUCCESS)
+ {
+ throw IOException(stat);
+ }
- int exitCode;
- apr_proc_wait(&pid, &exitCode, NULL, APR_WAIT);
+ int exitCode;
+ apr_proc_wait(&pid, &exitCode, NULL, APR_WAIT);
- if (exitCode != APR_SUCCESS)
- {
- throw IOException(exitCode);
- }
+ if (exitCode != APR_SUCCESS)
+ {
+ throw IOException(exitCode);
+ }
- if (deleteSource)
- {
- source.deleteFile(p);
- }
+ if (deleteSource)
+ {
+ source.deleteFile(p);
+ }
- return true;
+ return true;
}
diff --git a/src/main/include/log4cxx/appender.h b/src/main/include/log4cxx/appender.h
index 10a63e9..0f58dfc 100644
--- a/src/main/include/log4cxx/appender.h
+++ b/src/main/include/log4cxx/appender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -54,86 +54,86 @@
statements.
*/
class LOG4CXX_EXPORT Appender :
- public virtual spi::OptionHandler
+ public virtual spi::OptionHandler
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Appender)
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Appender)
- virtual ~Appender() {}
+ virtual ~Appender() {}
- /**
- Add a filter to the end of the filter list.
- */
- virtual void addFilter(const spi::FilterPtr& newFilter) = 0;
+ /**
+ Add a filter to the end of the filter list.
+ */
+ virtual void addFilter(const spi::FilterPtr& newFilter) = 0;
- /**
- Returns the head Filter. The Filters are organized in a linked list
- and so all Filters on this Appender are available through the result.
+ /**
+ Returns the head Filter. The Filters are organized in a linked list
+ and so all Filters on this Appender are available through the result.
- @return the head Filter or null, if no Filters are present
- */
- virtual spi::FilterPtr getFilter() const = 0;
+ @return the head Filter or null, if no Filters are present
+ */
+ virtual spi::FilterPtr getFilter() const = 0;
- /**
- Clear the list of filters by removing all the filters in it.
- */
- virtual void clearFilters() = 0;
+ /**
+ Clear the list of filters by removing all the filters in it.
+ */
+ virtual void clearFilters() = 0;
- /**
- Release any resources allocated within the appender such as file
- handles, network connections, etc.
- <p>It is a programming error to append to a closed appender.
- */
- virtual void close() = 0;
+ /**
+ Release any resources allocated within the appender such as file
+ handles, network connections, etc.
+ <p>It is a programming error to append to a closed appender.
+ */
+ virtual void close() = 0;
- /**
- Log in <code>Appender</code> specific way. When appropriate,
- Loggers will call the <code>doAppend</code> method of appender
- implementations in order to log.
- */
- virtual void doAppend(const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& pool) = 0;
+ /**
+ Log in <code>Appender</code> specific way. When appropriate,
+ Loggers will call the <code>doAppend</code> method of appender
+ implementations in order to log.
+ */
+ virtual void doAppend(const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& pool) = 0;
- /**
- Get the name of this appender. The name uniquely identifies the
- appender.
- */
- virtual LogString getName() const = 0;
+ /**
+ Get the name of this appender. The name uniquely identifies the
+ appender.
+ */
+ virtual LogString getName() const = 0;
- /**
- Set the Layout for this appender.
- */
- virtual void setLayout(const LayoutPtr& layout) = 0;
+ /**
+ Set the Layout for this appender.
+ */
+ virtual void setLayout(const LayoutPtr& layout) = 0;
- /**
- Returns this appenders layout.
- */
- virtual LayoutPtr getLayout() const = 0;
+ /**
+ Returns this appenders layout.
+ */
+ virtual LayoutPtr getLayout() const = 0;
- /**
- Set the name of this appender. The name is used by other
- components to identify this appender.
- */
- virtual void setName(const LogString& name) = 0;
+ /**
+ Set the name of this appender. The name is used by other
+ components to identify this appender.
+ */
+ virtual void setName(const LogString& name) = 0;
- /**
- Configurators call this method to determine if the appender
- requires a layout. If this method returns <code>true</code>,
- meaning that layout is required, then the configurator will
- configure an layout using the configuration information at its
- disposal. If this method returns <code>false</code>, meaning that
- a layout is not required, then layout configuration will be
- skipped even if there is available layout configuration
- information at the disposal of the configurator..
+ /**
+ Configurators call this method to determine if the appender
+ requires a layout. If this method returns <code>true</code>,
+ meaning that layout is required, then the configurator will
+ configure an layout using the configuration information at its
+ disposal. If this method returns <code>false</code>, meaning that
+ a layout is not required, then layout configuration will be
+ skipped even if there is available layout configuration
+ information at the disposal of the configurator..
- <p>In the rather exceptional case, where the appender
- implementation admits a layout but can also work without it, then
- the appender should return <code>true</code>.
- */
- virtual bool requiresLayout() const = 0;
+ <p>In the rather exceptional case, where the appender
+ implementation admits a layout but can also work without it, then
+ the appender should return <code>true</code>.
+ */
+ virtual bool requiresLayout() const = 0;
};
LOG4CXX_PTR_DEF(Appender);
@@ -142,7 +142,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_APPENDER_H
diff --git a/src/main/include/log4cxx/appenderskeleton.h b/src/main/include/log4cxx/appenderskeleton.h
index d51bf95..81ca261 100644
--- a/src/main/include/log4cxx/appenderskeleton.h
+++ b/src/main/include/log4cxx/appenderskeleton.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_APPENDER_SKELETON_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -43,196 +43,196 @@
* support for threshold filtering and support for general filters.
* */
class LOG4CXX_EXPORT AppenderSkeleton :
- public virtual Appender,
- public virtual helpers::ObjectImpl
+ public virtual Appender,
+ public virtual helpers::ObjectImpl
{
- protected:
- /** The layout variable does not need to be set if the appender
- implementation has its own layout. */
- LayoutPtr layout;
+ protected:
+ /** The layout variable does not need to be set if the appender
+ implementation has its own layout. */
+ LayoutPtr layout;
- /** Appenders are named. */
- LogString name;
+ /** Appenders are named. */
+ LogString name;
- /**
- There is no level threshold filtering by default. */
- LevelPtr threshold;
+ /**
+ There is no level threshold filtering by default. */
+ LevelPtr threshold;
- /**
- It is assumed and enforced that errorHandler is never null.
- */
- spi::ErrorHandlerPtr errorHandler;
+ /**
+ It is assumed and enforced that errorHandler is never null.
+ */
+ spi::ErrorHandlerPtr errorHandler;
- /** The first filter in the filter chain. Set to <code>null</code>
- initially. */
- spi::FilterPtr headFilter;
+ /** The first filter in the filter chain. Set to <code>null</code>
+ initially. */
+ spi::FilterPtr headFilter;
- /** The last filter in the filter chain. */
- spi::FilterPtr tailFilter;
+ /** The last filter in the filter chain. */
+ spi::FilterPtr tailFilter;
- /**
- Is this appender closed?
- */
- bool closed;
+ /**
+ Is this appender closed?
+ */
+ bool closed;
- log4cxx::helpers::Pool pool;
- mutable SHARED_MUTEX mutex;
+ log4cxx::helpers::Pool pool;
+ mutable SHARED_MUTEX mutex;
- /**
- Subclasses of <code>AppenderSkeleton</code> should implement this
- method to perform actual logging. See also AppenderSkeleton::doAppend
- method.
- */
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) = 0;
+ /**
+ Subclasses of <code>AppenderSkeleton</code> should implement this
+ method to perform actual logging. See also AppenderSkeleton::doAppend
+ method.
+ */
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) = 0;
- void doAppendImpl(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
+ void doAppendImpl(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderSkeleton)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(AppenderSkeleton)
- LOG4CXX_CAST_ENTRY(Appender)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderSkeleton)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(AppenderSkeleton)
+ LOG4CXX_CAST_ENTRY(Appender)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ END_LOG4CXX_CAST_MAP()
- AppenderSkeleton();
- AppenderSkeleton(const LayoutPtr& layout);
+ AppenderSkeleton();
+ AppenderSkeleton(const LayoutPtr& layout);
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- /**
- Finalize this appender by calling the derived class'
- <code>close</code> method.
- */
- void finalize();
+ /**
+ Finalize this appender by calling the derived class'
+ <code>close</code> method.
+ */
+ void finalize();
- /**
- Derived appenders should override this method if option structure
- requires it.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& /* pool */) {}
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Derived appenders should override this method if option structure
+ requires it.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& /* pool */) {}
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- Add a filter to end of the filter list.
- */
- void addFilter(const spi::FilterPtr& newFilter) ;
+ /**
+ Add a filter to end of the filter list.
+ */
+ void addFilter(const spi::FilterPtr& newFilter) ;
- public:
- /**
- Clear the filters chain.
- */
- void clearFilters();
+ public:
+ /**
+ Clear the filters chain.
+ */
+ void clearFilters();
- /**
- Return the currently set spi::ErrorHandler for this
- Appender.
- */
- const spi::ErrorHandlerPtr& getErrorHandler() const
- {
- return errorHandler;
- }
+ /**
+ Return the currently set spi::ErrorHandler for this
+ Appender.
+ */
+ const spi::ErrorHandlerPtr& getErrorHandler() const
+ {
+ return errorHandler;
+ }
- /**
- Returns the head Filter.
- */
- spi::FilterPtr getFilter() const
- {
- return headFilter;
- }
+ /**
+ Returns the head Filter.
+ */
+ spi::FilterPtr getFilter() const
+ {
+ return headFilter;
+ }
- /**
- Return the first filter in the filter chain for this
- Appender. The return value may be <code>0</code> if no is
- filter is set.
- */
- const spi::FilterPtr& getFirstFilter() const
- {
- return headFilter;
- }
+ /**
+ Return the first filter in the filter chain for this
+ Appender. The return value may be <code>0</code> if no is
+ filter is set.
+ */
+ const spi::FilterPtr& getFirstFilter() const
+ {
+ return headFilter;
+ }
- /**
- Returns the layout of this appender. The value may be 0.
- */
- LayoutPtr getLayout() const
- {
- return layout;
- }
+ /**
+ Returns the layout of this appender. The value may be 0.
+ */
+ LayoutPtr getLayout() const
+ {
+ return layout;
+ }
- /**
- Returns the name of this Appender.
- */
- LogString getName() const
- {
- return name;
- }
+ /**
+ Returns the name of this Appender.
+ */
+ LogString getName() const
+ {
+ return name;
+ }
- /**
- Returns this appenders threshold level. See the #setThreshold
- method for the meaning of this option.
- */
- const LevelPtr& getThreshold()
- {
- return threshold;
- }
+ /**
+ Returns this appenders threshold level. See the #setThreshold
+ method for the meaning of this option.
+ */
+ const LevelPtr& getThreshold()
+ {
+ return threshold;
+ }
- /**
- Check whether the message level is below the appender's
- threshold. If there is no threshold set, then the return value is
- always <code>true</code>.
- */
- bool isAsSevereAsThreshold(const LevelPtr& level) const;
+ /**
+ Check whether the message level is below the appender's
+ threshold. If there is no threshold set, then the return value is
+ always <code>true</code>.
+ */
+ bool isAsSevereAsThreshold(const LevelPtr& level) const;
- /**
- * This method performs threshold checks and invokes filters before
- * delegating actual logging to the subclasses specific
- * AppenderSkeleton#append method.
- * */
- virtual void doAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
+ /**
+ * This method performs threshold checks and invokes filters before
+ * delegating actual logging to the subclasses specific
+ * AppenderSkeleton#append method.
+ * */
+ virtual void doAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
- /**
- Set the {@link spi::ErrorHandler ErrorHandler} for this Appender.
- */
- void setErrorHandler(const spi::ErrorHandlerPtr& eh);
+ /**
+ Set the {@link spi::ErrorHandler ErrorHandler} for this Appender.
+ */
+ void setErrorHandler(const spi::ErrorHandlerPtr& eh);
- /**
- Set the layout for this appender. Note that some appenders have
- their own (fixed) layouts or do not use one. For example, the
- {@link net::SocketAppender SocketAppender} ignores the layout set
- here.
- */
- void setLayout(const LayoutPtr& layout1)
- {
- this->layout = layout1;
- }
+ /**
+ Set the layout for this appender. Note that some appenders have
+ their own (fixed) layouts or do not use one. For example, the
+ {@link net::SocketAppender SocketAppender} ignores the layout set
+ here.
+ */
+ void setLayout(const LayoutPtr& layout1)
+ {
+ this->layout = layout1;
+ }
- /**
- Set the name of this Appender.
- */
- void setName(const LogString& name1)
- {
- this->name.assign(name1);
- }
+ /**
+ Set the name of this Appender.
+ */
+ void setName(const LogString& name1)
+ {
+ this->name.assign(name1);
+ }
- /**
- Set the threshold level. All log events with lower level
- than the threshold level are ignored by the appender.
+ /**
+ Set the threshold level. All log events with lower level
+ than the threshold level are ignored by the appender.
- <p>In configuration files this option is specified by setting the
- value of the <b>Threshold</b> option to a level
- string, such as "DEBUG", "INFO" and so on.
- */
- void setThreshold(const LevelPtr& threshold);
+ <p>In configuration files this option is specified by setting the
+ value of the <b>Threshold</b> option to a level
+ string, such as "DEBUG", "INFO" and so on.
+ */
+ void setThreshold(const LevelPtr& threshold);
}; // class AppenderSkeleton
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/asyncappender.h b/src/main/include/log4cxx/asyncappender.h
index a45cc78..fcd4cdf 100644
--- a/src/main/include/log4cxx/asyncappender.h
+++ b/src/main/include/log4cxx/asyncappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_ASYNC_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -33,7 +33,7 @@
#include <log4cxx/helpers/condition.h>
#if defined(NON_BLOCKING)
- #include <boost/lockfree/queue.hpp>
+ #include <boost/lockfree/queue.hpp>
#endif
namespace log4cxx
@@ -55,257 +55,257 @@
be script configured using the {@link xml::DOMConfigurator DOMConfigurator}.
*/
class LOG4CXX_EXPORT AsyncAppender :
- public virtual spi::AppenderAttachable,
- public virtual AppenderSkeleton
+ public virtual spi::AppenderAttachable,
+ public virtual AppenderSkeleton
{
- public:
- DECLARE_LOG4CXX_OBJECT(AsyncAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(AsyncAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(AsyncAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(AsyncAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Create new instance.
- */
- AsyncAppender();
+ /**
+ * Create new instance.
+ */
+ AsyncAppender();
- /**
- * Destructor.
- */
- virtual ~AsyncAppender();
+ /**
+ * Destructor.
+ */
+ virtual ~AsyncAppender();
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- /**
- * Add appender.
- *
- * @param newAppender appender to add, may not be null.
- */
- void addAppender(const AppenderPtr& newAppender);
+ /**
+ * Add appender.
+ *
+ * @param newAppender appender to add, may not be null.
+ */
+ void addAppender(const AppenderPtr& newAppender);
- virtual void doAppend(const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& pool1);
+ virtual void doAppend(const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& pool1);
- void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- /**
- Close this <code>AsyncAppender</code> by interrupting the
- dispatcher thread which will process all pending events before
- exiting.
- */
- void close();
+ /**
+ Close this <code>AsyncAppender</code> by interrupting the
+ dispatcher thread which will process all pending events before
+ exiting.
+ */
+ void close();
- /**
- * Get iterator over attached appenders.
- * @return list of all attached appenders.
- */
- AppenderList getAllAppenders() const;
+ /**
+ * Get iterator over attached appenders.
+ * @return list of all attached appenders.
+ */
+ AppenderList getAllAppenders() const;
- /**
- * Get appender by name.
- *
- * @param name name, may not be null.
- * @return matching appender or null.
- */
- AppenderPtr getAppender(const LogString& name) const;
+ /**
+ * Get appender by name.
+ *
+ * @param name name, may not be null.
+ * @return matching appender or null.
+ */
+ AppenderPtr getAppender(const LogString& name) const;
- /**
- * Gets whether the location of the logging request call
- * should be captured.
- *
- * @return the current value of the <b>LocationInfo</b> option.
- */
- bool getLocationInfo() const;
- /**
- * Determines if specified appender is attached.
- * @param appender appender.
- * @return true if attached.
- */
- bool isAttached(const AppenderPtr& appender) const;
+ /**
+ * Gets whether the location of the logging request call
+ * should be captured.
+ *
+ * @return the current value of the <b>LocationInfo</b> option.
+ */
+ bool getLocationInfo() const;
+ /**
+ * Determines if specified appender is attached.
+ * @param appender appender.
+ * @return true if attached.
+ */
+ bool isAttached(const AppenderPtr& appender) const;
- virtual bool requiresLayout() const;
+ virtual bool requiresLayout() const;
- /**
- * Removes and closes all attached appenders.
- */
- void removeAllAppenders();
+ /**
+ * Removes and closes all attached appenders.
+ */
+ void removeAllAppenders();
- /**
- * Removes an appender.
- * @param appender appender to remove.
- */
- void removeAppender(const AppenderPtr& appender);
- /**
- * Remove appender by name.
- * @param name name.
- */
- void removeAppender(const LogString& name);
+ /**
+ * Removes an appender.
+ * @param appender appender to remove.
+ */
+ void removeAppender(const AppenderPtr& appender);
+ /**
+ * Remove appender by name.
+ * @param name name.
+ */
+ void removeAppender(const LogString& name);
- /**
- * The <b>LocationInfo</b> attribute is provided for compatibility
- * with log4j and has no effect on the log output.
- * @param flag new value.
- */
- void setLocationInfo(bool flag);
+ /**
+ * The <b>LocationInfo</b> attribute is provided for compatibility
+ * with log4j and has no effect on the log output.
+ * @param flag new value.
+ */
+ void setLocationInfo(bool flag);
- /**
- * The <b>BufferSize</b> option takes a non-negative integer value.
- * This integer value determines the maximum size of the bounded
- * buffer.
- * */
- void setBufferSize(int size);
+ /**
+ * The <b>BufferSize</b> option takes a non-negative integer value.
+ * This integer value determines the maximum size of the bounded
+ * buffer.
+ * */
+ void setBufferSize(int size);
- /**
- * Gets the current buffer size.
- * @return the current value of the <b>BufferSize</b> option.
- */
- int getBufferSize() const;
+ /**
+ * Gets the current buffer size.
+ * @return the current value of the <b>BufferSize</b> option.
+ */
+ int getBufferSize() const;
- /**
- * Sets whether appender should wait if there is no
- * space available in the event buffer or immediately return.
- *
- * @param value true if appender should wait until available space in buffer.
- */
- void setBlocking(bool value);
+ /**
+ * Sets whether appender should wait if there is no
+ * space available in the event buffer or immediately return.
+ *
+ * @param value true if appender should wait until available space in buffer.
+ */
+ void setBlocking(bool value);
- /**
- * Gets whether appender should block calling thread when buffer is full.
- * If false, messages will be counted by logger and a summary
- * message appended after the contents of the buffer have been appended.
- *
- * @return true if calling thread will be blocked when buffer is full.
- */
- bool getBlocking() const;
+ /**
+ * Gets whether appender should block calling thread when buffer is full.
+ * If false, messages will be counted by logger and a summary
+ * message appended after the contents of the buffer have been appended.
+ *
+ * @return true if calling thread will be blocked when buffer is full.
+ */
+ bool getBlocking() const;
- /**
- * Set appender properties by name.
- * @param option property name.
- * @param value property value.
- */
- void setOption(const LogString& option, const LogString& value);
+ /**
+ * Set appender properties by name.
+ * @param option property name.
+ * @param value property value.
+ */
+ void setOption(const LogString& option, const LogString& value);
- private:
- AsyncAppender(const AsyncAppender&);
- AsyncAppender& operator=(const AsyncAppender&);
- /**
- * The default buffer size is set to 128 events.
- */
- enum { DEFAULT_BUFFER_SIZE = 128 };
+ private:
+ AsyncAppender(const AsyncAppender&);
+ AsyncAppender& operator=(const AsyncAppender&);
+ /**
+ * The default buffer size is set to 128 events.
+ */
+ enum { DEFAULT_BUFFER_SIZE = 128 };
- /**
- * Event buffer.
- */
+ /**
+ * Event buffer.
+ */
#if defined(NON_BLOCKING)
- boost::lockfree::queue<log4cxx::spi::LoggingEvent* > buffer;
- std::atomic<size_t> discardedCount;
+ boost::lockfree::queue<log4cxx::spi::LoggingEvent* > buffer;
+ std::atomic<size_t> discardedCount;
#else
- LoggingEventList buffer;
+ LoggingEventList buffer;
#endif
- /**
- * Mutex used to guard access to buffer and discardMap.
- */
- SHARED_MUTEX bufferMutex;
+ /**
+ * Mutex used to guard access to buffer and discardMap.
+ */
+ SHARED_MUTEX bufferMutex;
#if defined(NON_BLOCKING)
- ::log4cxx::helpers::Semaphore bufferNotFull;
- ::log4cxx::helpers::Semaphore bufferNotEmpty;
+ ::log4cxx::helpers::Semaphore bufferNotFull;
+ ::log4cxx::helpers::Semaphore bufferNotEmpty;
#else
- ::log4cxx::helpers::Condition bufferNotFull;
- ::log4cxx::helpers::Condition bufferNotEmpty;
+ ::log4cxx::helpers::Condition bufferNotFull;
+ ::log4cxx::helpers::Condition bufferNotEmpty;
#endif
- class DiscardSummary
- {
- private:
- /**
- * First event of the highest severity.
- */
- ::log4cxx::spi::LoggingEventPtr maxEvent;
+ class DiscardSummary
+ {
+ private:
+ /**
+ * First event of the highest severity.
+ */
+ ::log4cxx::spi::LoggingEventPtr maxEvent;
- /**
- * Total count of messages discarded.
- */
- int count;
+ /**
+ * Total count of messages discarded.
+ */
+ int count;
- public:
- /**
- * Create new instance.
- *
- * @param event event, may not be null.
- */
- DiscardSummary(const ::log4cxx::spi::LoggingEventPtr& event);
- /** Copy constructor. */
- DiscardSummary(const DiscardSummary& src);
- /** Assignment operator. */
- DiscardSummary& operator=(const DiscardSummary& src);
+ public:
+ /**
+ * Create new instance.
+ *
+ * @param event event, may not be null.
+ */
+ DiscardSummary(const ::log4cxx::spi::LoggingEventPtr& event);
+ /** Copy constructor. */
+ DiscardSummary(const DiscardSummary& src);
+ /** Assignment operator. */
+ DiscardSummary& operator=(const DiscardSummary& src);
- /**
- * Add discarded event to summary.
- *
- * @param event event, may not be null.
- */
- void add(const ::log4cxx::spi::LoggingEventPtr& event);
+ /**
+ * Add discarded event to summary.
+ *
+ * @param event event, may not be null.
+ */
+ void add(const ::log4cxx::spi::LoggingEventPtr& event);
- /**
- * Create event with summary information.
- *
- * @return new event.
- */
- ::log4cxx::spi::LoggingEventPtr createEvent(::log4cxx::helpers::Pool& p);
+ /**
+ * Create event with summary information.
+ *
+ * @return new event.
+ */
+ ::log4cxx::spi::LoggingEventPtr createEvent(::log4cxx::helpers::Pool& p);
- static
- ::log4cxx::spi::LoggingEventPtr createEvent(::log4cxx::helpers::Pool& p,
- size_t discardedCount);
- };
+ static
+ ::log4cxx::spi::LoggingEventPtr createEvent(::log4cxx::helpers::Pool& p,
+ size_t discardedCount);
+ };
- /**
- * Map of DiscardSummary objects keyed by logger name.
- */
- typedef std::map<LogString, DiscardSummary> DiscardMap;
- DiscardMap* discardMap;
+ /**
+ * Map of DiscardSummary objects keyed by logger name.
+ */
+ typedef std::map<LogString, DiscardSummary> DiscardMap;
+ DiscardMap* discardMap;
- /**
- * Buffer size.
- */
- int bufferSize;
+ /**
+ * Buffer size.
+ */
+ int bufferSize;
- /**
- * Nested appenders.
- */
- helpers::AppenderAttachableImplPtr appenders;
+ /**
+ * Nested appenders.
+ */
+ helpers::AppenderAttachableImplPtr appenders;
- /**
- * Dispatcher.
- */
- helpers::Thread dispatcher;
+ /**
+ * Dispatcher.
+ */
+ helpers::Thread dispatcher;
- /**
- * Should location info be included in dispatched messages.
- */
- bool locationInfo;
+ /**
+ * Should location info be included in dispatched messages.
+ */
+ bool locationInfo;
- /**
- * Does appender block when buffer is full.
- */
- bool blocking;
+ /**
+ * Does appender block when buffer is full.
+ */
+ bool blocking;
- /**
- * Dispatch routine.
- */
- static void* LOG4CXX_THREAD_FUNC dispatch(apr_thread_t* thread, void* data);
+ /**
+ * Dispatch routine.
+ */
+ static void* LOG4CXX_THREAD_FUNC dispatch(apr_thread_t* thread, void* data);
}; // class AsyncAppender
LOG4CXX_PTR_DEF(AsyncAppender);
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/basicconfigurator.h b/src/main/include/log4cxx/basicconfigurator.h
index 2f6f45f..739ecda 100644
--- a/src/main/include/log4cxx/basicconfigurator.h
+++ b/src/main/include/log4cxx/basicconfigurator.h
@@ -37,28 +37,28 @@
*/
class LOG4CXX_EXPORT BasicConfigurator
{
- protected:
- BasicConfigurator() {}
+ protected:
+ BasicConfigurator() {}
- public:
- /**
- Add a ConsoleAppender that uses PatternLayout
- using the PatternLayout#TTCC_CONVERSION_PATTERN and
- prints to <code>stdout</code> to the root logger.*/
- static void configure();
+ public:
+ /**
+ Add a ConsoleAppender that uses PatternLayout
+ using the PatternLayout#TTCC_CONVERSION_PATTERN and
+ prints to <code>stdout</code> to the root logger.*/
+ static void configure();
- /**
- Add <code>appender</code> to the root logger.
- @param appender The appender to add to the root logger.
- */
- static void configure(const AppenderPtr& appender);
+ /**
+ Add <code>appender</code> to the root logger.
+ @param appender The appender to add to the root logger.
+ */
+ static void configure(const AppenderPtr& appender);
- /**
- Reset the default hierarchy to its defaut. It is equivalent to
- calling
- <code>Logger::getDefaultHierarchy()->resetConfiguration()</code>.
- See Hierarchy#resetConfiguration() for more details. */
- static void resetConfiguration();
+ /**
+ Reset the default hierarchy to its defaut. It is equivalent to
+ calling
+ <code>Logger::getDefaultHierarchy()->resetConfiguration()</code>.
+ See Hierarchy#resetConfiguration() for more details. */
+ static void resetConfiguration();
}; // class BasicConfigurator
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/config/propertysetter.h b/src/main/include/log4cxx/config/propertysetter.h
index 5e1b74f..dcbf4ed 100644
--- a/src/main/include/log4cxx/config/propertysetter.h
+++ b/src/main/include/log4cxx/config/propertysetter.h
@@ -52,55 +52,55 @@
*/
class LOG4CXX_EXPORT PropertySetter
{
- protected:
- helpers::ObjectPtr obj;
+ protected:
+ helpers::ObjectPtr obj;
- public:
- /**
- Create a new PropertySetter for the specified Object. This is done
- in prepartion for invoking #setProperty one or more times.
+ public:
+ /**
+ Create a new PropertySetter for the specified Object. This is done
+ in prepartion for invoking #setProperty one or more times.
- @param obj the object for which to set properties
- */
- PropertySetter(const helpers::ObjectPtr& obj);
+ @param obj the object for which to set properties
+ */
+ PropertySetter(const helpers::ObjectPtr& obj);
- /**
- Set the properties of an object passed as a parameter in one
- go. The <code>properties</code> are parsed relative to a
- <code>prefix</code>.
+ /**
+ Set the properties of an object passed as a parameter in one
+ go. The <code>properties</code> are parsed relative to a
+ <code>prefix</code>.
- @param obj The object to configure.
- @param properties A java.util.Properties containing keys and values.
- @param prefix Only keys having the specified prefix will be set.
- @param p pool to use for any allocations required during call.
- */
- static void setProperties(const helpers::ObjectPtr& obj,
- helpers::Properties& properties,
- const LogString& prefix,
- log4cxx::helpers::Pool& p);
+ @param obj The object to configure.
+ @param properties A java.util.Properties containing keys and values.
+ @param prefix Only keys having the specified prefix will be set.
+ @param p pool to use for any allocations required during call.
+ */
+ static void setProperties(const helpers::ObjectPtr& obj,
+ helpers::Properties& properties,
+ const LogString& prefix,
+ log4cxx::helpers::Pool& p);
- /**
- Set the properites for the object that match the
- <code>prefix</code> passed as parameter.
- */
- void setProperties(helpers::Properties& properties,
- const LogString& prefix,
- log4cxx::helpers::Pool& p);
+ /**
+ Set the properites for the object that match the
+ <code>prefix</code> passed as parameter.
+ */
+ void setProperties(helpers::Properties& properties,
+ const LogString& prefix,
+ log4cxx::helpers::Pool& p);
- /**
- Set a property on this PropertySetter's Object. If the underlying
- Object supports the spi::OptionHandler interface, the
- {@link spi::OptionHandler#setOption setOption} method is called.
+ /**
+ Set a property on this PropertySetter's Object. If the underlying
+ Object supports the spi::OptionHandler interface, the
+ {@link spi::OptionHandler#setOption setOption} method is called.
- @param option name of the property
- @param value String value of the property
- @param p pool to use for any allocations required during call.
- */
- void setProperty(const LogString& option,
- const LogString& value,
- log4cxx::helpers::Pool& p);
+ @param option name of the property
+ @param value String value of the property
+ @param p pool to use for any allocations required during call.
+ */
+ void setProperty(const LogString& option,
+ const LogString& value,
+ log4cxx::helpers::Pool& p);
- void activate(log4cxx::helpers::Pool& p);
+ void activate(log4cxx::helpers::Pool& p);
}; // class PropertySetter
} // namespace config;
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/consoleappender.h b/src/main/include/log4cxx/consoleappender.h
index f6f92e2..d30fef4 100644
--- a/src/main/include/log4cxx/consoleappender.h
+++ b/src/main/include/log4cxx/consoleappender.h
@@ -30,45 +30,45 @@
*/
class LOG4CXX_EXPORT ConsoleAppender : public WriterAppender
{
- private:
- LogString target;
+ private:
+ LogString target;
- public:
- DECLARE_LOG4CXX_OBJECT(ConsoleAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ConsoleAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(ConsoleAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ConsoleAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- ConsoleAppender();
- ConsoleAppender(const LayoutPtr& layout);
- ConsoleAppender(const LayoutPtr& layout, const LogString& target);
- ~ConsoleAppender();
+ ConsoleAppender();
+ ConsoleAppender(const LayoutPtr& layout);
+ ConsoleAppender(const LayoutPtr& layout, const LogString& target);
+ ~ConsoleAppender();
- /**
- * Sets the value of the <b>target</b> property. Recognized values
- * are "System.out" and "System.err". Any other value will be
- * ignored.
- * */
- void setTarget(const LogString& value);
+ /**
+ * Sets the value of the <b>target</b> property. Recognized values
+ * are "System.out" and "System.err". Any other value will be
+ * ignored.
+ * */
+ void setTarget(const LogString& value);
- /**
- * Returns the current value of the <b>target</b> property. The
- * default value of the option is "System.out".
- *
- * See also #setTarget.
- * */
- LogString getTarget() const;
+ /**
+ * Returns the current value of the <b>target</b> property. The
+ * default value of the option is "System.out".
+ *
+ * See also #setTarget.
+ * */
+ LogString getTarget() const;
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option, const LogString& value);
- static const LogString& getSystemOut();
- static const LogString& getSystemErr();
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option, const LogString& value);
+ static const LogString& getSystemOut();
+ static const LogString& getSystemErr();
- private:
- void targetWarn(const LogString& val);
+ private:
+ void targetWarn(const LogString& val);
};
LOG4CXX_PTR_DEF(ConsoleAppender);
diff --git a/src/main/include/log4cxx/dailyrollingfileappender.h b/src/main/include/log4cxx/dailyrollingfileappender.h
index 24f2401..2ace32d 100644
--- a/src/main/include/log4cxx/dailyrollingfileappender.h
+++ b/src/main/include/log4cxx/dailyrollingfileappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_DAILYROLLINGFILEAPPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -145,53 +145,53 @@
class LOG4CXX_EXPORT DailyRollingFileAppender : public log4cxx::rolling::RollingFileAppenderSkeleton
{
- DECLARE_LOG4CXX_OBJECT(DailyRollingFileAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DailyRollingFileAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(DailyRollingFileAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DailyRollingFileAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
+ END_LOG4CXX_CAST_MAP()
- /**
- The date pattern used to initiate rollover.
- */
- LogString datePattern;
+ /**
+ The date pattern used to initiate rollover.
+ */
+ LogString datePattern;
- public:
- /**
- The default constructor simply calls its {@link
- FileAppender#FileAppender parents constructor}. */
- DailyRollingFileAppender();
+ public:
+ /**
+ The default constructor simply calls its {@link
+ FileAppender#FileAppender parents constructor}. */
+ DailyRollingFileAppender();
- /**
- Instantiate a DailyRollingFileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the ouput
- destination for this appender.
+ /**
+ Instantiate a DailyRollingFileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the ouput
+ destination for this appender.
- */
- DailyRollingFileAppender(
- const LayoutPtr& layout,
- const LogString& filename,
- const LogString& datePattern);
+ */
+ DailyRollingFileAppender(
+ const LayoutPtr& layout,
+ const LogString& filename,
+ const LogString& datePattern);
- /**
- The <b>DatePattern</b> takes a string in the same format as
- expected by {@link log4cxx::helpers::SimpleDateFormat SimpleDateFormat}. This options determines the
- rollover schedule.
- */
- void setDatePattern(const LogString& pattern);
+ /**
+ The <b>DatePattern</b> takes a string in the same format as
+ expected by {@link log4cxx::helpers::SimpleDateFormat SimpleDateFormat}. This options determines the
+ rollover schedule.
+ */
+ void setDatePattern(const LogString& pattern);
- /** Returns the value of the <b>DatePattern</b> option. */
- LogString getDatePattern();
+ /** Returns the value of the <b>DatePattern</b> option. */
+ LogString getDatePattern();
- void setOption(const LogString& option,
- const LogString& value);
+ void setOption(const LogString& option,
+ const LogString& value);
- /**
- * Prepares DailyRollingFileAppender for use.
- */
- void activateOptions(log4cxx::helpers::Pool&);
+ /**
+ * Prepares DailyRollingFileAppender for use.
+ */
+ void activateOptions(log4cxx::helpers::Pool&);
};
@@ -200,7 +200,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/db/odbcappender.h b/src/main/include/log4cxx/db/odbcappender.h
index d3bbb1b..a26bc35 100644
--- a/src/main/include/log4cxx/db/odbcappender.h
+++ b/src/main/include/log4cxx/db/odbcappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_DB_ODBC_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -37,16 +37,16 @@
{
class LOG4CXX_EXPORT SQLException : public log4cxx::helpers::Exception
{
- public:
- SQLException(short fHandleType,
- void* hInput, const char* prolog,
- log4cxx::helpers::Pool& p);
- SQLException(const char* msg);
- SQLException(const SQLException& src);
- private:
- const char* formatMessage(short fHandleType,
- void* hInput, const char* prolog,
- log4cxx::helpers::Pool& p);
+ public:
+ SQLException(short fHandleType,
+ void* hInput, const char* prolog,
+ log4cxx::helpers::Pool& p);
+ SQLException(const char* msg);
+ SQLException(const SQLException& src);
+ private:
+ const char* formatMessage(short fHandleType,
+ void* hInput, const char* prolog,
+ log4cxx::helpers::Pool& p);
};
/**
@@ -97,213 +97,213 @@
class LOG4CXX_EXPORT ODBCAppender : public AppenderSkeleton
{
- protected:
- /**
- * URL of the DB for default connection handling
- */
- LogString databaseURL;
+ protected:
+ /**
+ * URL of the DB for default connection handling
+ */
+ LogString databaseURL;
- /**
- * User to connect as for default connection handling
- */
- LogString databaseUser;
+ /**
+ * User to connect as for default connection handling
+ */
+ LogString databaseUser;
- /**
- * User to use for default connection handling
- */
- LogString databasePassword;
+ /**
+ * User to use for default connection handling
+ */
+ LogString databasePassword;
- typedef void* SQLHDBC;
- typedef void* SQLHENV;
- typedef void* SQLHANDLE;
- typedef short SQLSMALLINT;
+ typedef void* SQLHDBC;
+ typedef void* SQLHENV;
+ typedef void* SQLHANDLE;
+ typedef short SQLSMALLINT;
- /**
- * Connection used by default. The connection is opened the first time it
- * is needed and then held open until the appender is closed (usually at
- * garbage collection). This behavior is best modified by creating a
- * sub-class and overriding the <code>getConnection</code> and
- * <code>closeConnection</code> methods.
- */
- SQLHDBC connection;
- SQLHENV env;
+ /**
+ * Connection used by default. The connection is opened the first time it
+ * is needed and then held open until the appender is closed (usually at
+ * garbage collection). This behavior is best modified by creating a
+ * sub-class and overriding the <code>getConnection</code> and
+ * <code>closeConnection</code> methods.
+ */
+ SQLHDBC connection;
+ SQLHENV env;
- /**
- * Stores the string given to the pattern layout for conversion into a SQL
- * statement, eg: insert into LogTable (Thread, File, Message) values
- * ("%t", "%F", "%m")
- *
- * Be careful of quotes in your messages!
- *
- * Also see PatternLayout.
- */
- LogString sqlStatement;
+ /**
+ * Stores the string given to the pattern layout for conversion into a SQL
+ * statement, eg: insert into LogTable (Thread, File, Message) values
+ * ("%t", "%F", "%m")
+ *
+ * Be careful of quotes in your messages!
+ *
+ * Also see PatternLayout.
+ */
+ LogString sqlStatement;
- /**
- * size of LoggingEvent buffer before writing to the database.
- * Default is 1.
- */
- size_t bufferSize;
+ /**
+ * size of LoggingEvent buffer before writing to the database.
+ * Default is 1.
+ */
+ size_t bufferSize;
- /**
- * ArrayList holding the buffer of Logging Events.
- */
- std::list<spi::LoggingEventPtr> buffer;
+ /**
+ * ArrayList holding the buffer of Logging Events.
+ */
+ std::list<spi::LoggingEventPtr> buffer;
- public:
- DECLARE_LOG4CXX_OBJECT(ODBCAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ODBCAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(ODBCAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ODBCAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- ODBCAppender();
- virtual ~ODBCAppender();
+ ODBCAppender();
+ virtual ~ODBCAppender();
- /**
- Set options
- */
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- Activate the specified options.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& p);
+ /**
+ Activate the specified options.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
- /**
- * Adds the event to the buffer. When full the buffer is flushed.
- */
- void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool&);
+ /**
+ * Adds the event to the buffer. When full the buffer is flushed.
+ */
+ void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool&);
- /**
- * By default getLogStatement sends the event to the required Layout object.
- * The layout will format the given pattern into a workable SQL string.
- *
- * Overriding this provides direct access to the LoggingEvent
- * when constructing the logging statement.
- *
- */
- protected:
- LogString getLogStatement(const spi::LoggingEventPtr& event,
- helpers::Pool& p) const;
+ /**
+ * By default getLogStatement sends the event to the required Layout object.
+ * The layout will format the given pattern into a workable SQL string.
+ *
+ * Overriding this provides direct access to the LoggingEvent
+ * when constructing the logging statement.
+ *
+ */
+ protected:
+ LogString getLogStatement(const spi::LoggingEventPtr& event,
+ helpers::Pool& p) const;
- /**
- *
- * Override this to provide an alertnate method of getting
- * connections (such as caching). One method to fix this is to open
- * connections at the start of flushBuffer() and close them at the
- * end. I use a connection pool outside of ODBCAppender which is
- * accessed in an override of this method.
- * */
- virtual void execute(const LogString& sql,
- log4cxx::helpers::Pool& p) /*throw(SQLException)*/;
+ /**
+ *
+ * Override this to provide an alertnate method of getting
+ * connections (such as caching). One method to fix this is to open
+ * connections at the start of flushBuffer() and close them at the
+ * end. I use a connection pool outside of ODBCAppender which is
+ * accessed in an override of this method.
+ * */
+ virtual void execute(const LogString& sql,
+ log4cxx::helpers::Pool& p) /*throw(SQLException)*/;
- /**
- * Override this to return the connection to a pool, or to clean up the
- * resource.
- *
- * The default behavior holds a single connection open until the appender
- * is closed (typically when garbage collected).
- */
- virtual void closeConnection(SQLHDBC con);
+ /**
+ * Override this to return the connection to a pool, or to clean up the
+ * resource.
+ *
+ * The default behavior holds a single connection open until the appender
+ * is closed (typically when garbage collected).
+ */
+ virtual void closeConnection(SQLHDBC con);
- /**
- * Override this to link with your connection pooling system.
- *
- * By default this creates a single connection which is held open
- * until the object is garbage collected.
- */
- virtual SQLHDBC getConnection(log4cxx::helpers::Pool& p) /*throw(SQLException)*/;
+ /**
+ * Override this to link with your connection pooling system.
+ *
+ * By default this creates a single connection which is held open
+ * until the object is garbage collected.
+ */
+ virtual SQLHDBC getConnection(log4cxx::helpers::Pool& p) /*throw(SQLException)*/;
- /**
- * Closes the appender, flushing the buffer first then closing the default
- * connection if it is open.
- */
- public:
- virtual void close();
+ /**
+ * Closes the appender, flushing the buffer first then closing the default
+ * connection if it is open.
+ */
+ public:
+ virtual void close();
- /**
- * loops through the buffer of LoggingEvents, gets a
- * sql string from getLogStatement() and sends it to execute().
- * Errors are sent to the errorHandler.
- *
- * If a statement fails the LoggingEvent stays in the buffer!
- */
- virtual void flushBuffer(log4cxx::helpers::Pool& p);
+ /**
+ * loops through the buffer of LoggingEvents, gets a
+ * sql string from getLogStatement() and sends it to execute().
+ * Errors are sent to the errorHandler.
+ *
+ * If a statement fails the LoggingEvent stays in the buffer!
+ */
+ virtual void flushBuffer(log4cxx::helpers::Pool& p);
- /**
- * ODBCAppender requires a layout.
- * */
- virtual bool requiresLayout() const
- {
- return true;
- }
+ /**
+ * ODBCAppender requires a layout.
+ * */
+ virtual bool requiresLayout() const
+ {
+ return true;
+ }
- /**
- * Set pre-formated statement eg: insert into LogTable (msg) values ("%m")
- */
- void setSql(const LogString& s);
+ /**
+ * Set pre-formated statement eg: insert into LogTable (msg) values ("%m")
+ */
+ void setSql(const LogString& s);
- /**
- * Returns pre-formated statement eg: insert into LogTable (msg) values ("%m")
- */
- inline const LogString& getSql() const
- {
- return sqlStatement;
- }
+ /**
+ * Returns pre-formated statement eg: insert into LogTable (msg) values ("%m")
+ */
+ inline const LogString& getSql() const
+ {
+ return sqlStatement;
+ }
- inline void setUser(const LogString& user)
- {
- databaseUser = user;
- }
+ inline void setUser(const LogString& user)
+ {
+ databaseUser = user;
+ }
- inline void setURL(const LogString& url)
- {
- databaseURL = url;
- }
+ inline void setURL(const LogString& url)
+ {
+ databaseURL = url;
+ }
- inline void setPassword(const LogString& password)
- {
- databasePassword = password;
- }
+ inline void setPassword(const LogString& password)
+ {
+ databasePassword = password;
+ }
- inline void setBufferSize(size_t newBufferSize)
- {
- bufferSize = newBufferSize;
- }
+ inline void setBufferSize(size_t newBufferSize)
+ {
+ bufferSize = newBufferSize;
+ }
- inline const LogString& getUser() const
- {
- return databaseUser;
- }
+ inline const LogString& getUser() const
+ {
+ return databaseUser;
+ }
- inline const LogString& getURL() const
- {
- return databaseURL;
- }
+ inline const LogString& getURL() const
+ {
+ return databaseURL;
+ }
- inline const LogString& getPassword() const
- {
- return databasePassword;
- }
+ inline const LogString& getPassword() const
+ {
+ return databasePassword;
+ }
- inline size_t getBufferSize() const
- {
- return bufferSize;
- }
- private:
- ODBCAppender(const ODBCAppender&);
- ODBCAppender& operator=(const ODBCAppender&);
- static void encode(wchar_t** dest, const LogString& src,
- log4cxx::helpers::Pool& p);
- static void encode(unsigned short** dest, const LogString& src,
- log4cxx::helpers::Pool& p);
+ inline size_t getBufferSize() const
+ {
+ return bufferSize;
+ }
+ private:
+ ODBCAppender(const ODBCAppender&);
+ ODBCAppender& operator=(const ODBCAppender&);
+ static void encode(wchar_t** dest, const LogString& src,
+ log4cxx::helpers::Pool& p);
+ static void encode(unsigned short** dest, const LogString& src,
+ log4cxx::helpers::Pool& p);
}; // class ODBCAppender
LOG4CXX_PTR_DEF(ODBCAppender);
@@ -311,7 +311,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_DB_ODBC_APPENDER_H
diff --git a/src/main/include/log4cxx/defaultconfigurator.h b/src/main/include/log4cxx/defaultconfigurator.h
index 56c17c0..615937e 100644
--- a/src/main/include/log4cxx/defaultconfigurator.h
+++ b/src/main/include/log4cxx/defaultconfigurator.h
@@ -34,19 +34,19 @@
*/
class LOG4CXX_EXPORT DefaultConfigurator
{
- private:
- DefaultConfigurator() {}
+ private:
+ DefaultConfigurator() {}
- public:
- /**
- Add a ConsoleAppender that uses PatternLayout
- using the PatternLayout#TTCC_CONVERSION_PATTERN and
- prints to <code>stdout</code> to the root logger.*/
- static void configure(log4cxx::spi::LoggerRepository*);
+ public:
+ /**
+ Add a ConsoleAppender that uses PatternLayout
+ using the PatternLayout#TTCC_CONVERSION_PATTERN and
+ prints to <code>stdout</code> to the root logger.*/
+ static void configure(log4cxx::spi::LoggerRepository*);
- private:
- static const LogString getConfigurationFileName();
- static const LogString getConfiguratorClass();
+ private:
+ static const LogString getConfigurationFileName();
+ static const LogString getConfiguratorClass();
diff --git a/src/main/include/log4cxx/defaultloggerfactory.h b/src/main/include/log4cxx/defaultloggerfactory.h
index 6de3677..ba9255e 100644
--- a/src/main/include/log4cxx/defaultloggerfactory.h
+++ b/src/main/include/log4cxx/defaultloggerfactory.h
@@ -27,18 +27,18 @@
typedef helpers::ObjectPtrT<Logger> LoggerPtr;
class LOG4CXX_EXPORT DefaultLoggerFactory :
- public virtual spi::LoggerFactory,
- public virtual helpers::ObjectImpl
+ public virtual spi::LoggerFactory,
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(DefaultLoggerFactory)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(spi::LoggerFactory)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(DefaultLoggerFactory)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(spi::LoggerFactory)
+ END_LOG4CXX_CAST_MAP()
- virtual LoggerPtr makeNewLoggerInstance(
- log4cxx::helpers::Pool& pool,
- const LogString& name) const;
+ virtual LoggerPtr makeNewLoggerInstance(
+ log4cxx::helpers::Pool& pool,
+ const LogString& name) const;
};
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/file.h b/src/main/include/log4cxx/file.h
index c7ad9cd..13847d5 100644
--- a/src/main/include/log4cxx/file.h
+++ b/src/main/include/log4cxx/file.h
@@ -22,8 +22,8 @@
#include <log4cxx/logstring.h>
extern "C" {
- struct apr_file_t;
- struct apr_finfo_t;
+ struct apr_file_t;
+ struct apr_finfo_t;
}
namespace log4cxx
@@ -39,147 +39,147 @@
*/
class LOG4CXX_EXPORT File
{
- public:
- /**
- * Construct a new instance.
- */
- File();
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path in local encoding.
- */
- File(const char* path);
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path in current encoding.
- */
- File(const std::string& path);
+ public:
+ /**
+ * Construct a new instance.
+ */
+ File();
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path in local encoding.
+ */
+ File(const char* path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path in current encoding.
+ */
+ File(const std::string& path);
#if LOG4CXX_WCHAR_T_API
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path.
- */
- File(const wchar_t* path);
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path.
- */
- File(const std::wstring& path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path.
+ */
+ File(const wchar_t* path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path.
+ */
+ File(const std::wstring& path);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path.
- */
- File(const UniChar* path);
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path.
- */
- File(const std::basic_string<UniChar>& path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path.
+ */
+ File(const UniChar* path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path.
+ */
+ File(const std::basic_string<UniChar>& path);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- * Construct a new instance. Use setPath to specify path using a LogString.
- * @param path file path.
- */
- File(const CFStringRef& path);
+ /**
+ * Construct a new instance. Use setPath to specify path using a LogString.
+ * @param path file path.
+ */
+ File(const CFStringRef& path);
#endif
- /**
- * Copy constructor.
- */
- File(const File& src);
- /**
- * Assignment operator.
- */
- File& operator=(const File& src);
- /**
- * Destructor.
- */
- ~File();
+ /**
+ * Copy constructor.
+ */
+ File(const File& src);
+ /**
+ * Assignment operator.
+ */
+ File& operator=(const File& src);
+ /**
+ * Destructor.
+ */
+ ~File();
- /**
- * Determines if file exists.
- * @param p pool.
- * @return true if file exists.
- */
- bool exists(log4cxx::helpers::Pool& p) const;
- /**
- * Determines length of file. May not be accurate if file is current open.
- * @param p pool.
- * @return length of file.
- */
- size_t length(log4cxx::helpers::Pool& p) const;
- /**
- * Determines last modification date.
- * @param p pool.
- * @return length of file.
- */
- log4cxx_time_t lastModified(log4cxx::helpers::Pool& p) const;
- /**
- * Get final portion of file path.
- * @return file name.
- */
- LogString getName() const;
- /**
- * Get file path.
- * @return file path.
- */
- LogString getPath() const;
- /**
- * Set file path
- */
- File& setPath(const LogString&);
+ /**
+ * Determines if file exists.
+ * @param p pool.
+ * @return true if file exists.
+ */
+ bool exists(log4cxx::helpers::Pool& p) const;
+ /**
+ * Determines length of file. May not be accurate if file is current open.
+ * @param p pool.
+ * @return length of file.
+ */
+ size_t length(log4cxx::helpers::Pool& p) const;
+ /**
+ * Determines last modification date.
+ * @param p pool.
+ * @return length of file.
+ */
+ log4cxx_time_t lastModified(log4cxx::helpers::Pool& p) const;
+ /**
+ * Get final portion of file path.
+ * @return file name.
+ */
+ LogString getName() const;
+ /**
+ * Get file path.
+ * @return file path.
+ */
+ LogString getPath() const;
+ /**
+ * Set file path
+ */
+ File& setPath(const LogString&);
- /**
- * Open file. See apr_file_open for details.
- * @param file APR file handle.
- * @param flags flags.
- * @param perm permissions.
- * @param p pool.
- * @return APR_SUCCESS if successful.
- */
- log4cxx_status_t open(apr_file_t** file, int flags,
- int perm, log4cxx::helpers::Pool& p) const;
+ /**
+ * Open file. See apr_file_open for details.
+ * @param file APR file handle.
+ * @param flags flags.
+ * @param perm permissions.
+ * @param p pool.
+ * @return APR_SUCCESS if successful.
+ */
+ log4cxx_status_t open(apr_file_t** file, int flags,
+ int perm, log4cxx::helpers::Pool& p) const;
- /**
- * List files if current file is a directory.
- * @param p pool.
- * @return list of files in this directory, operation of non-directory returns empty list.
- */
- std::vector<LogString> list(log4cxx::helpers::Pool& p) const;
+ /**
+ * List files if current file is a directory.
+ * @param p pool.
+ * @return list of files in this directory, operation of non-directory returns empty list.
+ */
+ std::vector<LogString> list(log4cxx::helpers::Pool& p) const;
- /**
- * Delete file.
- * @param p pool.
- * @return true if file successfully deleted.
- */
- bool deleteFile(log4cxx::helpers::Pool& p) const;
- /**
- * Rename file.
- * @param dest new path for file.
- * @param p pool.
- * @return true if file successfully renamed.
- */
- bool renameTo(const File& dest, log4cxx::helpers::Pool& p) const;
+ /**
+ * Delete file.
+ * @param p pool.
+ * @return true if file successfully deleted.
+ */
+ bool deleteFile(log4cxx::helpers::Pool& p) const;
+ /**
+ * Rename file.
+ * @param dest new path for file.
+ * @param p pool.
+ * @return true if file successfully renamed.
+ */
+ bool renameTo(const File& dest, log4cxx::helpers::Pool& p) const;
- /**
- * Get path of parent directory.
- * @param p pool.
- * @return path of parent directory.
- */
- LogString getParent(log4cxx::helpers::Pool& p) const;
- /**
- * Make directories recursively.
- * @param p pool.
- * @return true if all requested directories existed or have been created.
- */
- bool mkdirs(log4cxx::helpers::Pool& p) const;
+ /**
+ * Get path of parent directory.
+ * @param p pool.
+ * @return path of parent directory.
+ */
+ LogString getParent(log4cxx::helpers::Pool& p) const;
+ /**
+ * Make directories recursively.
+ * @param p pool.
+ * @return true if all requested directories existed or have been created.
+ */
+ bool mkdirs(log4cxx::helpers::Pool& p) const;
- private:
- LogString path;
- static char* convertBackSlashes(char*);
- char* getPath(log4cxx::helpers::Pool& p) const;
+ private:
+ LogString path;
+ static char* convertBackSlashes(char*);
+ char* getPath(log4cxx::helpers::Pool& p) const;
};
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/fileappender.h b/src/main/include/log4cxx/fileappender.h
index 1693a7d..468f135 100644
--- a/src/main/include/log4cxx/fileappender.h
+++ b/src/main/include/log4cxx/fileappender.h
@@ -40,196 +40,196 @@
*/
class LOG4CXX_EXPORT FileAppender : public WriterAppender
{
- protected:
- /** Append to or truncate the file? The default value for this
- variable is <code>true</code>, meaning that by default a
- <code>FileAppender</code> will append to an existing file and
- not truncate it.
- <p>This option is meaningful only if the FileAppender opens the
- file.
- */
- bool fileAppend;
+ protected:
+ /** Append to or truncate the file? The default value for this
+ variable is <code>true</code>, meaning that by default a
+ <code>FileAppender</code> will append to an existing file and
+ not truncate it.
+ <p>This option is meaningful only if the FileAppender opens the
+ file.
+ */
+ bool fileAppend;
- /**
- The name of the log file. */
- LogString fileName;
+ /**
+ The name of the log file. */
+ LogString fileName;
- /**
- Do we do bufferedIO? */
- bool bufferedIO;
+ /**
+ Do we do bufferedIO? */
+ bool bufferedIO;
- /**
- How big should the IO buffer be? Default is 8K. */
- int bufferSize;
+ /**
+ How big should the IO buffer be? Default is 8K. */
+ int bufferSize;
- public:
- DECLARE_LOG4CXX_OBJECT(FileAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FileAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(WriterAppender)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(FileAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FileAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(WriterAppender)
+ END_LOG4CXX_CAST_MAP()
- /**
- The default constructor does not do anything.
- */
- FileAppender();
+ /**
+ The default constructor does not do anything.
+ */
+ FileAppender();
- /**
- Instantiate a <code>FileAppender</code> and open the file
- designated by <code>filename</code>. The opened filename will
- become the output destination for this appender.
+ /**
+ Instantiate a <code>FileAppender</code> and open the file
+ designated by <code>filename</code>. The opened filename will
+ become the output destination for this appender.
- <p>If the <code>append</code> parameter is true, the file will be
- appended to. Otherwise, the file designated by
- <code>filename</code> will be truncated before being opened.
+ <p>If the <code>append</code> parameter is true, the file will be
+ appended to. Otherwise, the file designated by
+ <code>filename</code> will be truncated before being opened.
- <p>If the <code>bufferedIO</code> parameter is <code>true</code>,
- then buffered IO will be used to write to the output file.
+ <p>If the <code>bufferedIO</code> parameter is <code>true</code>,
+ then buffered IO will be used to write to the output file.
- */
- FileAppender(const LayoutPtr& layout, const LogString& filename, bool append,
- bool bufferedIO, int bufferSize);
+ */
+ FileAppender(const LayoutPtr& layout, const LogString& filename, bool append,
+ bool bufferedIO, int bufferSize);
- /**
- Instantiate a FileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the output
- destination for this appender.
+ /**
+ Instantiate a FileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the output
+ destination for this appender.
- <p>If the <code>append</code> parameter is true, the file will be
- appended to. Otherwise, the file designated by
- <code>filename</code> will be truncated before being opened.
- */
- FileAppender(const LayoutPtr& layout, const LogString& filename, bool append);
+ <p>If the <code>append</code> parameter is true, the file will be
+ appended to. Otherwise, the file designated by
+ <code>filename</code> will be truncated before being opened.
+ */
+ FileAppender(const LayoutPtr& layout, const LogString& filename, bool append);
- /**
- Instantiate a FileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the output
- destination for this appender.
+ /**
+ Instantiate a FileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the output
+ destination for this appender.
- <p>The file will be appended to. */
- FileAppender(const LayoutPtr& layout, const LogString& filename);
+ <p>The file will be appended to. */
+ FileAppender(const LayoutPtr& layout, const LogString& filename);
- ~FileAppender();
+ ~FileAppender();
- /**
- The <b>File</b> property takes a string value which should be the
- name of the file to append to.
+ /**
+ The <b>File</b> property takes a string value which should be the
+ name of the file to append to.
- <p><b>Note that the special values
- "System.out" or "System.err" are no longer honored.</b>
+ <p><b>Note that the special values
+ "System.out" or "System.err" are no longer honored.</b>
- <p>Note: Actual opening of the file is made when
- #activateOptions is called, not when the options are set. */
- virtual void setFile(const LogString& file);
+ <p>Note: Actual opening of the file is made when
+ #activateOptions is called, not when the options are set. */
+ virtual void setFile(const LogString& file);
- /**
- Sets and <i>opens</i> the file where the log output will
- go. The specified file must be writable.
+ /**
+ Sets and <i>opens</i> the file where the log output will
+ go. The specified file must be writable.
- <p>If there was already an opened file, then the previous file
- is closed first.
+ <p>If there was already an opened file, then the previous file
+ is closed first.
- <p><b>Do not use this method directly. To configure a FileAppender
- or one of its subclasses, set its properties one by one and then
- call activateOptions.</b>
+ <p><b>Do not use this method directly. To configure a FileAppender
+ or one of its subclasses, set its properties one by one and then
+ call activateOptions.</b>
- @param file The path to the log file.
- @param append If true will append to fileName. Otherwise will
- truncate fileName.
- @param bufferedIO Do we do bufferedIO?
- @param bufferSize How big should the IO buffer be?
- @param p memory pool for operation.
- */
- virtual void setFile(const LogString& file, bool append,
- bool bufferedIO, size_t bufferSize,
- log4cxx::helpers::Pool& p);
+ @param file The path to the log file.
+ @param append If true will append to fileName. Otherwise will
+ truncate fileName.
+ @param bufferedIO Do we do bufferedIO?
+ @param bufferSize How big should the IO buffer be?
+ @param p memory pool for operation.
+ */
+ virtual void setFile(const LogString& file, bool append,
+ bool bufferedIO, size_t bufferSize,
+ log4cxx::helpers::Pool& p);
- /**
- Returns the value of the <b>Append</b> option.
- */
- inline bool getAppend() const
- {
- return fileAppend;
- }
+ /**
+ Returns the value of the <b>Append</b> option.
+ */
+ inline bool getAppend() const
+ {
+ return fileAppend;
+ }
- /** Returns the value of the <b>File</b> option. */
- inline LogString getFile() const
- {
- return fileName;
- }
+ /** Returns the value of the <b>File</b> option. */
+ inline LogString getFile() const
+ {
+ return fileName;
+ }
- /**
- <p>Sets and <i>opens</i> the file where the log output will
- go. The specified file must be writable.
+ /**
+ <p>Sets and <i>opens</i> the file where the log output will
+ go. The specified file must be writable.
- <p>If there was already an opened file, then the previous file
- is closed first.*/
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option,
- const LogString& value);
+ <p>If there was already an opened file, then the previous file
+ is closed first.*/
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option,
+ const LogString& value);
- /**
- Get the value of the <b>BufferedIO</b> option.
+ /**
+ Get the value of the <b>BufferedIO</b> option.
- <p>BufferedIO will significatnly increase performance on heavily
- loaded systems.
+ <p>BufferedIO will significatnly increase performance on heavily
+ loaded systems.
- */
- inline bool getBufferedIO() const
- {
- return bufferedIO;
- }
+ */
+ inline bool getBufferedIO() const
+ {
+ return bufferedIO;
+ }
- /**
- Get the size of the IO buffer.
- */
- inline int getBufferSize() const
- {
- return bufferSize;
- }
+ /**
+ Get the size of the IO buffer.
+ */
+ inline int getBufferSize() const
+ {
+ return bufferSize;
+ }
- /**
- The <b>Append</b> option takes a boolean value. It is set to
- <code>true</code> by default. If true, then <code>File</code>
- will be opened in append mode by #setFile (see
- above). Otherwise, setFile will open
- <code>File</code> in truncate mode.
+ /**
+ The <b>Append</b> option takes a boolean value. It is set to
+ <code>true</code> by default. If true, then <code>File</code>
+ will be opened in append mode by #setFile (see
+ above). Otherwise, setFile will open
+ <code>File</code> in truncate mode.
- <p>Note: Actual opening of the file is made when
- #activateOptions is called, not when the options are set.
- */
- void setAppend(bool fileAppend1);
+ <p>Note: Actual opening of the file is made when
+ #activateOptions is called, not when the options are set.
+ */
+ void setAppend(bool fileAppend1);
- /**
- The <b>BufferedIO</b> option takes a boolean value. It is set to
- <code>false</code> by default. If true, then <code>File</code>
- will be opened in buffered mode.
+ /**
+ The <b>BufferedIO</b> option takes a boolean value. It is set to
+ <code>false</code> by default. If true, then <code>File</code>
+ will be opened in buffered mode.
- BufferedIO will significantly increase performance on heavily
- loaded systems.
+ BufferedIO will significantly increase performance on heavily
+ loaded systems.
- */
- void setBufferedIO(bool bufferedIO);
+ */
+ void setBufferedIO(bool bufferedIO);
- /**
- Set the size of the IO buffer.
- */
- void setBufferSize(int bufferSize1)
- {
- this->bufferSize = bufferSize1;
- }
+ /**
+ Set the size of the IO buffer.
+ */
+ void setBufferSize(int bufferSize1)
+ {
+ this->bufferSize = bufferSize1;
+ }
- /**
- * Replaces double backslashes with single backslashes
- * for compatibility with paths from earlier XML configurations files.
- * @param name file name
- * @return corrected file name
- */
- static LogString stripDuplicateBackslashes(const LogString& name);
+ /**
+ * Replaces double backslashes with single backslashes
+ * for compatibility with paths from earlier XML configurations files.
+ * @param name file name
+ * @return corrected file name
+ */
+ static LogString stripDuplicateBackslashes(const LogString& name);
- private:
- FileAppender(const FileAppender&);
- FileAppender& operator=(const FileAppender&);
+ private:
+ FileAppender(const FileAppender&);
+ FileAppender& operator=(const FileAppender&);
}; // class FileAppender
LOG4CXX_PTR_DEF(FileAppender);
diff --git a/src/main/include/log4cxx/filter/andfilter.h b/src/main/include/log4cxx/filter/andfilter.h
index 9ddb5ac..1a90db0 100644
--- a/src/main/include/log4cxx/filter/andfilter.h
+++ b/src/main/include/log4cxx/filter/andfilter.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_FILTER_ANDFILTER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -76,27 +76,27 @@
*/
class LOG4CXX_EXPORT AndFilter: public log4cxx::spi::Filter
{
- private:
- log4cxx::spi::FilterPtr headFilter;
- log4cxx::spi::FilterPtr tailFilter;
- bool acceptOnMatch;
- AndFilter(const AndFilter&);
- AndFilter& operator=(const AndFilter&);
+ private:
+ log4cxx::spi::FilterPtr headFilter;
+ log4cxx::spi::FilterPtr tailFilter;
+ bool acceptOnMatch;
+ AndFilter(const AndFilter&);
+ AndFilter& operator=(const AndFilter&);
- public:
- DECLARE_LOG4CXX_OBJECT(AndFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(AndFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
+ END_LOG4CXX_CAST_MAP()
- AndFilter();
+ AndFilter();
- void addFilter(const log4cxx::spi::FilterPtr& filter);
+ void addFilter(const log4cxx::spi::FilterPtr& filter);
- void setAcceptOnMatch(bool acceptOnMatch);
+ void setAcceptOnMatch(bool acceptOnMatch);
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
};
LOG4CXX_PTR_DEF(AndFilter);
@@ -104,7 +104,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif
diff --git a/src/main/include/log4cxx/filter/denyallfilter.h b/src/main/include/log4cxx/filter/denyallfilter.h
index a4472d2..9c0ee62 100644
--- a/src/main/include/log4cxx/filter/denyallfilter.h
+++ b/src/main/include/log4cxx/filter/denyallfilter.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_FILTER_DENY_ALL_FILTER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -40,28 +40,28 @@
class LOG4CXX_EXPORT DenyAllFilter : public spi::Filter
{
- public:
- DenyAllFilter() : spi::Filter()
- {
- }
+ public:
+ DenyAllFilter() : spi::Filter()
+ {
+ }
- typedef spi::Filter BASE_CLASS;
- DECLARE_LOG4CXX_OBJECT(DenyAllFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DenyAllFilter)
- LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
- END_LOG4CXX_CAST_MAP()
+ typedef spi::Filter BASE_CLASS;
+ DECLARE_LOG4CXX_OBJECT(DenyAllFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DenyAllFilter)
+ LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
+ END_LOG4CXX_CAST_MAP()
- /**
- Always returns the integer constant {@link spi::Filter#DENY DENY}
- regardless of the {@link spi::LoggingEventPtr LoggingEvent} parameter.
- @param event The LoggingEvent to filter.
- @return Always returns {@link spi::Filter#DENY DENY}.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const
- {
- return spi::Filter::DENY;
- }
+ /**
+ Always returns the integer constant {@link spi::Filter#DENY DENY}
+ regardless of the {@link spi::LoggingEventPtr LoggingEvent} parameter.
+ @param event The LoggingEvent to filter.
+ @return Always returns {@link spi::Filter#DENY DENY}.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const
+ {
+ return spi::Filter::DENY;
+ }
}; // class DenyAllFilter
LOG4CXX_PTR_DEF(DenyAllFilter);
@@ -69,7 +69,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/filter/expressionfilter.h b/src/main/include/log4cxx/filter/expressionfilter.h
index 5609f35..5b01b4a 100644
--- a/src/main/include/log4cxx/filter/expressionfilter.h
+++ b/src/main/include/log4cxx/filter/expressionfilter.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_FILTER_EXPRESSIONFILTER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -83,47 +83,47 @@
*/
class LOG4CXX_EXPORT ExpressionFilter: public log4cxx::spi::Filter
{
- private:
- bool acceptOnMatch;
- bool convertInFixToPostFix;
- LogString expression;
- log4cxx::rule::RulePtr expressionRule;
- ExpressionFilter(const ExpressionFilter&);
- ExpressionFilter& operator=(const ExpressionFilter&);
+ private:
+ bool acceptOnMatch;
+ bool convertInFixToPostFix;
+ LogString expression;
+ log4cxx::rule::RulePtr expressionRule;
+ ExpressionFilter(const ExpressionFilter&);
+ ExpressionFilter& operator=(const ExpressionFilter&);
- public:
- DECLARE_LOG4CXX_OBJECT(ExpressionFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(ExpressionFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
+ END_LOG4CXX_CAST_MAP()
- ExpressionFilter();
+ ExpressionFilter();
- void activateOptions(log4cxx::helpers::Pool& p);
+ void activateOptions(log4cxx::helpers::Pool& p);
- void setExpression(const LogString& expression);
+ void setExpression(const LogString& expression);
- LogString getExpression() const;
+ LogString getExpression() const;
- void setConvertInFixToPostFix(bool convertInFixToPostFix);
+ void setConvertInFixToPostFix(bool convertInFixToPostFix);
- bool getConvertInFixToPostFix() const;
+ bool getConvertInFixToPostFix() const;
- void setAcceptOnMatch(bool acceptOnMatch);
+ void setAcceptOnMatch(bool acceptOnMatch);
- bool getAcceptOnMatch() const;
+ bool getAcceptOnMatch() const;
- /**
- Returns {@link log4cxx::spi::Filter#NEUTRAL} is there is no string match.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ /**
+ Returns {@link log4cxx::spi::Filter#NEUTRAL} is there is no string match.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
};
}
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/filter/levelmatchfilter.h b/src/main/include/log4cxx/filter/levelmatchfilter.h
index 38f3aec..11266be 100644
--- a/src/main/include/log4cxx/filter/levelmatchfilter.h
+++ b/src/main/include/log4cxx/filter/levelmatchfilter.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_FILTER_LEVEL_MATCH_FILTER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -48,59 +48,59 @@
class LOG4CXX_EXPORT LevelMatchFilter : public spi::Filter
{
- private:
- bool acceptOnMatch;
- LevelPtr levelToMatch;
+ private:
+ bool acceptOnMatch;
+ LevelPtr levelToMatch;
- public:
- typedef spi::Filter BASE_CLASS;
- DECLARE_LOG4CXX_OBJECT(LevelMatchFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LevelMatchFilter)
- LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
- END_LOG4CXX_CAST_MAP()
+ public:
+ typedef spi::Filter BASE_CLASS;
+ DECLARE_LOG4CXX_OBJECT(LevelMatchFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LevelMatchFilter)
+ LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
+ END_LOG4CXX_CAST_MAP()
- LevelMatchFilter();
+ LevelMatchFilter();
- /**
- Set options
- */
- virtual void setOption(const LogString& option,
- const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- void setLevelToMatch(const LogString& levelToMatch);
+ void setLevelToMatch(const LogString& levelToMatch);
- LogString getLevelToMatch() const;
+ LogString getLevelToMatch() const;
- inline void setAcceptOnMatch(bool acceptOnMatch1)
- {
- this->acceptOnMatch = acceptOnMatch1;
- }
+ inline void setAcceptOnMatch(bool acceptOnMatch1)
+ {
+ this->acceptOnMatch = acceptOnMatch1;
+ }
- inline bool getAcceptOnMatch() const
- {
- return acceptOnMatch;
- }
+ inline bool getAcceptOnMatch() const
+ {
+ return acceptOnMatch;
+ }
- /**
- Return the decision of this filter.
+ /**
+ Return the decision of this filter.
- Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
- <b>LevelToMatch</b> option is not set or if there is not match.
- Otherwise, if there is a match, then the returned decision is
- {@link spi::Filter#ACCEPT ACCEPT} if the <b>AcceptOnMatch</b>
- property is set to <code>true</code>. The returned decision is
- {@link spi::Filter#DENY DENY} if the
- <b>AcceptOnMatch</b> property is set to false.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
+ <b>LevelToMatch</b> option is not set or if there is not match.
+ Otherwise, if there is a match, then the returned decision is
+ {@link spi::Filter#ACCEPT ACCEPT} if the <b>AcceptOnMatch</b>
+ property is set to <code>true</code>. The returned decision is
+ {@link spi::Filter#DENY DENY} if the
+ <b>AcceptOnMatch</b> property is set to false.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
}; // class LevelMatchFilter
LOG4CXX_PTR_DEF(LevelMatchFilter);
} // namespace filter
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_FILTER_LEVEL_MATCH_FILTER_H
diff --git a/src/main/include/log4cxx/filter/levelrangefilter.h b/src/main/include/log4cxx/filter/levelrangefilter.h
index 5b7a73a..6b5afdd 100644
--- a/src/main/include/log4cxx/filter/levelrangefilter.h
+++ b/src/main/include/log4cxx/filter/levelrangefilter.h
@@ -56,91 +56,91 @@
class LOG4CXX_EXPORT LevelRangeFilter : public spi::Filter
{
- private:
- /**
- Do we return ACCEPT when a match occurs. Default is
- <code>false</code>, so that later filters get run by default
- */
- bool acceptOnMatch;
- LevelPtr levelMin;
- LevelPtr levelMax;
+ private:
+ /**
+ Do we return ACCEPT when a match occurs. Default is
+ <code>false</code>, so that later filters get run by default
+ */
+ bool acceptOnMatch;
+ LevelPtr levelMin;
+ LevelPtr levelMax;
- public:
- typedef spi::Filter BASE_CLASS;
- DECLARE_LOG4CXX_OBJECT(LevelRangeFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LevelRangeFilter)
- LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
- END_LOG4CXX_CAST_MAP()
+ public:
+ typedef spi::Filter BASE_CLASS;
+ DECLARE_LOG4CXX_OBJECT(LevelRangeFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LevelRangeFilter)
+ LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
+ END_LOG4CXX_CAST_MAP()
- LevelRangeFilter();
+ LevelRangeFilter();
- /**
- Set options
- */
- virtual void setOption(const LogString& option,
- const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- /**
- Set the <code>LevelMin</code> option.
- */
- void setLevelMin(const LevelPtr& levelMin1)
- {
- this->levelMin = levelMin1;
- }
+ /**
+ Set the <code>LevelMin</code> option.
+ */
+ void setLevelMin(const LevelPtr& levelMin1)
+ {
+ this->levelMin = levelMin1;
+ }
- /**
- Get the value of the <code>LevelMin</code> option.
- */
- const LevelPtr& getLevelMin() const
- {
- return levelMin;
- }
+ /**
+ Get the value of the <code>LevelMin</code> option.
+ */
+ const LevelPtr& getLevelMin() const
+ {
+ return levelMin;
+ }
- /**
- Set the <code>LevelMax</code> option.
- */
- void setLevelMax(const LevelPtr& levelMax1)
- {
- this->levelMax = levelMax1;
- }
+ /**
+ Set the <code>LevelMax</code> option.
+ */
+ void setLevelMax(const LevelPtr& levelMax1)
+ {
+ this->levelMax = levelMax1;
+ }
- /**
- Get the value of the <code>LevelMax</code> option.
- */
- const LevelPtr& getLevelMax() const
- {
- return levelMax;
- }
+ /**
+ Get the value of the <code>LevelMax</code> option.
+ */
+ const LevelPtr& getLevelMax() const
+ {
+ return levelMax;
+ }
- /**
- Set the <code>AcceptOnMatch</code> option.
- */
- inline void setAcceptOnMatch(bool acceptOnMatch1)
- {
- this->acceptOnMatch = acceptOnMatch1;
- }
+ /**
+ Set the <code>AcceptOnMatch</code> option.
+ */
+ inline void setAcceptOnMatch(bool acceptOnMatch1)
+ {
+ this->acceptOnMatch = acceptOnMatch1;
+ }
- /**
- Get the value of the <code>AcceptOnMatch</code> option.
- */
- inline bool getAcceptOnMatch() const
- {
- return acceptOnMatch;
- }
+ /**
+ Get the value of the <code>AcceptOnMatch</code> option.
+ */
+ inline bool getAcceptOnMatch() const
+ {
+ return acceptOnMatch;
+ }
- /**
- Return the decision of this filter.
+ /**
+ Return the decision of this filter.
- Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
- <b>LevelToMatch</b> option is not set or if there is not match.
- Otherwise, if there is a match, then the returned decision is
- {@link spi::Filter#ACCEPT ACCEPT} if the
- <b>AcceptOnMatch</b> property is set to <code>true</code>. The
- returned decision is {@link spi::Filter#DENY DENY} if the
- <b>AcceptOnMatch</b> property is set to false.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
+ <b>LevelToMatch</b> option is not set or if there is not match.
+ Otherwise, if there is a match, then the returned decision is
+ {@link spi::Filter#ACCEPT ACCEPT} if the
+ <b>AcceptOnMatch</b> property is set to <code>true</code>. The
+ returned decision is {@link spi::Filter#DENY DENY} if the
+ <b>AcceptOnMatch</b> property is set to false.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
}; // class LevelRangeFilter
LOG4CXX_PTR_DEF(LevelRangeFilter);
} // namespace filter
diff --git a/src/main/include/log4cxx/filter/locationinfofilter.h b/src/main/include/log4cxx/filter/locationinfofilter.h
index 343ee01..a2515da 100644
--- a/src/main/include/log4cxx/filter/locationinfofilter.h
+++ b/src/main/include/log4cxx/filter/locationinfofilter.h
@@ -45,41 +45,41 @@
*/
class LOG4CXX_EXPORT LocationInfoFilter: public log4cxx::spi::Filter
{
- bool convertInFixToPostFix;
- LogString expression;
- log4cxx::rule::RulePtr expressionRule;
- //HACK: Category is the last of the internal layers - pass this in as the class name
- //in order for parsing to work correctly
- LogString className;
+ bool convertInFixToPostFix;
+ LogString expression;
+ log4cxx::rule::RulePtr expressionRule;
+ //HACK: Category is the last of the internal layers - pass this in as the class name
+ //in order for parsing to work correctly
+ LogString className;
- public:
- DECLARE_LOG4CXX_OBJECT(LocationInfoFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(LocationInfoFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
+ END_LOG4CXX_CAST_MAP()
- LocationInfoFilter();
+ LocationInfoFilter();
- void activateOptions(log4cxx::helpers::Pool&);
+ void activateOptions(log4cxx::helpers::Pool&);
- void setExpression(const LogString& expression);
+ void setExpression(const LogString& expression);
- LogString getExpression() const;
+ LogString getExpression() const;
- void setConvertInFixToPostFix(bool convertInFixToPostFix);
+ void setConvertInFixToPostFix(bool convertInFixToPostFix);
- bool getConvertInFixToPostFix() const;
+ bool getConvertInFixToPostFix() const;
- /**
- * If this event does not already contain location information,
- * evaluate the event against the expression.
- *
- * If the expression evaluates to true, generate a LocationInfo instance
- * by creating an exception and set this LocationInfo on the event.
- *
- * Returns {@link log4cxx::spi::Filter#NEUTRAL}
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ /**
+ * If this event does not already contain location information,
+ * evaluate the event against the expression.
+ *
+ * If the expression evaluates to true, generate a LocationInfo instance
+ * by creating an exception and set this LocationInfo on the event.
+ *
+ * Returns {@link log4cxx::spi::Filter#NEUTRAL}
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
};
}
diff --git a/src/main/include/log4cxx/filter/loggermatchfilter.h b/src/main/include/log4cxx/filter/loggermatchfilter.h
index 0f80dd2..1d0063e 100644
--- a/src/main/include/log4cxx/filter/loggermatchfilter.h
+++ b/src/main/include/log4cxx/filter/loggermatchfilter.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_FILTER_LOGGER_MATCH_FILTER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -50,59 +50,59 @@
class LOG4CXX_EXPORT LoggerMatchFilter : public spi::Filter
{
- private:
- bool acceptOnMatch;
- LogString loggerToMatch;
+ private:
+ bool acceptOnMatch;
+ LogString loggerToMatch;
- public:
- typedef spi::Filter BASE_CLASS;
- DECLARE_LOG4CXX_OBJECT(LoggerMatchFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LoggerMatchFilter)
- LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
- END_LOG4CXX_CAST_MAP()
+ public:
+ typedef spi::Filter BASE_CLASS;
+ DECLARE_LOG4CXX_OBJECT(LoggerMatchFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LoggerMatchFilter)
+ LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
+ END_LOG4CXX_CAST_MAP()
- LoggerMatchFilter();
+ LoggerMatchFilter();
- /**
- Set options
- */
- virtual void setOption(const LogString& option,
- const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- void setLoggerToMatch(const LogString& levelToMatch);
+ void setLoggerToMatch(const LogString& levelToMatch);
- LogString getLoggerToMatch() const;
+ LogString getLoggerToMatch() const;
- inline void setAcceptOnMatch(bool acceptOnMatch1)
- {
- this->acceptOnMatch = acceptOnMatch1;
- }
+ inline void setAcceptOnMatch(bool acceptOnMatch1)
+ {
+ this->acceptOnMatch = acceptOnMatch1;
+ }
- inline bool getAcceptOnMatch() const
- {
- return acceptOnMatch;
- }
+ inline bool getAcceptOnMatch() const
+ {
+ return acceptOnMatch;
+ }
- /**
- Return the decision of this filter.
+ /**
+ Return the decision of this filter.
- Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
- <b>LoggerToMatch</b> option is not set or if there is not match.
- Otherwise, if there is a match, then the returned decision is
- {@link spi::Filter#ACCEPT ACCEPT} if the <b>AcceptOnMatch</b>
- property is set to <code>true</code>. The returned decision is
- {@link spi::Filter#DENY DENY} if the
- <b>AcceptOnMatch</b> property is set to false.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ Returns {@link spi::Filter#NEUTRAL NEUTRAL} if the
+ <b>LoggerToMatch</b> option is not set or if there is not match.
+ Otherwise, if there is a match, then the returned decision is
+ {@link spi::Filter#ACCEPT ACCEPT} if the <b>AcceptOnMatch</b>
+ property is set to <code>true</code>. The returned decision is
+ {@link spi::Filter#DENY DENY} if the
+ <b>AcceptOnMatch</b> property is set to false.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
}; // class LoggerMatchFilter
LOG4CXX_PTR_DEF(LoggerMatchFilter);
} // namespace filter
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_FILTER_LOGGER_MATCH_FILTER_H
diff --git a/src/main/include/log4cxx/filter/mapfilter.h b/src/main/include/log4cxx/filter/mapfilter.h
index 4edd0f7..d6db108 100644
--- a/src/main/include/log4cxx/filter/mapfilter.h
+++ b/src/main/include/log4cxx/filter/mapfilter.h
@@ -27,16 +27,16 @@
class LOG4CXX_EXPORT MapFilter: public log4cxx::spi::Filter
{
- public:
- DECLARE_LOG4CXX_OBJECT(MapFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(MapFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
+ END_LOG4CXX_CAST_MAP()
- MapFilter();
+ MapFilter();
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
};
}
diff --git a/src/main/include/log4cxx/filter/propertyfilter.h b/src/main/include/log4cxx/filter/propertyfilter.h
index de67cd1..2f1f8cb 100644
--- a/src/main/include/log4cxx/filter/propertyfilter.h
+++ b/src/main/include/log4cxx/filter/propertyfilter.h
@@ -20,8 +20,8 @@
#define _LOG4CXX_FILTER_PROPERTYFILTER_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -52,22 +52,22 @@
*/
class LOG4CXX_EXPORT PropertyFilter : public log4cxx::spi::Filter
{
- typedef std::map < LogString, LogString > PropertyMap;
- PropertyMap* properties;
- PropertyFilter(const PropertyFilter&);
- PropertyFilter& operator=(const PropertyFilter&);
+ typedef std::map < LogString, LogString > PropertyMap;
+ PropertyMap* properties;
+ PropertyFilter(const PropertyFilter&);
+ PropertyFilter& operator=(const PropertyFilter&);
- public:
- DECLARE_LOG4CXX_OBJECT(PropertyFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(PropertyFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(log4cxx::spi::Filter)
+ END_LOG4CXX_CAST_MAP()
- PropertyFilter();
- ~PropertyFilter();
- void setProperties(const LogString& props);
+ PropertyFilter();
+ ~PropertyFilter();
+ void setProperties(const LogString& props);
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
};
@@ -75,7 +75,7 @@
}
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif
diff --git a/src/main/include/log4cxx/filter/stringmatchfilter.h b/src/main/include/log4cxx/filter/stringmatchfilter.h
index 9fa9d2e..a244e3c 100644
--- a/src/main/include/log4cxx/filter/stringmatchfilter.h
+++ b/src/main/include/log4cxx/filter/stringmatchfilter.h
@@ -47,51 +47,51 @@
class LOG4CXX_EXPORT StringMatchFilter : public spi::Filter
{
- private:
- bool acceptOnMatch;
- LogString stringToMatch;
+ private:
+ bool acceptOnMatch;
+ LogString stringToMatch;
- public:
- typedef spi::Filter BASE_CLASS;
- DECLARE_LOG4CXX_OBJECT(StringMatchFilter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(StringMatchFilter)
- LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
- END_LOG4CXX_CAST_MAP()
+ public:
+ typedef spi::Filter BASE_CLASS;
+ DECLARE_LOG4CXX_OBJECT(StringMatchFilter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(StringMatchFilter)
+ LOG4CXX_CAST_ENTRY_CHAIN(BASE_CLASS)
+ END_LOG4CXX_CAST_MAP()
- StringMatchFilter();
+ StringMatchFilter();
- /**
- Set options
- */
- virtual void setOption(const LogString& option,
- const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- inline void setStringToMatch(const LogString& stringToMatch1)
- {
- this->stringToMatch.assign(stringToMatch1);
- }
+ inline void setStringToMatch(const LogString& stringToMatch1)
+ {
+ this->stringToMatch.assign(stringToMatch1);
+ }
- inline const LogString& getStringToMatch() const
- {
- return stringToMatch;
- }
+ inline const LogString& getStringToMatch() const
+ {
+ return stringToMatch;
+ }
- inline void setAcceptOnMatch(bool acceptOnMatch1)
- {
- this->acceptOnMatch = acceptOnMatch1;
- }
+ inline void setAcceptOnMatch(bool acceptOnMatch1)
+ {
+ this->acceptOnMatch = acceptOnMatch1;
+ }
- inline bool getAcceptOnMatch() const
- {
- return acceptOnMatch;
- }
+ inline bool getAcceptOnMatch() const
+ {
+ return acceptOnMatch;
+ }
- /**
- Returns {@link log4cxx::spi::Filter#NEUTRAL NEUTRAL}
- is there is no string match.
- */
- FilterDecision decide(const spi::LoggingEventPtr& event) const;
+ /**
+ Returns {@link log4cxx::spi::Filter#NEUTRAL NEUTRAL}
+ is there is no string match.
+ */
+ FilterDecision decide(const spi::LoggingEventPtr& event) const;
}; // class StringMatchFilter
LOG4CXX_PTR_DEF(StringMatchFilter);
} // namespace filter
diff --git a/src/main/include/log4cxx/helpers/absolutetimedateformat.h b/src/main/include/log4cxx/helpers/absolutetimedateformat.h
index c974339..4e24972 100644
--- a/src/main/include/log4cxx/helpers/absolutetimedateformat.h
+++ b/src/main/include/log4cxx/helpers/absolutetimedateformat.h
@@ -30,9 +30,9 @@
*/
class LOG4CXX_EXPORT AbsoluteTimeDateFormat : public SimpleDateFormat
{
- public:
- AbsoluteTimeDateFormat()
- : SimpleDateFormat(LOG4CXX_STR("HH:mm:ss,SSS")) {}
+ public:
+ AbsoluteTimeDateFormat()
+ : SimpleDateFormat(LOG4CXX_STR("HH:mm:ss,SSS")) {}
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/appenderattachableimpl.h b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
index a865108..4c3caeb 100644
--- a/src/main/include/log4cxx/helpers/appenderattachableimpl.h
+++ b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_APPENDER_ATTACHABLE_IMPL_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -41,82 +41,82 @@
{
class LOG4CXX_EXPORT AppenderAttachableImpl :
- public virtual spi::AppenderAttachable,
- public virtual helpers::ObjectImpl
+ public virtual spi::AppenderAttachable,
+ public virtual helpers::ObjectImpl
{
- protected:
- /** Array of appenders. */
- AppenderList appenderList;
+ protected:
+ /** Array of appenders. */
+ AppenderList appenderList;
- public:
- /**
- * Create new instance.
- * @param pool pool, must be longer-lived than instance.
- */
- AppenderAttachableImpl(Pool& pool);
+ public:
+ /**
+ * Create new instance.
+ * @param pool pool, must be longer-lived than instance.
+ */
+ AppenderAttachableImpl(Pool& pool);
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderAttachableImpl)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(AppenderAttachableImpl)
- LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderAttachableImpl)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(AppenderAttachableImpl)
+ LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
+ END_LOG4CXX_CAST_MAP()
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- // Methods
- /**
- * Add an appender.
- */
- virtual void addAppender(const AppenderPtr& newAppender);
+ // Methods
+ /**
+ * Add an appender.
+ */
+ virtual void addAppender(const AppenderPtr& newAppender);
- /**
- Call the <code>doAppend</code> method on all attached appenders.
- */
- int appendLoopOnAppenders(const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& p);
+ /**
+ Call the <code>doAppend</code> method on all attached appenders.
+ */
+ int appendLoopOnAppenders(const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& p);
- /**
- * Get all previously added appenders as an Enumeration.
- */
- virtual AppenderList getAllAppenders() const;
+ /**
+ * Get all previously added appenders as an Enumeration.
+ */
+ virtual AppenderList getAllAppenders() const;
- /**
- * Get an appender by name.
- */
- virtual AppenderPtr getAppender(const LogString& name) const;
+ /**
+ * Get an appender by name.
+ */
+ virtual AppenderPtr getAppender(const LogString& name) const;
- /**
- Returns <code>true</code> if the specified appender is in the
- list of attached appenders, <code>false</code> otherwise.
- */
- virtual bool isAttached(const AppenderPtr& appender) const;
+ /**
+ Returns <code>true</code> if the specified appender is in the
+ list of attached appenders, <code>false</code> otherwise.
+ */
+ virtual bool isAttached(const AppenderPtr& appender) const;
- /**
- * Remove all previously added appenders.
- */
- virtual void removeAllAppenders();
+ /**
+ * Remove all previously added appenders.
+ */
+ virtual void removeAllAppenders();
- /**
- * Remove the appender passed as parameter from the list of appenders.
- */
- virtual void removeAppender(const AppenderPtr& appender);
+ /**
+ * Remove the appender passed as parameter from the list of appenders.
+ */
+ virtual void removeAppender(const AppenderPtr& appender);
- /**
- * Remove the appender with the name passed as parameter from the
- * list of appenders.
- */
- virtual void removeAppender(const LogString& name);
+ /**
+ * Remove the appender with the name passed as parameter from the
+ * list of appenders.
+ */
+ virtual void removeAppender(const LogString& name);
- inline const log4cxx::helpers::Mutex& getMutex() const
- {
- return mutex;
- }
+ inline const log4cxx::helpers::Mutex& getMutex() const
+ {
+ return mutex;
+ }
- private:
- log4cxx::helpers::Mutex mutex;
- AppenderAttachableImpl(const AppenderAttachableImpl&);
- AppenderAttachableImpl& operator=(const AppenderAttachableImpl&);
+ private:
+ log4cxx::helpers::Mutex mutex;
+ AppenderAttachableImpl(const AppenderAttachableImpl&);
+ AppenderAttachableImpl& operator=(const AppenderAttachableImpl&);
};
LOG4CXX_PTR_DEF(AppenderAttachableImpl);
@@ -125,7 +125,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_HELPERS_APPENDER_ATTACHABLE_IMPL_H
diff --git a/src/main/include/log4cxx/helpers/aprinitializer.h b/src/main/include/log4cxx/helpers/aprinitializer.h
index 49e49b0..b2f1f05 100644
--- a/src/main/include/log4cxx/helpers/aprinitializer.h
+++ b/src/main/include/log4cxx/helpers/aprinitializer.h
@@ -19,14 +19,14 @@
#define _LOG4CXX_HELPERS_APRINITIALIZER_H
#ifndef LOG4CXX
- #error "aprinitializer.h should only be included by log4cxx implementation"
+ #error "aprinitializer.h should only be included by log4cxx implementation"
#endif
#include <list>
extern "C" {
- typedef struct apr_thread_mutex_t apr_thread_mutex_t;
- typedef struct apr_threadkey_t apr_threadkey_t;
+ typedef struct apr_thread_mutex_t apr_thread_mutex_t;
+ typedef struct apr_threadkey_t apr_threadkey_t;
}
#include <apr_time.h>
@@ -39,33 +39,33 @@
class APRInitializer
{
- public:
- static log4cxx_time_t initialize();
- static apr_pool_t* getRootPool();
- static apr_threadkey_t* getTlsKey();
- static bool isDestructed;
+ public:
+ static log4cxx_time_t initialize();
+ static apr_pool_t* getRootPool();
+ static apr_threadkey_t* getTlsKey();
+ static bool isDestructed;
- /**
- * Register a FileWatchdog for deletion prior to
- * APR termination. FileWatchdog must be
- * allocated on heap and not deleted elsewhere.
- */
- static void registerCleanup(FileWatchdog* watchdog);
- static void unregisterCleanup(FileWatchdog* watchdog);
+ /**
+ * Register a FileWatchdog for deletion prior to
+ * APR termination. FileWatchdog must be
+ * allocated on heap and not deleted elsewhere.
+ */
+ static void registerCleanup(FileWatchdog* watchdog);
+ static void unregisterCleanup(FileWatchdog* watchdog);
- private:
- APRInitializer();
- APRInitializer(const APRInitializer&);
- APRInitializer& operator=(const APRInitializer&);
- apr_pool_t* p;
- apr_thread_mutex_t* mutex;
- std::list<FileWatchdog*> watchdogs;
- apr_time_t startTime;
- apr_threadkey_t* tlsKey;
- static APRInitializer& getInstance();
+ private:
+ APRInitializer();
+ APRInitializer(const APRInitializer&);
+ APRInitializer& operator=(const APRInitializer&);
+ apr_pool_t* p;
+ apr_thread_mutex_t* mutex;
+ std::list<FileWatchdog*> watchdogs;
+ apr_time_t startTime;
+ apr_threadkey_t* tlsKey;
+ static APRInitializer& getInstance();
- public:
- ~APRInitializer();
+ public:
+ ~APRInitializer();
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/bufferedoutputstream.h b/src/main/include/log4cxx/helpers/bufferedoutputstream.h
index 45a9664..0803da6 100644
--- a/src/main/include/log4cxx/helpers/bufferedoutputstream.h
+++ b/src/main/include/log4cxx/helpers/bufferedoutputstream.h
@@ -31,29 +31,29 @@
*/
class LOG4CXX_EXPORT BufferedOutputStream : public OutputStream
{
- private:
- size_t count;
- LogString buf;
+ private:
+ size_t count;
+ LogString buf;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(BufferedOutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(BufferedOutputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(BufferedOutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(BufferedOutputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
+ END_LOG4CXX_CAST_MAP()
- protected:
- BufferedOutputStream(OutputStreamPtr& out, size_t size = 4096);
- ~BufferedOutputStream();
+ protected:
+ BufferedOutputStream(OutputStreamPtr& out, size_t size = 4096);
+ ~BufferedOutputStream();
- public:
- void close(Pool& p);
- void flush(Pool& p);
- void write(ByteBuffer& buf, Pool& p);
+ public:
+ void close(Pool& p);
+ void flush(Pool& p);
+ void write(ByteBuffer& buf, Pool& p);
- private:
- BufferedOutputStream(const BufferedOutputStream&);
- BufferedOutputStream& operator=(const BufferedOutputStream&);
+ private:
+ BufferedOutputStream(const BufferedOutputStream&);
+ BufferedOutputStream& operator=(const BufferedOutputStream&);
};
LOG4CXX_PTR_DEF(BufferedOutputStream);
diff --git a/src/main/include/log4cxx/helpers/bufferedwriter.h b/src/main/include/log4cxx/helpers/bufferedwriter.h
index 7e33d18..2ed9f2c 100644
--- a/src/main/include/log4cxx/helpers/bufferedwriter.h
+++ b/src/main/include/log4cxx/helpers/bufferedwriter.h
@@ -32,29 +32,29 @@
*/
class LOG4CXX_EXPORT BufferedWriter : public Writer
{
- private:
- WriterPtr out;
- size_t sz;
- LogString buf;
+ private:
+ WriterPtr out;
+ size_t sz;
+ LogString buf;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(BufferedWriter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(BufferedWriter)
- LOG4CXX_CAST_ENTRY_CHAIN(Writer)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(BufferedWriter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(BufferedWriter)
+ LOG4CXX_CAST_ENTRY_CHAIN(Writer)
+ END_LOG4CXX_CAST_MAP()
- BufferedWriter(WriterPtr& out);
- BufferedWriter(WriterPtr& out, size_t sz);
- virtual ~BufferedWriter();
+ BufferedWriter(WriterPtr& out);
+ BufferedWriter(WriterPtr& out, size_t sz);
+ virtual ~BufferedWriter();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(const LogString& str, Pool& p);
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(const LogString& str, Pool& p);
- private:
- BufferedWriter(const BufferedWriter&);
- BufferedWriter& operator=(const BufferedWriter&);
+ private:
+ BufferedWriter(const BufferedWriter&);
+ BufferedWriter& operator=(const BufferedWriter&);
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/bytearrayinputstream.h b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
index 5b032d9..b484469 100644
--- a/src/main/include/log4cxx/helpers/bytearrayinputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -40,46 +40,46 @@
*/
class LOG4CXX_EXPORT ByteArrayInputStream : public InputStream
{
- private:
- ByteList buf;
- size_t pos;
+ private:
+ ByteList buf;
+ size_t pos;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayInputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ByteArrayInputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayInputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ByteArrayInputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Creates a ByteArrayInputStream.
- *
- * @param bytes array of bytes to copy into stream.
- */
- ByteArrayInputStream(const ByteList& bytes);
+ /**
+ * Creates a ByteArrayInputStream.
+ *
+ * @param bytes array of bytes to copy into stream.
+ */
+ ByteArrayInputStream(const ByteList& bytes);
- virtual ~ByteArrayInputStream();
+ virtual ~ByteArrayInputStream();
- /**
- * Closes this file input stream and releases any system
- * resources associated with the stream.
- */
- virtual void close();
+ /**
+ * Closes this file input stream and releases any system
+ * resources associated with the stream.
+ */
+ virtual void close();
- /**
- * Reads a sequence of bytes into the given buffer.
- *
- * @param buf The buffer into which bytes are to be transferred.
- * @return the total number of bytes read into the buffer, or -1 if there
- * is no more data because the end of the stream has been reached.
- */
- virtual int read(ByteBuffer& buf);
+ /**
+ * Reads a sequence of bytes into the given buffer.
+ *
+ * @param buf The buffer into which bytes are to be transferred.
+ * @return the total number of bytes read into the buffer, or -1 if there
+ * is no more data because the end of the stream has been reached.
+ */
+ virtual int read(ByteBuffer& buf);
- private:
+ private:
- ByteArrayInputStream(const ByteArrayInputStream&);
+ ByteArrayInputStream(const ByteArrayInputStream&);
- ByteArrayInputStream& operator=(const ByteArrayInputStream&);
+ ByteArrayInputStream& operator=(const ByteArrayInputStream&);
};
@@ -89,7 +89,7 @@
} //namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
diff --git a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
index 2e98f77..90e397c 100644
--- a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_BYTEARRAYOUTPUTSTREAM_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -43,27 +43,27 @@
*/
class LOG4CXX_EXPORT ByteArrayOutputStream : public OutputStream
{
- private:
- ByteList array;
+ private:
+ ByteList array;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayOutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ByteArrayOutputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayOutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ByteArrayOutputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
+ END_LOG4CXX_CAST_MAP()
- ByteArrayOutputStream();
- virtual ~ByteArrayOutputStream();
+ ByteArrayOutputStream();
+ virtual ~ByteArrayOutputStream();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(ByteBuffer& buf, Pool& p);
- ByteList toByteArray() const;
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(ByteBuffer& buf, Pool& p);
+ ByteList toByteArray() const;
- private:
- ByteArrayOutputStream(const ByteArrayOutputStream&);
- ByteArrayOutputStream& operator=(const ByteArrayOutputStream&);
+ private:
+ ByteArrayOutputStream(const ByteArrayOutputStream&);
+ ByteArrayOutputStream& operator=(const ByteArrayOutputStream&);
};
LOG4CXX_PTR_DEF(ByteArrayOutputStream);
@@ -72,7 +72,7 @@
} //namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/helpers/bytebuffer.h b/src/main/include/log4cxx/helpers/bytebuffer.h
index 7692a29..3c68568 100644
--- a/src/main/include/log4cxx/helpers/bytebuffer.h
+++ b/src/main/include/log4cxx/helpers/bytebuffer.h
@@ -32,56 +32,56 @@
*/
class LOG4CXX_EXPORT ByteBuffer
{
- private:
- char* base;
- size_t pos;
- size_t lim;
- size_t cap;
+ private:
+ char* base;
+ size_t pos;
+ size_t lim;
+ size_t cap;
- public:
- ByteBuffer(char* data, size_t capacity);
- ~ByteBuffer();
+ public:
+ ByteBuffer(char* data, size_t capacity);
+ ~ByteBuffer();
- void clear();
- void flip();
+ void clear();
+ void flip();
- inline char* data()
- {
- return base;
- }
- inline const char* data() const
- {
- return base;
- }
- inline char* current()
- {
- return base + pos;
- }
- inline const char* current() const
- {
- return base + pos;
- }
- inline size_t limit() const
- {
- return lim;
- }
- void limit(size_t newLimit);
- inline size_t position() const
- {
- return pos;
- }
- inline size_t remaining() const
- {
- return lim - pos;
- }
- void position(size_t newPosition);
+ inline char* data()
+ {
+ return base;
+ }
+ inline const char* data() const
+ {
+ return base;
+ }
+ inline char* current()
+ {
+ return base + pos;
+ }
+ inline const char* current() const
+ {
+ return base + pos;
+ }
+ inline size_t limit() const
+ {
+ return lim;
+ }
+ void limit(size_t newLimit);
+ inline size_t position() const
+ {
+ return pos;
+ }
+ inline size_t remaining() const
+ {
+ return lim - pos;
+ }
+ void position(size_t newPosition);
- bool put(char byte);
+ bool put(char byte);
- private:
- ByteBuffer(const ByteBuffer&);
- ByteBuffer& operator=(const ByteBuffer&);
+ private:
+ ByteBuffer(const ByteBuffer&);
+ ByteBuffer& operator=(const ByteBuffer&);
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/cacheddateformat.h b/src/main/include/log4cxx/helpers/cacheddateformat.h
index 4cb1bc6..5e94fda 100644
--- a/src/main/include/log4cxx/helpers/cacheddateformat.h
+++ b/src/main/include/log4cxx/helpers/cacheddateformat.h
@@ -26,192 +26,192 @@
{
class LOG4CXX_EXPORT CachedDateFormat : public log4cxx::helpers::DateFormat
{
- public:
- enum
- {
- /*
- * Constant used to represent that there was no change
- * observed when changing the millisecond count.
- */
- NO_MILLISECONDS = -2,
- /*
- * Constant used to represent that there was an
- * observed change, but was an expected change.
- */
- UNRECOGNIZED_MILLISECONDS = -1
- };
+ public:
+ enum
+ {
+ /*
+ * Constant used to represent that there was no change
+ * observed when changing the millisecond count.
+ */
+ NO_MILLISECONDS = -2,
+ /*
+ * Constant used to represent that there was an
+ * observed change, but was an expected change.
+ */
+ UNRECOGNIZED_MILLISECONDS = -1
+ };
- private:
- /**
- * Supported digit set. If the wrapped DateFormat uses
- * a different unit set, the millisecond pattern
- * will not be recognized and duplicate requests
- * will use the cache.
- */
- static const logchar digits[];
+ private:
+ /**
+ * Supported digit set. If the wrapped DateFormat uses
+ * a different unit set, the millisecond pattern
+ * will not be recognized and duplicate requests
+ * will use the cache.
+ */
+ static const logchar digits[];
- enum
- {
- /**
- * First magic number used to detect the millisecond position.
- */
- magic1 = 654000,
- /**
- * Second magic number used to detect the millisecond position.
- */
- magic2 = 987000
- };
+ enum
+ {
+ /**
+ * First magic number used to detect the millisecond position.
+ */
+ magic1 = 654000,
+ /**
+ * Second magic number used to detect the millisecond position.
+ */
+ magic2 = 987000
+ };
- /**
- * Expected representation of first magic number.
- */
- static const logchar magicString1[];
+ /**
+ * Expected representation of first magic number.
+ */
+ static const logchar magicString1[];
- /**
- * Expected representation of second magic number.
- */
- static const logchar magicString2[];
+ /**
+ * Expected representation of second magic number.
+ */
+ static const logchar magicString2[];
- /**
- * Expected representation of 0 milliseconds.
- */
- static const logchar zeroString[];
+ /**
+ * Expected representation of 0 milliseconds.
+ */
+ static const logchar zeroString[];
- /**
- * Wrapped formatter.
- */
- log4cxx::helpers::DateFormatPtr formatter;
+ /**
+ * Wrapped formatter.
+ */
+ log4cxx::helpers::DateFormatPtr formatter;
- /**
- * Index of initial digit of millisecond pattern or
- * UNRECOGNIZED_MILLISECONDS or NO_MILLISECONDS.
- */
- mutable int millisecondStart;
+ /**
+ * Index of initial digit of millisecond pattern or
+ * UNRECOGNIZED_MILLISECONDS or NO_MILLISECONDS.
+ */
+ mutable int millisecondStart;
- /**
- * Integral second preceding the previous convered Date.
- */
- mutable log4cxx_time_t slotBegin;
+ /**
+ * Integral second preceding the previous convered Date.
+ */
+ mutable log4cxx_time_t slotBegin;
- /**
- * Cache of previous conversion.
- */
- mutable LogString cache;
+ /**
+ * Cache of previous conversion.
+ */
+ mutable LogString cache;
- /**
- * Maximum validity period for the cache.
- * Typically 1, use cache for duplicate requests only, or
- * 1000000, use cache for requests within the same integral second.
- */
- const int expiration;
+ /**
+ * Maximum validity period for the cache.
+ * Typically 1, use cache for duplicate requests only, or
+ * 1000000, use cache for requests within the same integral second.
+ */
+ const int expiration;
- /**
- * Date requested in previous conversion.
- */
- mutable log4cxx_time_t previousTime;
+ /**
+ * Date requested in previous conversion.
+ */
+ mutable log4cxx_time_t previousTime;
- public:
- /**
- * Creates a new CachedDateFormat object.
- * @param dateFormat Date format, may not be null.
- * @param expiration maximum cached range in microseconds.
- * If the dateFormat is known to be incompatible with the
- * caching algorithm, use a value of 0 to totally disable
- * caching or 1 to only use cache for duplicate requests.
- */
- CachedDateFormat(const log4cxx::helpers::DateFormatPtr& dateFormat, int expiration);
+ public:
+ /**
+ * Creates a new CachedDateFormat object.
+ * @param dateFormat Date format, may not be null.
+ * @param expiration maximum cached range in microseconds.
+ * If the dateFormat is known to be incompatible with the
+ * caching algorithm, use a value of 0 to totally disable
+ * caching or 1 to only use cache for duplicate requests.
+ */
+ CachedDateFormat(const log4cxx::helpers::DateFormatPtr& dateFormat, int expiration);
- /**
- * Finds start of millisecond field in formatted time.
- * @param time long time, must be integral number of seconds
- * @param formatted String corresponding formatted string
- * @param formatter DateFormat date format
- * @param pool pool.
- * @return int position in string of first digit of milliseconds,
- * -1 indicates no millisecond field, -2 indicates unrecognized
- * field (likely RelativeTimeDateFormat)
- */
- static int findMillisecondStart(
- log4cxx_time_t time, const LogString& formatted,
- const log4cxx::helpers::DateFormatPtr& formatter,
- log4cxx::helpers::Pool& pool);
+ /**
+ * Finds start of millisecond field in formatted time.
+ * @param time long time, must be integral number of seconds
+ * @param formatted String corresponding formatted string
+ * @param formatter DateFormat date format
+ * @param pool pool.
+ * @return int position in string of first digit of milliseconds,
+ * -1 indicates no millisecond field, -2 indicates unrecognized
+ * field (likely RelativeTimeDateFormat)
+ */
+ static int findMillisecondStart(
+ log4cxx_time_t time, const LogString& formatted,
+ const log4cxx::helpers::DateFormatPtr& formatter,
+ log4cxx::helpers::Pool& pool);
- /**
- * Formats a Date into a date/time string.
- *
- * @param date the date to format.
- * @param sbuf the string buffer to write to.
- * @param p memory pool.
- */
- virtual void format(LogString& sbuf,
- log4cxx_time_t date,
- log4cxx::helpers::Pool& p) const;
+ /**
+ * Formats a Date into a date/time string.
+ *
+ * @param date the date to format.
+ * @param sbuf the string buffer to write to.
+ * @param p memory pool.
+ */
+ virtual void format(LogString& sbuf,
+ log4cxx_time_t date,
+ log4cxx::helpers::Pool& p) const;
- private:
- /**
- * Formats a count of milliseconds (0-999) into a numeric representation.
- * @param millis Millisecond coun between 0 and 999.
- * @buf String buffer, may not be null.
- * @offset Starting position in buffer, the length of the
- * buffer must be at least offset + 3.
- */
- static void millisecondFormat(int millis,
- LogString& buf,
- int offset);
+ private:
+ /**
+ * Formats a count of milliseconds (0-999) into a numeric representation.
+ * @param millis Millisecond coun between 0 and 999.
+ * @buf String buffer, may not be null.
+ * @offset Starting position in buffer, the length of the
+ * buffer must be at least offset + 3.
+ */
+ static void millisecondFormat(int millis,
+ LogString& buf,
+ int offset);
- public:
- /**
- * Set timezone.
- *
- * @remarks Setting the timezone using getCalendar().setTimeZone()
- * will likely cause caching to misbehave.
- * @param zone TimeZone new timezone
- */
- virtual void setTimeZone(const log4cxx::helpers::TimeZonePtr& zone);
+ public:
+ /**
+ * Set timezone.
+ *
+ * @remarks Setting the timezone using getCalendar().setTimeZone()
+ * will likely cause caching to misbehave.
+ * @param zone TimeZone new timezone
+ */
+ virtual void setTimeZone(const log4cxx::helpers::TimeZonePtr& zone);
- /**
- * Format an integer consistent with the format method.
- * @param s string to which the numeric string is appended.
- * @param n integer value.
- * @param p memory pool used during formatting.
- */
- virtual void numberFormat(LogString& s,
- int n,
- log4cxx::helpers::Pool& p) const;
+ /**
+ * Format an integer consistent with the format method.
+ * @param s string to which the numeric string is appended.
+ * @param n integer value.
+ * @param p memory pool used during formatting.
+ */
+ virtual void numberFormat(LogString& s,
+ int n,
+ log4cxx::helpers::Pool& p) const;
- /**
- * Gets maximum cache validity for the specified SimpleDateTime
- * conversion pattern.
- * @param pattern conversion pattern, may not be null.
- * @returns Duration in microseconds from an integral second
- * that the cache will return consistent results.
- */
- static int getMaximumCacheValidity(const LogString& pattern);
+ /**
+ * Gets maximum cache validity for the specified SimpleDateTime
+ * conversion pattern.
+ * @param pattern conversion pattern, may not be null.
+ * @returns Duration in microseconds from an integral second
+ * that the cache will return consistent results.
+ */
+ static int getMaximumCacheValidity(const LogString& pattern);
- private:
- CachedDateFormat(const CachedDateFormat&);
- CachedDateFormat& operator=(const CachedDateFormat&);
+ private:
+ CachedDateFormat(const CachedDateFormat&);
+ CachedDateFormat& operator=(const CachedDateFormat&);
- /**
- * Tests if two string regions are equal.
- * @param target target string.
- * @param toffset character position in target to start comparison.
- * @param other other string.
- * @param ooffset character position in other to start comparison.
- * @param len length of region.
- * @return true if regions are equal.
- */
- static bool regionMatches(
- const LogString& target,
- size_t toffset,
- const LogString& other,
- size_t ooffset,
- size_t len);
+ /**
+ * Tests if two string regions are equal.
+ * @param target target string.
+ * @param toffset character position in target to start comparison.
+ * @param other other string.
+ * @param ooffset character position in other to start comparison.
+ * @param len length of region.
+ * @return true if regions are equal.
+ */
+ static bool regionMatches(
+ const LogString& target,
+ size_t toffset,
+ const LogString& other,
+ size_t ooffset,
+ size_t len);
};
diff --git a/src/main/include/log4cxx/helpers/charsetdecoder.h b/src/main/include/log4cxx/helpers/charsetdecoder.h
index 7523505..7b6e3f9 100644
--- a/src/main/include/log4cxx/helpers/charsetdecoder.h
+++ b/src/main/include/log4cxx/helpers/charsetdecoder.h
@@ -35,78 +35,78 @@
*/
class LOG4CXX_EXPORT CharsetDecoder : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(CharsetDecoder)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(CharsetDecoder)
- END_LOG4CXX_CAST_MAP()
- protected:
- /**
- * Protected constructor.
- */
- CharsetDecoder();
- public:
- /**
- * Destructor.
- */
- virtual ~CharsetDecoder();
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(CharsetDecoder)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(CharsetDecoder)
+ END_LOG4CXX_CAST_MAP()
+ protected:
+ /**
+ * Protected constructor.
+ */
+ CharsetDecoder();
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~CharsetDecoder();
- /**
- * Get decoder for default charset.
- */
- static CharsetDecoderPtr getDefaultDecoder();
- /**
- * Get decoder for specified character set.
- * @param charset the following values should be recognized:
- * "US-ASCII", "ISO-8859-1", "UTF-8",
- * "UTF-16BE", "UTF-16LE".
- * @return decoder
- * @throws IllegalArgumentException if charset is not recognized.
- */
- static CharsetDecoderPtr getDecoder(const LogString& charset);
+ /**
+ * Get decoder for default charset.
+ */
+ static CharsetDecoderPtr getDefaultDecoder();
+ /**
+ * Get decoder for specified character set.
+ * @param charset the following values should be recognized:
+ * "US-ASCII", "ISO-8859-1", "UTF-8",
+ * "UTF-16BE", "UTF-16LE".
+ * @return decoder
+ * @throws IllegalArgumentException if charset is not recognized.
+ */
+ static CharsetDecoderPtr getDecoder(const LogString& charset);
- /**
- * Get decoder for UTF-8.
- */
- static CharsetDecoderPtr getUTF8Decoder();
- /**
- * Get decoder for ISO-8859-1.
- */
- static CharsetDecoderPtr getISOLatinDecoder();
+ /**
+ * Get decoder for UTF-8.
+ */
+ static CharsetDecoderPtr getUTF8Decoder();
+ /**
+ * Get decoder for ISO-8859-1.
+ */
+ static CharsetDecoderPtr getISOLatinDecoder();
- /**
- * Decodes as many bytes as possible from the given
- * input buffer, writing the results to the given output string.
- * @param in input buffer.
- * @param out output string.
- * @return APR_SUCCESS if not encoding errors were found.
- */
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out) = 0;
+ /**
+ * Decodes as many bytes as possible from the given
+ * input buffer, writing the results to the given output string.
+ * @param in input buffer.
+ * @param out output string.
+ * @return APR_SUCCESS if not encoding errors were found.
+ */
+ virtual log4cxx_status_t decode(ByteBuffer& in,
+ LogString& out) = 0;
- /**
- * Determins if status value indicates an invalid byte sequence.
- */
- inline static bool isError(log4cxx_status_t stat)
- {
- return (stat != 0);
- }
+ /**
+ * Determins if status value indicates an invalid byte sequence.
+ */
+ inline static bool isError(log4cxx_status_t stat)
+ {
+ return (stat != 0);
+ }
- private:
- /**
- * Private copy constructor.
- */
- CharsetDecoder(const CharsetDecoder&);
- /**
- * Private assignment operator.
- */
- CharsetDecoder& operator=(const CharsetDecoder&);
- /**
- * Creates a new decoder for the default charset.
- */
- static CharsetDecoder* createDefaultDecoder();
+ private:
+ /**
+ * Private copy constructor.
+ */
+ CharsetDecoder(const CharsetDecoder&);
+ /**
+ * Private assignment operator.
+ */
+ CharsetDecoder& operator=(const CharsetDecoder&);
+ /**
+ * Creates a new decoder for the default charset.
+ */
+ static CharsetDecoder* createDefaultDecoder();
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/charsetencoder.h b/src/main/include/log4cxx/helpers/charsetencoder.h
index f9e5465..1a1c3ae 100644
--- a/src/main/include/log4cxx/helpers/charsetencoder.h
+++ b/src/main/include/log4cxx/helpers/charsetencoder.h
@@ -36,98 +36,98 @@
*/
class LOG4CXX_EXPORT CharsetEncoder : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(CharsetEncoder)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(CharsetEncoder)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(CharsetEncoder)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(CharsetEncoder)
+ END_LOG4CXX_CAST_MAP()
- protected:
- /**
- * Protected constructor.
- */
- CharsetEncoder();
+ protected:
+ /**
+ * Protected constructor.
+ */
+ CharsetEncoder();
- public:
- /**
- * Destructor.
- */
- virtual ~CharsetEncoder();
- /**
- * Get encoder for default charset.
- */
- static CharsetEncoderPtr getDefaultEncoder();
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~CharsetEncoder();
+ /**
+ * Get encoder for default charset.
+ */
+ static CharsetEncoderPtr getDefaultEncoder();
- /**
- * Get encoder for specified character set.
- * @param charset the following values should be recognized:
- * "US-ASCII", "ISO-8859-1", "UTF-8",
- * "UTF-16BE", "UTF-16LE".
- * @return encoder.
- * @throws IllegalArgumentException if encoding is not recognized.
- */
- static CharsetEncoderPtr getEncoder(const LogString& charset);
+ /**
+ * Get encoder for specified character set.
+ * @param charset the following values should be recognized:
+ * "US-ASCII", "ISO-8859-1", "UTF-8",
+ * "UTF-16BE", "UTF-16LE".
+ * @return encoder.
+ * @throws IllegalArgumentException if encoding is not recognized.
+ */
+ static CharsetEncoderPtr getEncoder(const LogString& charset);
- /**
- * Get encoder for UTF-8.
- */
- static CharsetEncoderPtr getUTF8Encoder();
+ /**
+ * Get encoder for UTF-8.
+ */
+ static CharsetEncoderPtr getUTF8Encoder();
- /**
- * Encodes a string replacing unmappable
- * characters with escape sequences.
- *
- */
- static void encode(CharsetEncoderPtr& enc,
- const LogString& src,
- LogString::const_iterator& iter,
- ByteBuffer& dst);
+ /**
+ * Encodes a string replacing unmappable
+ * characters with escape sequences.
+ *
+ */
+ static void encode(CharsetEncoderPtr& enc,
+ const LogString& src,
+ LogString::const_iterator& iter,
+ ByteBuffer& dst);
- /**
- * Encodes as many characters from the input string as possible
- * to the output buffer.
- * @param in input string
- * @param iter position in string to start.
- * @param out output buffer.
- * @return APR_SUCCESS unless a character can not be represented in
- * the encoding.
- */
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) = 0;
+ /**
+ * Encodes as many characters from the input string as possible
+ * to the output buffer.
+ * @param in input string
+ * @param iter position in string to start.
+ * @param out output buffer.
+ * @return APR_SUCCESS unless a character can not be represented in
+ * the encoding.
+ */
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out) = 0;
- /**
- * Resets any internal state.
- */
- virtual void reset();
+ /**
+ * Resets any internal state.
+ */
+ virtual void reset();
- /**
- * Flushes the encoder.
- */
- virtual void flush(ByteBuffer& out);
+ /**
+ * Flushes the encoder.
+ */
+ virtual void flush(ByteBuffer& out);
- /**
- * Determines if the return value from encode indicates
- * an unconvertable character.
- */
- inline static bool isError(log4cxx_status_t stat)
- {
- return (stat != 0);
- }
+ /**
+ * Determines if the return value from encode indicates
+ * an unconvertable character.
+ */
+ inline static bool isError(log4cxx_status_t stat)
+ {
+ return (stat != 0);
+ }
- private:
- /**
- * Private copy constructor.
- */
- CharsetEncoder(const CharsetEncoder&);
- /**
- * Private assignment operator.
- */
- CharsetEncoder& operator=(const CharsetEncoder&);
+ private:
+ /**
+ * Private copy constructor.
+ */
+ CharsetEncoder(const CharsetEncoder&);
+ /**
+ * Private assignment operator.
+ */
+ CharsetEncoder& operator=(const CharsetEncoder&);
- static CharsetEncoder* createDefaultEncoder();
+ static CharsetEncoder* createDefaultEncoder();
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/class.h b/src/main/include/log4cxx/helpers/class.h
index 1d9655d..7c9fdf6 100644
--- a/src/main/include/log4cxx/helpers/class.h
+++ b/src/main/include/log4cxx/helpers/class.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_CLASS_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -38,29 +38,29 @@
class LOG4CXX_EXPORT Class
{
- public:
- virtual ~Class();
- virtual ObjectPtr newInstance() const;
- LogString toString() const;
- virtual LogString getName() const = 0;
- static const Class& forName(const LogString& className);
- static bool registerClass(const Class& newClass);
+ public:
+ virtual ~Class();
+ virtual ObjectPtr newInstance() const;
+ LogString toString() const;
+ virtual LogString getName() const = 0;
+ static const Class& forName(const LogString& className);
+ static bool registerClass(const Class& newClass);
- protected:
- Class();
+ protected:
+ Class();
- private:
- Class(const Class&);
- Class& operator=(const Class&);
- typedef std::map<LogString, const Class*> ClassMap;
- static ClassMap& getRegistry();
- static void registerClasses();
+ private:
+ Class(const Class&);
+ Class& operator=(const Class&);
+ typedef std::map<LogString, const Class*> ClassMap;
+ static ClassMap& getRegistry();
+ static void registerClasses();
};
} // namespace log4cxx
} // namespace helper
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/helpers/classregistration.h b/src/main/include/log4cxx/helpers/classregistration.h
index 45468ae..cbf09bc 100644
--- a/src/main/include/log4cxx/helpers/classregistration.h
+++ b/src/main/include/log4cxx/helpers/classregistration.h
@@ -27,13 +27,13 @@
class Class;
class LOG4CXX_EXPORT ClassRegistration
{
- public:
- typedef const Class& (*ClassAccessor)();
- ClassRegistration(ClassAccessor classAccessor);
+ public:
+ typedef const Class& (*ClassAccessor)();
+ ClassRegistration(ClassAccessor classAccessor);
- private:
- ClassRegistration(const ClassRegistration&);
- ClassRegistration& operator=(const ClassRegistration&);
+ private:
+ ClassRegistration(const ClassRegistration&);
+ ClassRegistration& operator=(const ClassRegistration&);
};
} // namespace log4cxx
} // namespace helper
diff --git a/src/main/include/log4cxx/helpers/condition.h b/src/main/include/log4cxx/helpers/condition.h
index 8b25c4f..9ceb790 100644
--- a/src/main/include/log4cxx/helpers/condition.h
+++ b/src/main/include/log4cxx/helpers/condition.h
@@ -22,7 +22,7 @@
#include <log4cxx/helpers/mutex.h>
extern "C" {
- struct apr_thread_cond_t;
+ struct apr_thread_cond_t;
}
namespace log4cxx
@@ -38,34 +38,34 @@
*/
class LOG4CXX_EXPORT Condition
{
- public:
- /**
- * Create new instance.
- * @param p pool on which condition will be created. Needs to be
- * longer-lived than created instance.
- */
- Condition(log4cxx::helpers::Pool& p);
- /**
- * Destructor.
- */
- ~Condition();
- /**
- * Signal all waiting threads.
- */
- log4cxx_status_t signalAll();
- /**
- * Await signaling of condition.
- * @param lock lock associated with condition, calling thread must
- * own lock. Lock will be released while waiting and reacquired
- * before returning from wait.
- * @throws InterruptedException if thread is interrupted.
- */
- void await(Mutex& lock);
+ public:
+ /**
+ * Create new instance.
+ * @param p pool on which condition will be created. Needs to be
+ * longer-lived than created instance.
+ */
+ Condition(log4cxx::helpers::Pool& p);
+ /**
+ * Destructor.
+ */
+ ~Condition();
+ /**
+ * Signal all waiting threads.
+ */
+ log4cxx_status_t signalAll();
+ /**
+ * Await signaling of condition.
+ * @param lock lock associated with condition, calling thread must
+ * own lock. Lock will be released while waiting and reacquired
+ * before returning from wait.
+ * @throws InterruptedException if thread is interrupted.
+ */
+ void await(Mutex& lock);
- private:
- apr_thread_cond_t* condition;
- Condition(const Condition&);
- Condition& operator=(const Condition&);
+ private:
+ apr_thread_cond_t* condition;
+ Condition(const Condition&);
+ Condition& operator=(const Condition&);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/cyclicbuffer.h b/src/main/include/log4cxx/helpers/cyclicbuffer.h
index e0badd1..0456dcd 100644
--- a/src/main/include/log4cxx/helpers/cyclicbuffer.h
+++ b/src/main/include/log4cxx/helpers/cyclicbuffer.h
@@ -33,62 +33,62 @@
*/
class LOG4CXX_EXPORT CyclicBuffer
{
- log4cxx::spi::LoggingEventList ea;
- int first;
- int last;
- int numElems;
- int maxSize;
+ log4cxx::spi::LoggingEventList ea;
+ int first;
+ int last;
+ int numElems;
+ int maxSize;
- public:
- /**
- Instantiate a new CyclicBuffer of at most <code>maxSize</code>
- events.
- The <code>maxSize</code> argument must a positive integer.
- @param maxSize The maximum number of elements in the buffer.
- @throws IllegalArgumentException if <code>maxSize</code>
- is negative.
- */
- CyclicBuffer(int maxSize);
- ~CyclicBuffer();
+ public:
+ /**
+ Instantiate a new CyclicBuffer of at most <code>maxSize</code>
+ events.
+ The <code>maxSize</code> argument must a positive integer.
+ @param maxSize The maximum number of elements in the buffer.
+ @throws IllegalArgumentException if <code>maxSize</code>
+ is negative.
+ */
+ CyclicBuffer(int maxSize);
+ ~CyclicBuffer();
- /**
- Add an <code>event</code> as the last event in the buffer.
- */
- void add(const spi::LoggingEventPtr& event);
+ /**
+ Add an <code>event</code> as the last event in the buffer.
+ */
+ void add(const spi::LoggingEventPtr& event);
- /**
- Get the <i>i</i>th oldest event currently in the buffer. If
- <em>i</em> is outside the range 0 to the number of elements
- currently in the buffer, then <code>null</code> is returned.
- */
- spi::LoggingEventPtr get(int i);
+ /**
+ Get the <i>i</i>th oldest event currently in the buffer. If
+ <em>i</em> is outside the range 0 to the number of elements
+ currently in the buffer, then <code>null</code> is returned.
+ */
+ spi::LoggingEventPtr get(int i);
- int getMaxSize() const
- {
- return maxSize;
- }
+ int getMaxSize() const
+ {
+ return maxSize;
+ }
- /**
- Get the oldest (first) element in the buffer. The oldest element
- is removed from the buffer.
- */
- spi::LoggingEventPtr get();
+ /**
+ Get the oldest (first) element in the buffer. The oldest element
+ is removed from the buffer.
+ */
+ spi::LoggingEventPtr get();
- /**
- Get the number of elements in the buffer. This number is
- guaranteed to be in the range 0 to <code>maxSize</code>
- (inclusive).
- */
- int length() const
- {
- return numElems;
- }
+ /**
+ Get the number of elements in the buffer. This number is
+ guaranteed to be in the range 0 to <code>maxSize</code>
+ (inclusive).
+ */
+ int length() const
+ {
+ return numElems;
+ }
- /**
- Resize the cyclic buffer to <code>newSize</code>.
- @throws IllegalArgumentException if <code>newSize</code> is negative.
- */
- void resize(int newSize);
+ /**
+ Resize the cyclic buffer to <code>newSize</code>.
+ @throws IllegalArgumentException if <code>newSize</code> is negative.
+ */
+ void resize(int newSize);
}; // class CyclicBuffer
} //namespace helpers
} //namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/datagrampacket.h b/src/main/include/log4cxx/helpers/datagrampacket.h
index 29a2595..093d0c6 100644
--- a/src/main/include/log4cxx/helpers/datagrampacket.h
+++ b/src/main/include/log4cxx/helpers/datagrampacket.h
@@ -36,118 +36,118 @@
*/
class LOG4CXX_EXPORT DatagramPacket : public helpers::ObjectImpl
{
- protected:
- /** the data for this packet. */
- void* buf;
+ protected:
+ /** the data for this packet. */
+ void* buf;
- /** The offset of the data for this packet. */
- int offset;
+ /** The offset of the data for this packet. */
+ int offset;
- /** The length of the data for this packet. */
- int length;
+ /** The length of the data for this packet. */
+ int length;
- /** The IP address for this packet. */
- InetAddressPtr address;
+ /** The IP address for this packet. */
+ InetAddressPtr address;
- /** The UDP port number of the remote host. */
- int port;
+ /** The UDP port number of the remote host. */
+ int port;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramPacket)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DatagramPacket)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramPacket)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DatagramPacket)
+ END_LOG4CXX_CAST_MAP()
- /** Constructs a DatagramPacket for receiving packets of length
- <code>length</code>. */
- DatagramPacket(void* buf, int length);
+ /** Constructs a DatagramPacket for receiving packets of length
+ <code>length</code>. */
+ DatagramPacket(void* buf, int length);
- /** Constructs a datagram packet for sending packets of length
- <code>length</code> to the specified port number on the specified
- host. */
- DatagramPacket(void* buf, int length, InetAddressPtr address, int port);
+ /** Constructs a datagram packet for sending packets of length
+ <code>length</code> to the specified port number on the specified
+ host. */
+ DatagramPacket(void* buf, int length, InetAddressPtr address, int port);
- /** Constructs a DatagramPacket for receiving packets of length
- <code>length</code>, specifying an offset into the buffer. */
- DatagramPacket(void* buf, int offset, int length);
+ /** Constructs a DatagramPacket for receiving packets of length
+ <code>length</code>, specifying an offset into the buffer. */
+ DatagramPacket(void* buf, int offset, int length);
- /** Constructs a datagram packet for sending packets of length
- <code>length</code> with offset <code>offset</code> to the
- specified port number on the specified host. */
- DatagramPacket(void* buf, int offset, int length, InetAddressPtr address,
- int port);
+ /** Constructs a datagram packet for sending packets of length
+ <code>length</code> with offset <code>offset</code> to the
+ specified port number on the specified host. */
+ DatagramPacket(void* buf, int offset, int length, InetAddressPtr address,
+ int port);
- ~DatagramPacket();
+ ~DatagramPacket();
- /** Returns the IP address of the machine to which this datagram
- is being sent or from which the datagram was received. */
- inline InetAddressPtr getAddress() const
- {
- return address;
- }
+ /** Returns the IP address of the machine to which this datagram
+ is being sent or from which the datagram was received. */
+ inline InetAddressPtr getAddress() const
+ {
+ return address;
+ }
- /** Returns the data received or the data to be sent. */
- inline void* getData() const
- {
- return buf;
- }
+ /** Returns the data received or the data to be sent. */
+ inline void* getData() const
+ {
+ return buf;
+ }
- /** Returns the length of the data to be sent or the length of the
- data received. */
- inline int getLength() const
- {
- return length;
- }
+ /** Returns the length of the data to be sent or the length of the
+ data received. */
+ inline int getLength() const
+ {
+ return length;
+ }
- /** Returns the offset of the data to be sent or the offset of the
- data received. */
- inline int getOffset() const
- {
- return offset;
- }
+ /** Returns the offset of the data to be sent or the offset of the
+ data received. */
+ inline int getOffset() const
+ {
+ return offset;
+ }
- /** Returns the port number on the remote host to which this
- datagram is being sent or from which the datagram was received. */
- inline int getPort() const
- {
- return port;
- }
+ /** Returns the port number on the remote host to which this
+ datagram is being sent or from which the datagram was received. */
+ inline int getPort() const
+ {
+ return port;
+ }
- inline void setAddress(InetAddressPtr address1)
- {
- this->address = address1;
- }
+ inline void setAddress(InetAddressPtr address1)
+ {
+ this->address = address1;
+ }
- /** Set the data buffer for this packet. */
- inline void setData(void* buf1)
- {
- this->buf = buf1;
- }
+ /** Set the data buffer for this packet. */
+ inline void setData(void* buf1)
+ {
+ this->buf = buf1;
+ }
- /** Set the data buffer for this packet. */
- inline void setData(void* buf1, int offset1, int length1)
- {
- this->buf = buf1;
- this->offset = offset1;
- this->length = length1;
- }
+ /** Set the data buffer for this packet. */
+ inline void setData(void* buf1, int offset1, int length1)
+ {
+ this->buf = buf1;
+ this->offset = offset1;
+ this->length = length1;
+ }
- /** Set the length for this packet. */
- inline void setLength(int length1)
- {
- this->length = length1;
- }
+ /** Set the length for this packet. */
+ inline void setLength(int length1)
+ {
+ this->length = length1;
+ }
- inline void setPort(int port1)
- {
- this->port = port1;
- }
+ inline void setPort(int port1)
+ {
+ this->port = port1;
+ }
- private:
- //
- // prevent copy and assignment statements
- DatagramPacket(const DatagramPacket&);
- DatagramPacket& operator=(const DatagramPacket&);
+ private:
+ //
+ // prevent copy and assignment statements
+ DatagramPacket(const DatagramPacket&);
+ DatagramPacket& operator=(const DatagramPacket&);
}; // class DatagramPacket
LOG4CXX_PTR_DEF(DatagramPacket);
diff --git a/src/main/include/log4cxx/helpers/datagramsocket.h b/src/main/include/log4cxx/helpers/datagramsocket.h
index aa1ef35..619ae17 100644
--- a/src/main/include/log4cxx/helpers/datagramsocket.h
+++ b/src/main/include/log4cxx/helpers/datagramsocket.h
@@ -25,7 +25,7 @@
#include <log4cxx/helpers/datagrampacket.h>
extern "C" {
- struct apr_socket_t;
+ struct apr_socket_t;
}
namespace log4cxx
@@ -36,105 +36,105 @@
datagram packets.*/
class LOG4CXX_EXPORT DatagramSocket : public helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramSocket)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DatagramSocket)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramSocket)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DatagramSocket)
+ END_LOG4CXX_CAST_MAP()
- /** Constructs a datagram socket and binds it to any available port
- on the local host machine.*/
- DatagramSocket();
+ /** Constructs a datagram socket and binds it to any available port
+ on the local host machine.*/
+ DatagramSocket();
- /** Constructs a datagram socket and binds it to the specified
- port on the local host machine. */
- DatagramSocket(int port);
+ /** Constructs a datagram socket and binds it to the specified
+ port on the local host machine. */
+ DatagramSocket(int port);
- /** Creates a datagram socket, bound to the specified local
- address. */
- DatagramSocket(int port, InetAddressPtr laddr);
+ /** Creates a datagram socket, bound to the specified local
+ address. */
+ DatagramSocket(int port, InetAddressPtr laddr);
- /** ensure the socket is closed. */
- ~DatagramSocket();
+ /** ensure the socket is closed. */
+ ~DatagramSocket();
- /** Binds a datagram socket to a local port and address.*/
- void bind(int lport, InetAddressPtr laddress);
+ /** Binds a datagram socket to a local port and address.*/
+ void bind(int lport, InetAddressPtr laddress);
- /** Creates a datagram socket.*/
- void create();
+ /** Creates a datagram socket.*/
+ void create();
- /** Closes this datagram socket */
- void close();
+ /** Closes this datagram socket */
+ void close();
- /** Connects the socket to a remote address for this socket. */
- void connect(InetAddressPtr address, int port);
+ /** Connects the socket to a remote address for this socket. */
+ void connect(InetAddressPtr address, int port);
- /** Returns the address to which this socket is connected. */
- inline InetAddressPtr getInetAddress() const
- {
- return address;
- }
+ /** Returns the address to which this socket is connected. */
+ inline InetAddressPtr getInetAddress() const
+ {
+ return address;
+ }
- /** Gets the local address to which the socket is bound. */
- inline InetAddressPtr getLocalAddress() const
- {
- return localAddress;
- }
+ /** Gets the local address to which the socket is bound. */
+ inline InetAddressPtr getLocalAddress() const
+ {
+ return localAddress;
+ }
- /** Returns the port number on the local host to which this
- socket is bound. */
- inline int getLocalPort() const
- {
- return localPort;
- }
+ /** Returns the port number on the local host to which this
+ socket is bound. */
+ inline int getLocalPort() const
+ {
+ return localPort;
+ }
- /** Returns the port for this socket */
- inline int getPort() const
- {
- return port;
- }
+ /** Returns the port for this socket */
+ inline int getPort() const
+ {
+ return port;
+ }
- /** Returns the binding state of the socket. **/
- inline bool isBound() const
- {
- return localPort != 0;
- }
+ /** Returns the binding state of the socket. **/
+ inline bool isBound() const
+ {
+ return localPort != 0;
+ }
- /** Returns wether the socket is closed or not. */
- inline bool isClosed() const
- {
- return socket != 0;
- }
+ /** Returns wether the socket is closed or not. */
+ inline bool isClosed() const
+ {
+ return socket != 0;
+ }
- /** Returns the connection state of the socket. */
- inline bool isConnected() const
- {
- return port != 0;
- }
+ /** Returns the connection state of the socket. */
+ inline bool isConnected() const
+ {
+ return port != 0;
+ }
- /** Receives a datagram packet from this socket. */
- void receive(DatagramPacketPtr& p);
+ /** Receives a datagram packet from this socket. */
+ void receive(DatagramPacketPtr& p);
- /** Sends a datagram packet from this socket. */
- void send(DatagramPacketPtr& p);
+ /** Sends a datagram packet from this socket. */
+ void send(DatagramPacketPtr& p);
- private:
- DatagramSocket(const DatagramSocket&);
- DatagramSocket& operator=(const DatagramSocket&);
- /** The APR socket */
- apr_socket_t* socket;
+ private:
+ DatagramSocket(const DatagramSocket&);
+ DatagramSocket& operator=(const DatagramSocket&);
+ /** The APR socket */
+ apr_socket_t* socket;
- /** The memory pool for the socket */
- Pool socketPool;
+ /** The memory pool for the socket */
+ Pool socketPool;
- InetAddressPtr address;
+ InetAddressPtr address;
- InetAddressPtr localAddress;
+ InetAddressPtr localAddress;
- int port;
+ int port;
- /** The local port number to which this socket is connected. */
- int localPort;
+ /** The local port number to which this socket is connected. */
+ int localPort;
};
LOG4CXX_PTR_DEF(DatagramSocket);
diff --git a/src/main/include/log4cxx/helpers/date.h b/src/main/include/log4cxx/helpers/date.h
index 79217b5..0629994 100644
--- a/src/main/include/log4cxx/helpers/date.h
+++ b/src/main/include/log4cxx/helpers/date.h
@@ -34,31 +34,31 @@
*/
class LOG4CXX_EXPORT Date : public ObjectImpl
{
- const log4cxx_time_t time;
+ const log4cxx_time_t time;
- public:
- DECLARE_LOG4CXX_OBJECT(Date)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Date)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(Date)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Date)
+ END_LOG4CXX_CAST_MAP()
- Date();
- Date(log4cxx_time_t time);
- virtual ~Date();
+ Date();
+ Date(log4cxx_time_t time);
+ virtual ~Date();
- inline log4cxx_time_t getTime() const
- {
- return time;
- }
+ inline log4cxx_time_t getTime() const
+ {
+ return time;
+ }
- /**
- * Get start of next second
- */
- log4cxx_time_t getNextSecond() const;
+ /**
+ * Get start of next second
+ */
+ log4cxx_time_t getNextSecond() const;
- static log4cxx_time_t getMicrosecondsPerDay();
- static log4cxx_time_t getMicrosecondsPerSecond();
+ static log4cxx_time_t getMicrosecondsPerDay();
+ static log4cxx_time_t getMicrosecondsPerSecond();
};
diff --git a/src/main/include/log4cxx/helpers/dateformat.h b/src/main/include/log4cxx/helpers/dateformat.h
index 11f9724..39ff206 100644
--- a/src/main/include/log4cxx/helpers/dateformat.h
+++ b/src/main/include/log4cxx/helpers/dateformat.h
@@ -32,57 +32,57 @@
*/
class LOG4CXX_EXPORT DateFormat : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(DateFormat)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DateFormat)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(DateFormat)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DateFormat)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Destructor
- */
- virtual ~DateFormat();
+ /**
+ * Destructor
+ */
+ virtual ~DateFormat();
- /**
- * Formats an log4cxx_time_t into a date/time string.
- * @param s string to which the date/time string is appended.
- * @param tm date to be formatted.
- * @param p memory pool used during formatting.
- */
- virtual void format(LogString& s, log4cxx_time_t tm, log4cxx::helpers::Pool& p) const = 0;
+ /**
+ * Formats an log4cxx_time_t into a date/time string.
+ * @param s string to which the date/time string is appended.
+ * @param tm date to be formatted.
+ * @param p memory pool used during formatting.
+ */
+ virtual void format(LogString& s, log4cxx_time_t tm, log4cxx::helpers::Pool& p) const = 0;
- /**
- * Sets the time zone.
- * @param zone the given new time zone.
- */
- virtual void setTimeZone(const TimeZonePtr& zone);
+ /**
+ * Sets the time zone.
+ * @param zone the given new time zone.
+ */
+ virtual void setTimeZone(const TimeZonePtr& zone);
- /**
- * Format an integer consistent with the format method.
- * @param s string to which the numeric string is appended.
- * @param n integer value.
- * @param p memory pool used during formatting.
- * @remarks This method is used by CachedDateFormat to
- * format the milliseconds.
- */
- virtual void numberFormat(LogString& s, int n, log4cxx::helpers::Pool& p) const;
+ /**
+ * Format an integer consistent with the format method.
+ * @param s string to which the numeric string is appended.
+ * @param n integer value.
+ * @param p memory pool used during formatting.
+ * @remarks This method is used by CachedDateFormat to
+ * format the milliseconds.
+ */
+ virtual void numberFormat(LogString& s, int n, log4cxx::helpers::Pool& p) const;
- protected:
- /**
- * Constructor.
- */
- DateFormat();
+ protected:
+ /**
+ * Constructor.
+ */
+ DateFormat();
- private:
- /**
- * Copy constructor definition to prevent copying.
- */
- DateFormat(const DateFormat&);
- /**
- * Assignment definition to prevent assignment.
- */
- DateFormat& operator=(const DateFormat&);
+ private:
+ /**
+ * Copy constructor definition to prevent copying.
+ */
+ DateFormat(const DateFormat&);
+ /**
+ * Assignment definition to prevent assignment.
+ */
+ DateFormat& operator=(const DateFormat&);
};
LOG4CXX_PTR_DEF(DateFormat);
diff --git a/src/main/include/log4cxx/helpers/datelayout.h b/src/main/include/log4cxx/helpers/datelayout.h
index eb255c9..6796d9f 100644
--- a/src/main/include/log4cxx/helpers/datelayout.h
+++ b/src/main/include/log4cxx/helpers/datelayout.h
@@ -32,65 +32,65 @@
*/
class LOG4CXX_EXPORT DateLayout : public Layout
{
- private:
- LogString timeZoneID;
- LogString dateFormatOption;
+ private:
+ LogString timeZoneID;
+ LogString dateFormatOption;
- protected:
- DateFormatPtr dateFormat;
+ protected:
+ DateFormatPtr dateFormat;
- public:
- DateLayout(const LogString& dateLayoutOption);
- virtual ~DateLayout();
+ public:
+ DateLayout(const LogString& dateLayoutOption);
+ virtual ~DateLayout();
- virtual void activateOptions(log4cxx::helpers::Pool& p);
- virtual void setOption(const LogString& option, const LogString& value);
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- The value of the <b>DateFormat</b> option should be either an
- argument to the constructor of helpers::DateFormat or one of
- the strings <b>"NULL"</b>, <b>"RELATIVE"</b>, <b>"ABSOLUTE"</b>,
- <b>"DATE"</b> or <b>"ISO8601</b>.
- */
- inline void setDateFormat(const LogString& dateFormat1)
- {
- this->dateFormatOption.assign(dateFormat1);
- }
+ /**
+ The value of the <b>DateFormat</b> option should be either an
+ argument to the constructor of helpers::DateFormat or one of
+ the strings <b>"NULL"</b>, <b>"RELATIVE"</b>, <b>"ABSOLUTE"</b>,
+ <b>"DATE"</b> or <b>"ISO8601</b>.
+ */
+ inline void setDateFormat(const LogString& dateFormat1)
+ {
+ this->dateFormatOption.assign(dateFormat1);
+ }
- /**
- Returns value of the <b>DateFormat</b> option.
- */
- inline const LogString& getDateFormat() const
- {
- return dateFormatOption;
- }
+ /**
+ Returns value of the <b>DateFormat</b> option.
+ */
+ inline const LogString& getDateFormat() const
+ {
+ return dateFormatOption;
+ }
- /**
- The <b>TimeZoneID</b> option is a time zone ID string in the format
- expected by the <code>locale</code> C++ standard class.
- */
- inline void setTimeZone(const LogString& timeZone)
- {
- this->timeZoneID.assign(timeZone);
- }
+ /**
+ The <b>TimeZoneID</b> option is a time zone ID string in the format
+ expected by the <code>locale</code> C++ standard class.
+ */
+ inline void setTimeZone(const LogString& timeZone)
+ {
+ this->timeZoneID.assign(timeZone);
+ }
- /**
- Returns value of the <b>TimeZone</b> option.
- */
- inline const LogString& getTimeZone() const
- {
- return timeZoneID;
- }
+ /**
+ Returns value of the <b>TimeZone</b> option.
+ */
+ inline const LogString& getTimeZone() const
+ {
+ return timeZoneID;
+ }
- void formatDate(LogString& s,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& p) const;
+ void formatDate(LogString& s,
+ const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& p) const;
- private:
- //
- // prevent copy and assignment
- DateLayout(const DateLayout&);
- DateLayout& operator=(const DateLayout&);
+ private:
+ //
+ // prevent copy and assignment
+ DateLayout(const DateLayout&);
+ DateLayout& operator=(const DateLayout&);
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/datetimedateformat.h b/src/main/include/log4cxx/helpers/datetimedateformat.h
index f3521f5..4c2ea22 100644
--- a/src/main/include/log4cxx/helpers/datetimedateformat.h
+++ b/src/main/include/log4cxx/helpers/datetimedateformat.h
@@ -30,11 +30,11 @@
*/
class LOG4CXX_EXPORT DateTimeDateFormat : public SimpleDateFormat
{
- public:
- DateTimeDateFormat()
- : SimpleDateFormat(LOG4CXX_STR("dd MMM yyyy HH:mm:ss,SSS")) {}
- DateTimeDateFormat(const std::locale* locale)
- : SimpleDateFormat(LOG4CXX_STR("dd MMM yyyy HH:mm:ss,SSS"), locale) {}
+ public:
+ DateTimeDateFormat()
+ : SimpleDateFormat(LOG4CXX_STR("dd MMM yyyy HH:mm:ss,SSS")) {}
+ DateTimeDateFormat(const std::locale* locale)
+ : SimpleDateFormat(LOG4CXX_STR("dd MMM yyyy HH:mm:ss,SSS"), locale) {}
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/exception.h b/src/main/include/log4cxx/helpers/exception.h
index 6e5c826..0a1a8b0 100644
--- a/src/main/include/log4cxx/helpers/exception.h
+++ b/src/main/include/log4cxx/helpers/exception.h
@@ -31,15 +31,15 @@
*/
class LOG4CXX_EXPORT Exception : public ::std::exception
{
- public:
- Exception(const char* msg);
- Exception(const LogString& msg);
- Exception(const Exception& src);
- Exception& operator=(const Exception& src);
- const char* what() const throw();
- private:
- enum { MSG_SIZE = 128 };
- char msg[MSG_SIZE + 1];
+ public:
+ Exception(const char* msg);
+ Exception(const LogString& msg);
+ Exception(const Exception& src);
+ Exception& operator=(const Exception& src);
+ const char* what() const throw();
+ private:
+ enum { MSG_SIZE = 128 };
+ char msg[MSG_SIZE + 1];
}; // class Exception
/** RuntimeException is the parent class of those exceptions that can be
@@ -47,13 +47,13 @@
*/
class LOG4CXX_EXPORT RuntimeException : public Exception
{
- public:
- RuntimeException(log4cxx_status_t stat);
- RuntimeException(const LogString& msg);
- RuntimeException(const RuntimeException& msg);
- RuntimeException& operator=(const RuntimeException& src);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ RuntimeException(log4cxx_status_t stat);
+ RuntimeException(const LogString& msg);
+ RuntimeException(const RuntimeException& msg);
+ RuntimeException& operator=(const RuntimeException& src);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
}; // class RuntimeException
/** Thrown when an application attempts to use null in a case where an
@@ -61,20 +61,20 @@
*/
class LOG4CXX_EXPORT NullPointerException : public RuntimeException
{
- public:
- NullPointerException(const LogString& msg);
- NullPointerException(const NullPointerException& msg);
- NullPointerException& operator=(const NullPointerException& src);
+ public:
+ NullPointerException(const LogString& msg);
+ NullPointerException(const NullPointerException& msg);
+ NullPointerException& operator=(const NullPointerException& src);
}; // class NullPointerException
/** Thrown to indicate that a method has been passed
an illegal or inappropriate argument.*/
class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
{
- public:
- IllegalArgumentException(const LogString& msg);
- IllegalArgumentException(const IllegalArgumentException&);
- IllegalArgumentException& operator=(const IllegalArgumentException&);
+ public:
+ IllegalArgumentException(const LogString& msg);
+ IllegalArgumentException(const IllegalArgumentException&);
+ IllegalArgumentException& operator=(const IllegalArgumentException&);
}; // class IllegalArgumentException
/** Signals that an I/O exception of some sort has occurred. This class
@@ -83,87 +83,87 @@
*/
class LOG4CXX_EXPORT IOException : public Exception
{
- public:
- IOException();
- IOException(log4cxx_status_t stat);
- IOException(const LogString& msg);
- IOException(const IOException& src);
- IOException& operator=(const IOException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ IOException();
+ IOException(log4cxx_status_t stat);
+ IOException(const LogString& msg);
+ IOException(const IOException& src);
+ IOException& operator=(const IOException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT MissingResourceException : public Exception
{
- public:
- MissingResourceException(const LogString& key);
- MissingResourceException(const MissingResourceException& src);
- MissingResourceException& operator=(const MissingResourceException&);
- private:
- static LogString formatMessage(const LogString& key);
+ public:
+ MissingResourceException(const LogString& key);
+ MissingResourceException(const MissingResourceException& src);
+ MissingResourceException& operator=(const MissingResourceException&);
+ private:
+ static LogString formatMessage(const LogString& key);
};
class LOG4CXX_EXPORT PoolException : public Exception
{
- public:
- PoolException(log4cxx_status_t stat);
- PoolException(const PoolException& src);
- PoolException& operator=(const PoolException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ PoolException(log4cxx_status_t stat);
+ PoolException(const PoolException& src);
+ PoolException& operator=(const PoolException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT MutexException : public Exception
{
- public:
- MutexException(log4cxx_status_t stat);
- MutexException(const MutexException& src);
- MutexException& operator=(const MutexException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ MutexException(log4cxx_status_t stat);
+ MutexException(const MutexException& src);
+ MutexException& operator=(const MutexException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT InterruptedException : public Exception
{
- public:
- InterruptedException();
- InterruptedException(log4cxx_status_t stat);
- InterruptedException(const InterruptedException& src);
- InterruptedException& operator=(const InterruptedException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ InterruptedException();
+ InterruptedException(log4cxx_status_t stat);
+ InterruptedException(const InterruptedException& src);
+ InterruptedException& operator=(const InterruptedException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT ThreadException
- : public Exception
+ : public Exception
{
- public:
- ThreadException(log4cxx_status_t stat);
- ThreadException(const LogString& msg);
- ThreadException(const ThreadException& src);
- ThreadException& operator=(const ThreadException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ ThreadException(log4cxx_status_t stat);
+ ThreadException(const LogString& msg);
+ ThreadException(const ThreadException& src);
+ ThreadException& operator=(const ThreadException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT TranscoderException : public Exception
{
- public:
- TranscoderException(log4cxx_status_t stat);
- TranscoderException(const TranscoderException& src);
- TranscoderException& operator=(const TranscoderException&);
- private:
- static LogString formatMessage(log4cxx_status_t stat);
+ public:
+ TranscoderException(log4cxx_status_t stat);
+ TranscoderException(const TranscoderException& src);
+ TranscoderException& operator=(const TranscoderException&);
+ private:
+ static LogString formatMessage(log4cxx_status_t stat);
};
class LOG4CXX_EXPORT IllegalMonitorStateException
- : public Exception
+ : public Exception
{
- public:
- IllegalMonitorStateException(const LogString& msg);
- IllegalMonitorStateException(const IllegalMonitorStateException& msg);
- IllegalMonitorStateException& operator=(const IllegalMonitorStateException& msg);
+ public:
+ IllegalMonitorStateException(const LogString& msg);
+ IllegalMonitorStateException(const IllegalMonitorStateException& msg);
+ IllegalMonitorStateException& operator=(const IllegalMonitorStateException& msg);
};
/**
@@ -173,10 +173,10 @@
*/
class LOG4CXX_EXPORT InstantiationException : public Exception
{
- public:
- InstantiationException(const LogString& msg);
- InstantiationException(const InstantiationException& msg);
- InstantiationException& operator=(const InstantiationException& msg);
+ public:
+ InstantiationException(const LogString& msg);
+ InstantiationException(const InstantiationException& msg);
+ InstantiationException& operator=(const InstantiationException& msg);
};
/**
@@ -186,29 +186,29 @@
*/
class LOG4CXX_EXPORT ClassNotFoundException : public Exception
{
- public:
- ClassNotFoundException(const LogString& className);
- ClassNotFoundException(const ClassNotFoundException& msg);
- ClassNotFoundException& operator=(const ClassNotFoundException& msg);
- private:
- static LogString formatMessage(const LogString& className);
+ public:
+ ClassNotFoundException(const LogString& className);
+ ClassNotFoundException(const ClassNotFoundException& msg);
+ ClassNotFoundException& operator=(const ClassNotFoundException& msg);
+ private:
+ static LogString formatMessage(const LogString& className);
};
class NoSuchElementException : public Exception
{
- public:
- NoSuchElementException();
- NoSuchElementException(const NoSuchElementException&);
- NoSuchElementException& operator=(const NoSuchElementException&);
+ public:
+ NoSuchElementException();
+ NoSuchElementException(const NoSuchElementException&);
+ NoSuchElementException& operator=(const NoSuchElementException&);
};
class IllegalStateException : public Exception
{
- public:
- IllegalStateException();
- IllegalStateException(const IllegalStateException&);
- IllegalStateException& operator=(const IllegalStateException&);
+ public:
+ IllegalStateException();
+ IllegalStateException(const IllegalStateException&);
+ IllegalStateException& operator=(const IllegalStateException&);
};
/** Thrown to indicate that there is an error in the underlying
@@ -216,11 +216,11 @@
*/
class LOG4CXX_EXPORT SocketException : public IOException
{
- public:
- SocketException(const LogString& msg);
- SocketException(log4cxx_status_t status);
- SocketException(const SocketException&);
- SocketException& operator=(const SocketException&);
+ public:
+ SocketException(const LogString& msg);
+ SocketException(log4cxx_status_t status);
+ SocketException(const SocketException&);
+ SocketException& operator=(const SocketException&);
};
/** Signals that an error occurred while attempting to connect a socket
@@ -229,18 +229,18 @@
*/
class LOG4CXX_EXPORT ConnectException : public SocketException
{
- public:
- ConnectException(log4cxx_status_t status);
- ConnectException(const ConnectException& src);
- ConnectException& operator=(const ConnectException&);
+ public:
+ ConnectException(log4cxx_status_t status);
+ ConnectException(const ConnectException& src);
+ ConnectException& operator=(const ConnectException&);
};
class LOG4CXX_EXPORT ClosedChannelException : public SocketException
{
- public:
- ClosedChannelException();
- ClosedChannelException(const ClosedChannelException& src);
- ClosedChannelException& operator=(const ClosedChannelException&);
+ public:
+ ClosedChannelException();
+ ClosedChannelException(const ClosedChannelException& src);
+ ClosedChannelException& operator=(const ClosedChannelException&);
};
/** Signals that an error occurred while attempting to bind a socket to
@@ -249,10 +249,10 @@
*/
class LOG4CXX_EXPORT BindException : public SocketException
{
- public:
- BindException(log4cxx_status_t status);
- BindException(const BindException&);
- BindException& operator=(const BindException&);
+ public:
+ BindException(log4cxx_status_t status);
+ BindException(const BindException&);
+ BindException& operator=(const BindException&);
};
/** Signals that an I/O operation has been interrupted. An
@@ -263,10 +263,10 @@
*/
class LOG4CXX_EXPORT InterruptedIOException : public IOException
{
- public:
- InterruptedIOException(const LogString& msg);
- InterruptedIOException(const InterruptedIOException&);
- InterruptedIOException& operator=(const InterruptedIOException&);
+ public:
+ InterruptedIOException(const LogString& msg);
+ InterruptedIOException(const InterruptedIOException&);
+ InterruptedIOException& operator=(const InterruptedIOException&);
};
@@ -278,10 +278,10 @@
*/
class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
{
- public:
- SocketTimeoutException();
- SocketTimeoutException(const SocketTimeoutException&);
- SocketTimeoutException& operator=(const SocketTimeoutException&);
+ public:
+ SocketTimeoutException();
+ SocketTimeoutException(const SocketTimeoutException&);
+ SocketTimeoutException& operator=(const SocketTimeoutException&);
};
diff --git a/src/main/include/log4cxx/helpers/fileinputstream.h b/src/main/include/log4cxx/helpers/fileinputstream.h
index 6815307..613b33f 100644
--- a/src/main/include/log4cxx/helpers/fileinputstream.h
+++ b/src/main/include/log4cxx/helpers/fileinputstream.h
@@ -35,57 +35,57 @@
*/
class LOG4CXX_EXPORT FileInputStream : public InputStream
{
- private:
- Pool pool;
- apr_file_t* fileptr;
+ private:
+ Pool pool;
+ apr_file_t* fileptr;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileInputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FileInputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileInputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FileInputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Creates a FileInputStream by opening a connection to an actual
- * file, the file named by the path name name in the file system.
- *
- * @param filename The system-dependent file name.
- */
- FileInputStream(const LogString& filename);
- FileInputStream(const logchar* filename);
+ /**
+ * Creates a FileInputStream by opening a connection to an actual
+ * file, the file named by the path name name in the file system.
+ *
+ * @param filename The system-dependent file name.
+ */
+ FileInputStream(const LogString& filename);
+ FileInputStream(const logchar* filename);
- /**
- * Creates a FileInputStream by opening a connection to an actual
- * file, the file named by the File object file in the file system.
- *
- * @param aFile The file to be opened for reading.
- */
- FileInputStream(const File& aFile);
+ /**
+ * Creates a FileInputStream by opening a connection to an actual
+ * file, the file named by the File object file in the file system.
+ *
+ * @param aFile The file to be opened for reading.
+ */
+ FileInputStream(const File& aFile);
- virtual ~FileInputStream();
+ virtual ~FileInputStream();
- /**
- * Closes this file input stream and releases any system
- * resources associated with the stream.
- */
- virtual void close();
+ /**
+ * Closes this file input stream and releases any system
+ * resources associated with the stream.
+ */
+ virtual void close();
- /**
- * Reads a sequence of bytes into the given buffer.
- *
- * @param buf The buffer into which bytes are to be transferred.
- * @return the total number of bytes read into the buffer, or -1 if there
- * is no more data because the end of the stream has been reached.
- */
- virtual int read(ByteBuffer& buf);
+ /**
+ * Reads a sequence of bytes into the given buffer.
+ *
+ * @param buf The buffer into which bytes are to be transferred.
+ * @return the total number of bytes read into the buffer, or -1 if there
+ * is no more data because the end of the stream has been reached.
+ */
+ virtual int read(ByteBuffer& buf);
- private:
+ private:
- FileInputStream(const FileInputStream&);
+ FileInputStream(const FileInputStream&);
- FileInputStream& operator=(const FileInputStream&);
- void open(const LogString&);
+ FileInputStream& operator=(const FileInputStream&);
+ void open(const LogString&);
};
diff --git a/src/main/include/log4cxx/helpers/fileoutputstream.h b/src/main/include/log4cxx/helpers/fileoutputstream.h
index 961f90a..cb03067 100644
--- a/src/main/include/log4cxx/helpers/fileoutputstream.h
+++ b/src/main/include/log4cxx/helpers/fileoutputstream.h
@@ -34,36 +34,36 @@
*/
class LOG4CXX_EXPORT FileOutputStream : public OutputStream
{
- private:
- Pool pool;
- apr_file_t* fileptr;
+ private:
+ Pool pool;
+ apr_file_t* fileptr;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileOutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FileOutputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileOutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FileOutputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
+ END_LOG4CXX_CAST_MAP()
- FileOutputStream(const LogString& filename, bool append = false);
- FileOutputStream(const logchar* filename, bool append = false);
- virtual ~FileOutputStream();
+ FileOutputStream(const LogString& filename, bool append = false);
+ FileOutputStream(const logchar* filename, bool append = false);
+ virtual ~FileOutputStream();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(ByteBuffer& buf, Pool& p);
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(ByteBuffer& buf, Pool& p);
#ifdef LOG4CXX_MULTI_PROCESS
- apr_file_t* getFilePtr()
- {
- return fileptr;
- }
+ apr_file_t* getFilePtr()
+ {
+ return fileptr;
+ }
#endif
- private:
- FileOutputStream(const FileOutputStream&);
- FileOutputStream& operator=(const FileOutputStream&);
- static apr_file_t* open(const LogString& fn, bool append,
- log4cxx::helpers::Pool& p);
+ private:
+ FileOutputStream(const FileOutputStream&);
+ FileOutputStream& operator=(const FileOutputStream&);
+ static apr_file_t* open(const LogString& fn, bool append,
+ log4cxx::helpers::Pool& p);
};
LOG4CXX_PTR_DEF(FileOutputStream);
diff --git a/src/main/include/log4cxx/helpers/filewatchdog.h b/src/main/include/log4cxx/helpers/filewatchdog.h
index 5ea94ba..bc07d03 100644
--- a/src/main/include/log4cxx/helpers/filewatchdog.h
+++ b/src/main/include/log4cxx/helpers/filewatchdog.h
@@ -35,50 +35,50 @@
*/
class LOG4CXX_EXPORT FileWatchdog
{
- public:
- virtual ~FileWatchdog();
- /**
- The default delay between every file modification check, set to 60
- seconds. */
- static long DEFAULT_DELAY /*= 60000*/;
+ public:
+ virtual ~FileWatchdog();
+ /**
+ The default delay between every file modification check, set to 60
+ seconds. */
+ static long DEFAULT_DELAY /*= 60000*/;
- protected:
- /**
- The name of the file to observe for changes.
- */
- File file;
+ protected:
+ /**
+ The name of the file to observe for changes.
+ */
+ File file;
- /**
- The delay to observe between every check.
- By default set DEFAULT_DELAY.*/
- long delay;
- log4cxx_time_t lastModif;
- bool warnedAlready;
- volatile unsigned int interrupted;
+ /**
+ The delay to observe between every check.
+ By default set DEFAULT_DELAY.*/
+ long delay;
+ log4cxx_time_t lastModif;
+ bool warnedAlready;
+ volatile unsigned int interrupted;
- protected:
- FileWatchdog(const File& filename);
- virtual void doOnChange() = 0;
- void checkAndConfigure();
+ protected:
+ FileWatchdog(const File& filename);
+ virtual void doOnChange() = 0;
+ void checkAndConfigure();
- public:
- /**
- Set the delay to observe between each check of the file changes.
- */
- void setDelay(long delay1)
- {
- this->delay = delay1;
- }
+ public:
+ /**
+ Set the delay to observe between each check of the file changes.
+ */
+ void setDelay(long delay1)
+ {
+ this->delay = delay1;
+ }
- void start();
+ void start();
- private:
- static void* LOG4CXX_THREAD_FUNC run(apr_thread_t* thread, void* data);
- Pool pool;
- Thread thread;
+ private:
+ static void* LOG4CXX_THREAD_FUNC run(apr_thread_t* thread, void* data);
+ Pool pool;
+ Thread thread;
- FileWatchdog(const FileWatchdog&);
- FileWatchdog& operator=(const FileWatchdog&);
+ FileWatchdog(const FileWatchdog&);
+ FileWatchdog& operator=(const FileWatchdog&);
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/inetaddress.h b/src/main/include/log4cxx/helpers/inetaddress.h
index 1b0072d..53c0910 100644
--- a/src/main/include/log4cxx/helpers/inetaddress.h
+++ b/src/main/include/log4cxx/helpers/inetaddress.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPER_INETADDRESS_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -37,10 +37,10 @@
{
class LOG4CXX_EXPORT UnknownHostException : public Exception
{
- public:
- UnknownHostException(const LogString& msg);
- UnknownHostException(const UnknownHostException& src);
- UnknownHostException& operator=(const UnknownHostException& src);
+ public:
+ UnknownHostException(const LogString& msg);
+ UnknownHostException(const UnknownHostException& src);
+ UnknownHostException& operator=(const UnknownHostException& src);
};
@@ -50,55 +50,55 @@
class LOG4CXX_EXPORT InetAddress : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(InetAddress)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(InetAddress)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(InetAddress)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(InetAddress)
+ END_LOG4CXX_CAST_MAP()
- InetAddress(const LogString& hostName, const LogString& hostAddr);
+ InetAddress(const LogString& hostName, const LogString& hostAddr);
- /** Determines all the IP addresses of a host, given the host's name.
- */
- static InetAddressList getAllByName(const LogString& host);
+ /** Determines all the IP addresses of a host, given the host's name.
+ */
+ static InetAddressList getAllByName(const LogString& host);
- /** Determines the IP address of a host, given the host's name.
- */
- static InetAddressPtr getByName(const LogString& host);
+ /** Determines the IP address of a host, given the host's name.
+ */
+ static InetAddressPtr getByName(const LogString& host);
- /** Returns the IP address string "%d.%d.%d.%d".
- */
- LogString getHostAddress() const;
+ /** Returns the IP address string "%d.%d.%d.%d".
+ */
+ LogString getHostAddress() const;
- /** Gets the host name for this IP address.
- */
- LogString getHostName() const;
+ /** Gets the host name for this IP address.
+ */
+ LogString getHostName() const;
- /** Returns the local host.
- */
- static InetAddressPtr getLocalHost();
+ /** Returns the local host.
+ */
+ static InetAddressPtr getLocalHost();
- /** Returns an InetAddress which can be used as any
- * address, for example when listening on a port from any
- * remote addresss.
- */
- static InetAddressPtr anyAddress();
+ /** Returns an InetAddress which can be used as any
+ * address, for example when listening on a port from any
+ * remote addresss.
+ */
+ static InetAddressPtr anyAddress();
- /** Converts this IP address to a String.
- */
- LogString toString() const;
+ /** Converts this IP address to a String.
+ */
+ LogString toString() const;
- private:
- LogString ipAddrString;
+ private:
+ LogString ipAddrString;
- LogString hostNameString;
+ LogString hostNameString;
}; // class InetAddress
} // namespace helpers
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/helpers/inputstream.h b/src/main/include/log4cxx/helpers/inputstream.h
index b13216c..9f3acc5 100644
--- a/src/main/include/log4cxx/helpers/inputstream.h
+++ b/src/main/include/log4cxx/helpers/inputstream.h
@@ -33,36 +33,36 @@
*/
class LOG4CXX_EXPORT InputStream : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(InputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(InputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(InputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(InputStream)
+ END_LOG4CXX_CAST_MAP()
- protected:
- InputStream();
+ protected:
+ InputStream();
- virtual ~InputStream();
+ virtual ~InputStream();
- public:
- /**
- * Reads a sequence of bytes into the given buffer.
- *
- * @param dst The buffer into which bytes are to be transferred.
- * @return the total number of bytes read into the buffer, or -1 if there
- * is no more data because the end of the stream has been reached.
- */
- virtual int read(ByteBuffer& dst) = 0;
+ public:
+ /**
+ * Reads a sequence of bytes into the given buffer.
+ *
+ * @param dst The buffer into which bytes are to be transferred.
+ * @return the total number of bytes read into the buffer, or -1 if there
+ * is no more data because the end of the stream has been reached.
+ */
+ virtual int read(ByteBuffer& dst) = 0;
- /**
- * Closes this input stream and releases any system
- * resources associated with the stream.
- */
- virtual void close() = 0;
+ /**
+ * Closes this input stream and releases any system
+ * resources associated with the stream.
+ */
+ virtual void close() = 0;
- private:
- InputStream(const InputStream&);
- InputStream& operator=(const InputStream&);
+ private:
+ InputStream(const InputStream&);
+ InputStream& operator=(const InputStream&);
};
LOG4CXX_PTR_DEF(InputStream);
diff --git a/src/main/include/log4cxx/helpers/inputstreamreader.h b/src/main/include/log4cxx/helpers/inputstreamreader.h
index f34e8c9..f51d75d 100644
--- a/src/main/include/log4cxx/helpers/inputstreamreader.h
+++ b/src/main/include/log4cxx/helpers/inputstreamreader.h
@@ -35,56 +35,56 @@
*/
class LOG4CXX_EXPORT InputStreamReader : public Reader
{
- private:
- InputStreamPtr in;
- CharsetDecoderPtr dec;
+ private:
+ InputStreamPtr in;
+ CharsetDecoderPtr dec;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(InputStreamReader)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(InputStreamReader)
- LOG4CXX_CAST_ENTRY_CHAIN(Reader)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(InputStreamReader)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(InputStreamReader)
+ LOG4CXX_CAST_ENTRY_CHAIN(Reader)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Creates an InputStreamReader that uses the default charset.
- *
- * @param in The input stream to decorate.
- */
- InputStreamReader(const InputStreamPtr& in);
+ /**
+ * Creates an InputStreamReader that uses the default charset.
+ *
+ * @param in The input stream to decorate.
+ */
+ InputStreamReader(const InputStreamPtr& in);
- /**
- * Creates an InputStreamReader that uses the given charset decoder.
- *
- * @param in The input stream to decorate.
- * @param enc The charset decoder to use for the conversion.
- */
- InputStreamReader(const InputStreamPtr& in, const CharsetDecoderPtr& enc);
+ /**
+ * Creates an InputStreamReader that uses the given charset decoder.
+ *
+ * @param in The input stream to decorate.
+ * @param enc The charset decoder to use for the conversion.
+ */
+ InputStreamReader(const InputStreamPtr& in, const CharsetDecoderPtr& enc);
- ~InputStreamReader();
+ ~InputStreamReader();
- /**
- * Closes the stream.
- *
- * @param p The memory pool associated with the reader.
- */
- virtual void close(Pool& p);
+ /**
+ * Closes the stream.
+ *
+ * @param p The memory pool associated with the reader.
+ */
+ virtual void close(Pool& p);
- /**
- * @return The complete stream contents as a LogString.
- * @param p The memory pool associated with the reader.
- */
- virtual LogString read(Pool& p);
+ /**
+ * @return The complete stream contents as a LogString.
+ * @param p The memory pool associated with the reader.
+ */
+ virtual LogString read(Pool& p);
- /**
- * @return The name of the character encoding being used by this stream.
- */
- LogString getEncoding() const;
+ /**
+ * @return The name of the character encoding being used by this stream.
+ */
+ LogString getEncoding() const;
- private:
- InputStreamReader(const InputStreamReader&);
+ private:
+ InputStreamReader(const InputStreamReader&);
- InputStreamReader& operator=(const InputStreamReader&);
+ InputStreamReader& operator=(const InputStreamReader&);
};
LOG4CXX_PTR_DEF(InputStreamReader);
diff --git a/src/main/include/log4cxx/helpers/integer.h b/src/main/include/log4cxx/helpers/integer.h
index 3e8ed61..241e44f 100644
--- a/src/main/include/log4cxx/helpers/integer.h
+++ b/src/main/include/log4cxx/helpers/integer.h
@@ -27,21 +27,21 @@
{
class LOG4CXX_EXPORT Integer : public ObjectImpl
{
- const int val;
- public:
- DECLARE_LOG4CXX_OBJECT(Integer)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Integer)
- END_LOG4CXX_CAST_MAP()
+ const int val;
+ public:
+ DECLARE_LOG4CXX_OBJECT(Integer)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Integer)
+ END_LOG4CXX_CAST_MAP()
- Integer();
- Integer(int i);
- virtual ~Integer();
+ Integer();
+ Integer(int i);
+ virtual ~Integer();
- inline int intValue() const
- {
- return val;
- }
+ inline int intValue() const
+ {
+ return val;
+ }
};
diff --git a/src/main/include/log4cxx/helpers/iso8601dateformat.h b/src/main/include/log4cxx/helpers/iso8601dateformat.h
index 1580538..7bad102 100644
--- a/src/main/include/log4cxx/helpers/iso8601dateformat.h
+++ b/src/main/include/log4cxx/helpers/iso8601dateformat.h
@@ -35,9 +35,9 @@
*/
class LOG4CXX_EXPORT ISO8601DateFormat : public SimpleDateFormat
{
- public:
- ISO8601DateFormat()
- : SimpleDateFormat(LOG4CXX_STR("yyyy-MM-dd HH:mm:ss,SSS")) {}
+ public:
+ ISO8601DateFormat()
+ : SimpleDateFormat(LOG4CXX_STR("yyyy-MM-dd HH:mm:ss,SSS")) {}
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/loader.h b/src/main/include/log4cxx/helpers/loader.h
index ae371c7..f8a5374 100644
--- a/src/main/include/log4cxx/helpers/loader.h
+++ b/src/main/include/log4cxx/helpers/loader.h
@@ -32,11 +32,11 @@
class LOG4CXX_EXPORT Loader
{
- public:
- static const Class& loadClass(const LogString& clazz);
+ public:
+ static const Class& loadClass(const LogString& clazz);
- static InputStreamPtr getResourceAsStream(
- const LogString& name);
+ static InputStreamPtr getResourceAsStream(
+ const LogString& name);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/locale.h b/src/main/include/log4cxx/helpers/locale.h
index e91d03b..5e86079 100644
--- a/src/main/include/log4cxx/helpers/locale.h
+++ b/src/main/include/log4cxx/helpers/locale.h
@@ -26,22 +26,22 @@
{
class LOG4CXX_EXPORT Locale
{
- public:
- Locale(const LogString& language);
- Locale(const LogString& language, const LogString& country);
- Locale(const LogString& language, const LogString& country,
- const LogString& variant);
+ public:
+ Locale(const LogString& language);
+ Locale(const LogString& language, const LogString& country);
+ Locale(const LogString& language, const LogString& country,
+ const LogString& variant);
- const LogString& getLanguage() const;
- const LogString& getCountry() const;
- const LogString& getVariant() const;
+ const LogString& getLanguage() const;
+ const LogString& getCountry() const;
+ const LogString& getVariant() const;
- protected:
- Locale(const Locale&);
- Locale& operator=(const Locale&);
- const LogString language;
- const LogString country;
- const LogString variant;
+ protected:
+ Locale(const Locale&);
+ Locale& operator=(const Locale&);
+ const LogString language;
+ const LogString country;
+ const LogString variant;
}; // class Locale
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/loglog.h b/src/main/include/log4cxx/helpers/loglog.h
index 9cc53b1..0f0b8b5 100644
--- a/src/main/include/log4cxx/helpers/loglog.h
+++ b/src/main/include/log4cxx/helpers/loglog.h
@@ -41,73 +41,73 @@
*/
class LOG4CXX_EXPORT LogLog
{
- private:
- bool debugEnabled;
+ private:
+ bool debugEnabled;
- /**
- In quietMode not even errors generate any output.
- */
- bool quietMode;
- Mutex mutex;
- LogLog();
- LogLog(const LogLog&);
- LogLog& operator=(const LogLog&);
- static LogLog& getInstance();
+ /**
+ In quietMode not even errors generate any output.
+ */
+ bool quietMode;
+ Mutex mutex;
+ LogLog();
+ LogLog(const LogLog&);
+ LogLog& operator=(const LogLog&);
+ static LogLog& getInstance();
- public:
- /**
- Allows to enable/disable log4cxx internal logging.
- */
- static void setInternalDebugging(bool enabled);
+ public:
+ /**
+ Allows to enable/disable log4cxx internal logging.
+ */
+ static void setInternalDebugging(bool enabled);
- /**
- This method is used to output log4cxx internal debug
- statements. Output goes to the standard output.
- */
- static void debug(const LogString& msg);
- static void debug(const LogString& msg, const std::exception& e);
+ /**
+ This method is used to output log4cxx internal debug
+ statements. Output goes to the standard output.
+ */
+ static void debug(const LogString& msg);
+ static void debug(const LogString& msg, const std::exception& e);
- /**
- This method is used to output log4cxx internal error
- statements. There is no way to disable error statements.
- Output goes to stderr.
- */
- static void error(const LogString& msg);
- static void error(const LogString& msg, const std::exception& e);
+ /**
+ This method is used to output log4cxx internal error
+ statements. There is no way to disable error statements.
+ Output goes to stderr.
+ */
+ static void error(const LogString& msg);
+ static void error(const LogString& msg, const std::exception& e);
- /**
- In quiet mode LogLog generates strictly no output, not even
- for errors.
+ /**
+ In quiet mode LogLog generates strictly no output, not even
+ for errors.
- @param quietMode <code>true</code> for no output.
- */
- static void setQuietMode(bool quietMode);
+ @param quietMode <code>true</code> for no output.
+ */
+ static void setQuietMode(bool quietMode);
- /**
- This method is used to output log4cxx internal warning
- statements. There is no way to disable warning statements.
- Output goes to stderr.
- */
- static void warn(const LogString& msg);
- static void warn(const LogString& msg, const std::exception& e);
+ /**
+ This method is used to output log4cxx internal warning
+ statements. There is no way to disable warning statements.
+ Output goes to stderr.
+ */
+ static void warn(const LogString& msg);
+ static void warn(const LogString& msg, const std::exception& e);
- private:
- static void emit(const LogString& msg);
- static void emit(const std::exception& ex);
+ private:
+ static void emit(const LogString& msg);
+ static void emit(const std::exception& ex);
};
} // namespace helpers
} // namespace log4cxx
#define LOGLOG_DEBUG(log) { \
- log4cxx::helpers::LogLog::debug(log) ; }
+ log4cxx::helpers::LogLog::debug(log) ; }
#define LOGLOG_WARN(log) { \
- log4cxx::helpers::LogLog::warn(log) ; }
+ log4cxx::helpers::LogLog::warn(log) ; }
#define LOGLOG_ERROR(log) { \
- log4cxx::helpers::LogLog::warn(log); }
+ log4cxx::helpers::LogLog::warn(log); }
#endif //_LOG4CXX_HELPERS_LOG_LOG_H
diff --git a/src/main/include/log4cxx/helpers/messagebuffer.h b/src/main/include/log4cxx/helpers/messagebuffer.h
index fed365c..f3ed836 100644
--- a/src/main/include/log4cxx/helpers/messagebuffer.h
+++ b/src/main/include/log4cxx/helpers/messagebuffer.h
@@ -40,160 +40,160 @@
*/
class LOG4CXX_EXPORT CharMessageBuffer
{
- public:
- /**
- * Creates a new instance.
- */
- CharMessageBuffer();
- /**
- * Destructor.
- */
- ~CharMessageBuffer();
+ public:
+ /**
+ * Creates a new instance.
+ */
+ CharMessageBuffer();
+ /**
+ * Destructor.
+ */
+ ~CharMessageBuffer();
- /**
- * Appends string to buffer.
- * @param msg string append.
- * @return this buffer.
- */
- CharMessageBuffer& operator<<(const std::basic_string<char>& msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- CharMessageBuffer& operator<<(const char* msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- CharMessageBuffer& operator<<(char* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string append.
+ * @return this buffer.
+ */
+ CharMessageBuffer& operator<<(const std::basic_string<char>& msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ CharMessageBuffer& operator<<(const char* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ CharMessageBuffer& operator<<(char* msg);
- /**
- * Appends character to buffer.
- * @param msg character to append.
- * @return this buffer.
- */
- CharMessageBuffer& operator<<(const char msg);
+ /**
+ * Appends character to buffer.
+ * @param msg character to append.
+ * @return this buffer.
+ */
+ CharMessageBuffer& operator<<(const char msg);
- /**
- * Insertion operator for STL manipulators such as std::fixed.
- * @param manip manipulator.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(ios_base_manip manip);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(bool val);
+ /**
+ * Insertion operator for STL manipulators such as std::fixed.
+ * @param manip manipulator.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(ios_base_manip manip);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(bool val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(short val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(unsigned int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(unsigned long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(float val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(long double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(void* val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(short val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(unsigned int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(unsigned long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(float val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(long double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(void* val);
- /**
- * Cast to ostream.
- */
- operator std::basic_ostream<char>& ();
+ /**
+ * Cast to ostream.
+ */
+ operator std::basic_ostream<char>& ();
- /**
- * Get content of buffer.
- * @param os used only to signal that
- * the embedded stream was used.
- */
- const std::basic_string<char>& str(std::basic_ostream<char>& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal that
+ * the embedded stream was used.
+ */
+ const std::basic_string<char>& str(std::basic_ostream<char>& os);
- /**
- * Get content of buffer.
- * @param buf used only to signal that
- * the embedded stream was not used.
- */
- const std::basic_string<char>& str(CharMessageBuffer& buf);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal that
+ * the embedded stream was not used.
+ */
+ const std::basic_string<char>& str(CharMessageBuffer& buf);
- /**
- * Returns true if buffer has an encapsulated STL stream.
- * @return true if STL stream was created.
- */
- bool hasStream() const;
+ /**
+ * Returns true if buffer has an encapsulated STL stream.
+ * @return true if STL stream was created.
+ */
+ bool hasStream() const;
- private:
- /**
- * Prevent use of default copy constructor.
- */
- CharMessageBuffer(const CharMessageBuffer&);
- /**
- * Prevent use of default assignment operator.
- */
- CharMessageBuffer& operator=(const CharMessageBuffer&);
+ private:
+ /**
+ * Prevent use of default copy constructor.
+ */
+ CharMessageBuffer(const CharMessageBuffer&);
+ /**
+ * Prevent use of default assignment operator.
+ */
+ CharMessageBuffer& operator=(const CharMessageBuffer&);
- /**
- * Encapsulated std::string.
- */
- std::basic_string<char> buf;
- /**
- * Encapsulated stream, created on demand.
- */
- std::basic_ostringstream<char>* stream;
+ /**
+ * Encapsulated std::string.
+ */
+ std::basic_string<char> buf;
+ /**
+ * Encapsulated stream, created on demand.
+ */
+ std::basic_ostringstream<char>* stream;
};
template<class V>
std::basic_ostream<char>& operator<<(CharMessageBuffer& os, const V& val)
{
- return ((std::basic_ostream<char>&) os) << val;
+ return ((std::basic_ostream<char>&) os) << val;
}
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API || LOG4CXX_LOGCHAR_IS_UNICHAR
@@ -204,173 +204,173 @@
*/
class LOG4CXX_EXPORT UniCharMessageBuffer
{
- public:
- /**
- * Creates a new instance.
- */
- UniCharMessageBuffer();
- /**
- * Destructor.
- */
- ~UniCharMessageBuffer();
+ public:
+ /**
+ * Creates a new instance.
+ */
+ UniCharMessageBuffer();
+ /**
+ * Destructor.
+ */
+ ~UniCharMessageBuffer();
- typedef std::basic_ostream<UniChar> uostream;
+ typedef std::basic_ostream<UniChar> uostream;
- /**
- * Appends string to buffer.
- * @param msg string append.
- * @return this buffer.
- */
- UniCharMessageBuffer& operator<<(const std::basic_string<UniChar>& msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- UniCharMessageBuffer& operator<<(const UniChar* msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- UniCharMessageBuffer& operator<<(UniChar* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string append.
+ * @return this buffer.
+ */
+ UniCharMessageBuffer& operator<<(const std::basic_string<UniChar>& msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ UniCharMessageBuffer& operator<<(const UniChar* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ UniCharMessageBuffer& operator<<(UniChar* msg);
- /**
- * Appends character to buffer.
- * @param msg character to append.
- * @return this buffer.
- */
- UniCharMessageBuffer& operator<<(const UniChar msg);
+ /**
+ * Appends character to buffer.
+ * @param msg character to append.
+ * @return this buffer.
+ */
+ UniCharMessageBuffer& operator<<(const UniChar msg);
#if LOG4CXX_CFSTRING_API
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(const CFStringRef& msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(const CFStringRef& msg);
#endif
- /**
- * Insertion operator for STL manipulators such as std::fixed.
- * @param manip manipulator.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(ios_base_manip manip);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(bool val);
+ /**
+ * Insertion operator for STL manipulators such as std::fixed.
+ * @param manip manipulator.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(ios_base_manip manip);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(bool val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(short val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(unsigned int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(unsigned long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(float val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(long double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- uostream& operator<<(void* val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(short val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(unsigned int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(unsigned long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(float val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(long double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ uostream& operator<<(void* val);
- /**
- * Cast to ostream.
- */
- operator uostream& ();
+ /**
+ * Cast to ostream.
+ */
+ operator uostream& ();
- /**
- * Get content of buffer.
- * @param os used only to signal that
- * the embedded stream was used.
- */
- const std::basic_string<UniChar>& str(uostream& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal that
+ * the embedded stream was used.
+ */
+ const std::basic_string<UniChar>& str(uostream& os);
- /**
- * Get content of buffer.
- * @param buf used only to signal that
- * the embedded stream was not used.
- */
- const std::basic_string<UniChar>& str(UniCharMessageBuffer& buf);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal that
+ * the embedded stream was not used.
+ */
+ const std::basic_string<UniChar>& str(UniCharMessageBuffer& buf);
- /**
- * Returns true if buffer has an encapsulated STL stream.
- * @return true if STL stream was created.
- */
- bool hasStream() const;
+ /**
+ * Returns true if buffer has an encapsulated STL stream.
+ * @return true if STL stream was created.
+ */
+ bool hasStream() const;
- private:
- /**
- * Prevent use of default copy constructor.
- */
- UniCharMessageBuffer(const UniCharMessageBuffer&);
- /**
- * Prevent use of default assignment operator.
- */
- UniCharMessageBuffer& operator=(const UniCharMessageBuffer&);
+ private:
+ /**
+ * Prevent use of default copy constructor.
+ */
+ UniCharMessageBuffer(const UniCharMessageBuffer&);
+ /**
+ * Prevent use of default assignment operator.
+ */
+ UniCharMessageBuffer& operator=(const UniCharMessageBuffer&);
- /**
- * Encapsulated std::string.
- */
- std::basic_string<UniChar> buf;
- /**
- * Encapsulated stream, created on demand.
- */
- std::basic_ostringstream<UniChar>* stream;
+ /**
+ * Encapsulated std::string.
+ */
+ std::basic_string<UniChar> buf;
+ /**
+ * Encapsulated stream, created on demand.
+ */
+ std::basic_ostringstream<UniChar>* stream;
};
template<class V>
UniCharMessageBuffer::uostream& operator<<(UniCharMessageBuffer& os, const V& val)
{
- return ((UniCharMessageBuffer::uostream&) os) << val;
+ return ((UniCharMessageBuffer::uostream&) os) << val;
}
#endif
@@ -382,161 +382,161 @@
*/
class LOG4CXX_EXPORT WideMessageBuffer
{
- public:
- /**
- * Creates a new instance.
- */
- WideMessageBuffer();
- /**
- * Destructor.
- */
- ~WideMessageBuffer();
+ public:
+ /**
+ * Creates a new instance.
+ */
+ WideMessageBuffer();
+ /**
+ * Destructor.
+ */
+ ~WideMessageBuffer();
- /**
- * Appends string to buffer.
- * @param msg string append.
- * @return this buffer.
- */
- WideMessageBuffer& operator<<(const std::basic_string<wchar_t>& msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- WideMessageBuffer& operator<<(const wchar_t* msg);
- /**
- * Appends string to buffer.
- * @param msg string to append.
- * @return this buffer.
- */
- WideMessageBuffer& operator<<(wchar_t* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string append.
+ * @return this buffer.
+ */
+ WideMessageBuffer& operator<<(const std::basic_string<wchar_t>& msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ WideMessageBuffer& operator<<(const wchar_t* msg);
+ /**
+ * Appends string to buffer.
+ * @param msg string to append.
+ * @return this buffer.
+ */
+ WideMessageBuffer& operator<<(wchar_t* msg);
- /**
- * Appends character to buffer.
- * @param msg character to append.
- * @return this buffer.
- */
- WideMessageBuffer& operator<<(const wchar_t msg);
+ /**
+ * Appends character to buffer.
+ * @param msg character to append.
+ * @return this buffer.
+ */
+ WideMessageBuffer& operator<<(const wchar_t msg);
- /**
- * Insertion operator for STL manipulators such as std::fixed.
- * @param manip manipulator.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(ios_base_manip manip);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(bool val);
+ /**
+ * Insertion operator for STL manipulators such as std::fixed.
+ * @param manip manipulator.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(ios_base_manip manip);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(bool val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(short val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(unsigned int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(unsigned long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(float val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(long double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::basic_ostream<wchar_t>& operator<<(void* val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(short val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(unsigned int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(unsigned long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(float val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(long double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::basic_ostream<wchar_t>& operator<<(void* val);
- /**
- * Cast to ostream.
- */
- operator std::basic_ostream<wchar_t>& ();
+ /**
+ * Cast to ostream.
+ */
+ operator std::basic_ostream<wchar_t>& ();
- /**
- * Get content of buffer.
- * @param os used only to signal that
- * the embedded stream was used.
- */
- const std::basic_string<wchar_t>& str(std::basic_ostream<wchar_t>& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal that
+ * the embedded stream was used.
+ */
+ const std::basic_string<wchar_t>& str(std::basic_ostream<wchar_t>& os);
- /**
- * Get content of buffer.
- * @param buf used only to signal that
- * the embedded stream was not used.
- */
- const std::basic_string<wchar_t>& str(WideMessageBuffer& buf);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal that
+ * the embedded stream was not used.
+ */
+ const std::basic_string<wchar_t>& str(WideMessageBuffer& buf);
- /**
- * Returns true if buffer has an encapsulated STL stream.
- * @return true if STL stream was created.
- */
- bool hasStream() const;
+ /**
+ * Returns true if buffer has an encapsulated STL stream.
+ * @return true if STL stream was created.
+ */
+ bool hasStream() const;
- private:
- /**
- * Prevent use of default copy constructor.
- */
- WideMessageBuffer(const WideMessageBuffer&);
- /**
- * Prevent use of default assignment operator.
- */
- WideMessageBuffer& operator=(const WideMessageBuffer&);
+ private:
+ /**
+ * Prevent use of default copy constructor.
+ */
+ WideMessageBuffer(const WideMessageBuffer&);
+ /**
+ * Prevent use of default assignment operator.
+ */
+ WideMessageBuffer& operator=(const WideMessageBuffer&);
- /**
- * Encapsulated std::string.
- */
- std::basic_string<wchar_t> buf;
- /**
- * Encapsulated stream, created on demand.
- */
- std::basic_ostringstream<wchar_t>* stream;
+ /**
+ * Encapsulated std::string.
+ */
+ std::basic_string<wchar_t> buf;
+ /**
+ * Encapsulated stream, created on demand.
+ */
+ std::basic_ostringstream<wchar_t>* stream;
};
template<class V>
std::basic_ostream<wchar_t>& operator<<(WideMessageBuffer& os, const V& val)
{
- return ((std::basic_ostream<wchar_t>&) os) << val;
+ return ((std::basic_ostream<wchar_t>&) os) << val;
}
/**
@@ -546,288 +546,288 @@
*/
class LOG4CXX_EXPORT MessageBuffer
{
- public:
- /**
- * Creates a new instance.
- */
- MessageBuffer();
- /**
- * Destructor.
- */
- ~MessageBuffer();
+ public:
+ /**
+ * Creates a new instance.
+ */
+ MessageBuffer();
+ /**
+ * Destructor.
+ */
+ ~MessageBuffer();
- /**
- * Cast to ostream.
- */
- operator std::ostream& ();
+ /**
+ * Cast to ostream.
+ */
+ operator std::ostream& ();
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- CharMessageBuffer& operator<<(const std::string& msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- CharMessageBuffer& operator<<(const char* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- CharMessageBuffer& operator<<(char* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ CharMessageBuffer& operator<<(const std::string& msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ CharMessageBuffer& operator<<(const char* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ CharMessageBuffer& operator<<(char* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- CharMessageBuffer& operator<<(const char msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ CharMessageBuffer& operator<<(const char msg);
- /**
- * Get content of buffer.
- * @param buf used only to signal
- * the character type and that
- * the embedded stream was not used.
- */
- const std::string& str(CharMessageBuffer& buf);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal
+ * the character type and that
+ * the embedded stream was not used.
+ */
+ const std::string& str(CharMessageBuffer& buf);
- /**
- * Get content of buffer.
- * @param os used only to signal
- * the character type and that
- * the embedded stream was used.
- */
- const std::string& str(std::ostream& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal
+ * the character type and that
+ * the embedded stream was used.
+ */
+ const std::string& str(std::ostream& os);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- WideMessageBuffer& operator<<(const std::wstring& msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- WideMessageBuffer& operator<<(const wchar_t* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- WideMessageBuffer& operator<<(wchar_t* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- WideMessageBuffer& operator<<(const wchar_t msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ WideMessageBuffer& operator<<(const std::wstring& msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ WideMessageBuffer& operator<<(const wchar_t* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ WideMessageBuffer& operator<<(wchar_t* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ WideMessageBuffer& operator<<(const wchar_t msg);
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(const std::basic_string<UniChar>& msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(const UniChar* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(UniChar* msg);
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(const UniChar msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(const std::basic_string<UniChar>& msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(const UniChar* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(UniChar* msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(const UniChar msg);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- * Appends a string into the buffer and
- * fixes the buffer to use char characters.
- * @param msg message to append.
- * @return encapsulated CharMessageBuffer.
- */
- UniCharMessageBuffer& operator<<(const CFStringRef& msg);
+ /**
+ * Appends a string into the buffer and
+ * fixes the buffer to use char characters.
+ * @param msg message to append.
+ * @return encapsulated CharMessageBuffer.
+ */
+ UniCharMessageBuffer& operator<<(const CFStringRef& msg);
#endif
- /**
- * Insertion operator for STL manipulators such as std::fixed.
- * @param manip manipulator.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(ios_base_manip manip);
+ /**
+ * Insertion operator for STL manipulators such as std::fixed.
+ * @param manip manipulator.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(ios_base_manip manip);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(bool val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(bool val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(short val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(unsigned int val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(unsigned long val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(float val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(long double val);
- /**
- * Insertion operator for built-in type.
- * @param val build in type.
- * @return encapsulated STL stream.
- */
- std::ostream& operator<<(void* val);
- /**
- * Get content of buffer.
- * @param buf used only to signal
- * the character type and that
- * the embedded stream was not used.
- */
- const std::wstring& str(WideMessageBuffer& buf);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(short val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(unsigned int val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(unsigned long val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(float val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(long double val);
+ /**
+ * Insertion operator for built-in type.
+ * @param val build in type.
+ * @return encapsulated STL stream.
+ */
+ std::ostream& operator<<(void* val);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal
+ * the character type and that
+ * the embedded stream was not used.
+ */
+ const std::wstring& str(WideMessageBuffer& buf);
- /**
- * Get content of buffer.
- * @param os used only to signal
- * the character type and that
- * the embedded stream was used.
- */
- const std::wstring& str(std::basic_ostream<wchar_t>& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal
+ * the character type and that
+ * the embedded stream was used.
+ */
+ const std::wstring& str(std::basic_ostream<wchar_t>& os);
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- /**
- * Get content of buffer.
- * @param buf used only to signal
- * the character type and that
- * the embedded stream was not used.
- */
- const std::basic_string<UniChar>& str(UniCharMessageBuffer& buf);
+ /**
+ * Get content of buffer.
+ * @param buf used only to signal
+ * the character type and that
+ * the embedded stream was not used.
+ */
+ const std::basic_string<UniChar>& str(UniCharMessageBuffer& buf);
- /**
- * Get content of buffer.
- * @param os used only to signal
- * the character type and that
- * the embedded stream was used.
- */
- const std::basic_string<UniChar>& str(UniCharMessageBuffer::uostream& os);
+ /**
+ * Get content of buffer.
+ * @param os used only to signal
+ * the character type and that
+ * the embedded stream was used.
+ */
+ const std::basic_string<UniChar>& str(UniCharMessageBuffer::uostream& os);
#endif
- /**
- * Returns true if buffer has an encapsulated STL stream.
- * @return true if STL stream was created.
- */
- bool hasStream() const;
+ /**
+ * Returns true if buffer has an encapsulated STL stream.
+ * @return true if STL stream was created.
+ */
+ bool hasStream() const;
- private:
- /**
- * Prevent use of default copy constructor.
- */
- MessageBuffer(const MessageBuffer&);
- /**
- * Prevent use of default assignment operator.
- */
- MessageBuffer& operator=(const MessageBuffer&);
+ private:
+ /**
+ * Prevent use of default copy constructor.
+ */
+ MessageBuffer(const MessageBuffer&);
+ /**
+ * Prevent use of default assignment operator.
+ */
+ MessageBuffer& operator=(const MessageBuffer&);
- /**
- * Character message buffer.
- */
- CharMessageBuffer cbuf;
+ /**
+ * Character message buffer.
+ */
+ CharMessageBuffer cbuf;
- /**
- * Encapsulated wide message buffer, created on demand.
- */
- WideMessageBuffer* wbuf;
+ /**
+ * Encapsulated wide message buffer, created on demand.
+ */
+ WideMessageBuffer* wbuf;
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- /**
- * Encapsulated wide message buffer, created on demand.
- */
- UniCharMessageBuffer* ubuf;
+ /**
+ * Encapsulated wide message buffer, created on demand.
+ */
+ UniCharMessageBuffer* ubuf;
#endif
};
template<class V>
std::ostream& operator<<(MessageBuffer& os, const V& val)
{
- return ((std::ostream&) os) << val;
+ return ((std::ostream&) os) << val;
}
#if LOG4CXX_LOGCHAR_IS_UTF8
- typedef CharMessageBuffer LogCharMessageBuffer;
+ typedef CharMessageBuffer LogCharMessageBuffer;
#endif
#if LOG4CXX_LOGCHAR_IS_WCHAR
- typedef WideMessageBuffer LogCharMessageBuffer;
+ typedef WideMessageBuffer LogCharMessageBuffer;
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- typedef UniCharMessageBuffer LogCharMessageBuffer;
+ typedef UniCharMessageBuffer LogCharMessageBuffer;
#endif
#else
diff --git a/src/main/include/log4cxx/helpers/mutex.h b/src/main/include/log4cxx/helpers/mutex.h
index 6b7001f..67c73ad 100644
--- a/src/main/include/log4cxx/helpers/mutex.h
+++ b/src/main/include/log4cxx/helpers/mutex.h
@@ -21,14 +21,14 @@
#include <log4cxx/log4cxx.h>
#if defined(RW_MUTEX)
- #include <apr_portable.h>
- #include <atomic>
+ #include <apr_portable.h>
+ #include <atomic>
#endif
extern "C" {
- struct apr_thread_mutex_t;
- struct apr_pool_t;
- struct apr_thread_rwlock_t;
+ struct apr_thread_mutex_t;
+ struct apr_pool_t;
+ struct apr_thread_rwlock_t;
}
@@ -40,16 +40,16 @@
class LOG4CXX_EXPORT Mutex
{
- public:
- Mutex(log4cxx::helpers::Pool& p);
- Mutex(apr_pool_t* p);
- ~Mutex();
- apr_thread_mutex_t* getAPRMutex() const;
+ public:
+ Mutex(log4cxx::helpers::Pool& p);
+ Mutex(apr_pool_t* p);
+ ~Mutex();
+ apr_thread_mutex_t* getAPRMutex() const;
- private:
- Mutex(const Mutex&);
- Mutex& operator=(const Mutex&);
- apr_thread_mutex_t* mutex;
+ private:
+ Mutex(const Mutex&);
+ Mutex& operator=(const Mutex&);
+ apr_thread_mutex_t* mutex;
};
} // namespace helpers
} // namespace log4cxx
@@ -65,23 +65,23 @@
class LOG4CXX_EXPORT RWMutex
{
- public:
- RWMutex(log4cxx::helpers::Pool& p);
- RWMutex(apr_pool_t* p);
- ~RWMutex();
+ public:
+ RWMutex(log4cxx::helpers::Pool& p);
+ RWMutex(apr_pool_t* p);
+ ~RWMutex();
- void rdLock() const;
- void rdUnlock() const;
+ void rdLock() const;
+ void rdUnlock() const;
- void wrLock() const;
- void wrUnlock() const;
+ void wrLock() const;
+ void wrUnlock() const;
- private:
- mutable std::atomic<apr_os_thread_t> id;
- mutable unsigned count;
- RWMutex(const RWMutex&);
- RWMutex& operator=(const RWMutex&);
- apr_thread_rwlock_t* mutex;
+ private:
+ mutable std::atomic<apr_os_thread_t> id;
+ mutable unsigned count;
+ RWMutex(const RWMutex&);
+ RWMutex& operator=(const RWMutex&);
+ apr_thread_rwlock_t* mutex;
};
} // namespace helpers
} // namespace log4cxx
@@ -106,18 +106,18 @@
class LOG4CXX_EXPORT Semaphore
{
- public:
- Semaphore(log4cxx::helpers::Pool& p);
- ~Semaphore();
+ public:
+ Semaphore(log4cxx::helpers::Pool& p);
+ ~Semaphore();
- void await() const;
- void signalAll() const;
+ void await() const;
+ void signalAll() const;
- private:
- Semaphore(const Semaphore&);
- Semaphore& operator=(const Semaphore&);
+ private:
+ Semaphore(const Semaphore&);
+ Semaphore& operator=(const Semaphore&);
- SemaphoreImpl* impl;
+ SemaphoreImpl* impl;
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/object.h b/src/main/include/log4cxx/helpers/object.h
index 3980802..55f63cd 100644
--- a/src/main/include/log4cxx/helpers/object.h
+++ b/src/main/include/log4cxx/helpers/object.h
@@ -25,69 +25,69 @@
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)\
- public:\
- class Clazz##object : public helpers::Class\
- {\
- public:\
- Clazz##object() : helpers::Class() {}\
- virtual ~Clazz##object() {}\
- virtual log4cxx::LogString getName() const { return LOG4CXX_STR(#object); } \
- };\
- virtual const helpers::Class& getClass() const;\
- static const helpers::Class& getStaticClass(); \
- static const log4cxx::helpers::ClassRegistration& registerClass();
+ public:\
+ class Clazz##object : public helpers::Class\
+ {\
+ public:\
+ Clazz##object() : helpers::Class() {}\
+ virtual ~Clazz##object() {}\
+ virtual log4cxx::LogString getName() const { return LOG4CXX_STR(#object); } \
+ };\
+ virtual const helpers::Class& getClass() const;\
+ static const helpers::Class& getStaticClass(); \
+ static const log4cxx::helpers::ClassRegistration& registerClass();
#define DECLARE_LOG4CXX_OBJECT(object)\
- public:\
- class Clazz##object : public helpers::Class\
- {\
- public:\
- Clazz##object() : helpers::Class() {}\
- virtual ~Clazz##object() {}\
- virtual log4cxx::LogString getName() const { return LOG4CXX_STR(#object); } \
- virtual helpers::ObjectPtr newInstance() const\
- {\
- return new object();\
- }\
- };\
- virtual const helpers::Class& getClass() const;\
- static const helpers::Class& getStaticClass(); \
- static const log4cxx::helpers::ClassRegistration& registerClass();
+ public:\
+ class Clazz##object : public helpers::Class\
+ {\
+ public:\
+ Clazz##object() : helpers::Class() {}\
+ virtual ~Clazz##object() {}\
+ virtual log4cxx::LogString getName() const { return LOG4CXX_STR(#object); } \
+ virtual helpers::ObjectPtr newInstance() const\
+ {\
+ return new object();\
+ }\
+ };\
+ virtual const helpers::Class& getClass() const;\
+ static const helpers::Class& getStaticClass(); \
+ static const log4cxx::helpers::ClassRegistration& registerClass();
#define DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(object, class)\
- public:\
- virtual const helpers::Class& getClass() const;\
- static const helpers::Class& getStaticClass();\
- static const log4cxx::helpers::ClassRegistration& registerClass();
+ public:\
+ virtual const helpers::Class& getClass() const;\
+ static const helpers::Class& getStaticClass();\
+ static const log4cxx::helpers::ClassRegistration& registerClass();
#define IMPLEMENT_LOG4CXX_OBJECT(object)\
- const ::log4cxx::helpers::Class& object::getClass() const { return getStaticClass(); }\
- const ::log4cxx::helpers::Class& object::getStaticClass() { \
- static Clazz##object theClass; \
- return theClass; \
- } \
- const log4cxx::helpers::ClassRegistration& object::registerClass() { \
- static log4cxx::helpers::ClassRegistration classReg(object::getStaticClass); \
- return classReg; \
- }\
- namespace log4cxx { namespace classes { \
- const ::log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \
- } }
+ const ::log4cxx::helpers::Class& object::getClass() const { return getStaticClass(); }\
+ const ::log4cxx::helpers::Class& object::getStaticClass() { \
+ static Clazz##object theClass; \
+ return theClass; \
+ } \
+ const log4cxx::helpers::ClassRegistration& object::registerClass() { \
+ static log4cxx::helpers::ClassRegistration classReg(object::getStaticClass); \
+ return classReg; \
+ }\
+ namespace log4cxx { namespace classes { \
+ const ::log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \
+ } }
#define IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(object, class)\
- const log4cxx::helpers::Class& object::getClass() const { return getStaticClass(); }\
- const log4cxx::helpers::Class& object::getStaticClass() { \
- static class theClass; \
- return theClass; \
- } \
- const log4cxx::helpers::ClassRegistration& object::registerClass() { \
- static log4cxx::helpers::ClassRegistration classReg(object::getStaticClass); \
- return classReg; \
- }\
- namespace log4cxx { namespace classes { \
- const log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \
- } }
+ const log4cxx::helpers::Class& object::getClass() const { return getStaticClass(); }\
+ const log4cxx::helpers::Class& object::getStaticClass() { \
+ static class theClass; \
+ return theClass; \
+ } \
+ const log4cxx::helpers::ClassRegistration& object::registerClass() { \
+ static log4cxx::helpers::ClassRegistration classReg(object::getStaticClass); \
+ return classReg; \
+ }\
+ namespace log4cxx { namespace classes { \
+ const log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \
+ } }
namespace log4cxx
{
@@ -101,38 +101,38 @@
/** base class for java-like objects.*/
class LOG4CXX_EXPORT Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Object)
- virtual ~Object() {}
- virtual void addRef() const = 0;
- virtual void releaseRef() const = 0;
- virtual bool instanceof(const Class& clazz) const = 0;
- virtual const void* cast(const Class& clazz) const = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Object)
+ virtual ~Object() {}
+ virtual void addRef() const = 0;
+ virtual void releaseRef() const = 0;
+ virtual bool instanceof(const Class& clazz) const = 0;
+ virtual const void* cast(const Class& clazz) const = 0;
};
LOG4CXX_PTR_DEF(Object);
}
}
#define BEGIN_LOG4CXX_CAST_MAP()\
- const void * cast(const helpers::Class& clazz) const\
- {\
- const void * object = 0;\
- if (&clazz == &helpers::Object::getStaticClass()) return (const helpers::Object *)this;
+ const void * cast(const helpers::Class& clazz) const\
+ {\
+ const void * object = 0;\
+ if (&clazz == &helpers::Object::getStaticClass()) return (const helpers::Object *)this;
#define END_LOG4CXX_CAST_MAP()\
- return object;\
- }\
- bool instanceof(const helpers::Class& clazz) const\
- { return cast(clazz) != 0; }
+ return object;\
+ }\
+ bool instanceof(const helpers::Class& clazz) const\
+ { return cast(clazz) != 0; }
#define LOG4CXX_CAST_ENTRY(Interface)\
- if (&clazz == &Interface::getStaticClass()) return (const Interface *)this;
+ if (&clazz == &Interface::getStaticClass()) return (const Interface *)this;
#define LOG4CXX_CAST_ENTRY2(Interface, interface2)\
- if (&clazz == &Interface::getStaticClass()) return (Interface *)(interface2 *)this;
+ if (&clazz == &Interface::getStaticClass()) return (Interface *)(interface2 *)this;
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)\
- object = Interface::cast(clazz);\
- if (object != 0) return object;
+ object = Interface::cast(clazz);\
+ if (object != 0) return object;
#endif //_LOG4CXX_HELPERS_OBJECT_H
diff --git a/src/main/include/log4cxx/helpers/objectimpl.h b/src/main/include/log4cxx/helpers/objectimpl.h
index 8a59986..a638f56 100644
--- a/src/main/include/log4cxx/helpers/objectimpl.h
+++ b/src/main/include/log4cxx/helpers/objectimpl.h
@@ -27,21 +27,21 @@
/** Implementation class for Object.*/
class LOG4CXX_EXPORT ObjectImpl : public virtual Object
{
- public:
- ObjectImpl();
- virtual ~ObjectImpl();
- void addRef() const;
- void releaseRef() const;
+ public:
+ ObjectImpl();
+ virtual ~ObjectImpl();
+ void addRef() const;
+ void releaseRef() const;
- protected:
- mutable unsigned int volatile ref;
+ protected:
+ mutable unsigned int volatile ref;
- private:
- //
- // prevent object copy and assignment
- //
- ObjectImpl(const ObjectImpl&);
- ObjectImpl& operator=(const ObjectImpl&);
+ private:
+ //
+ // prevent object copy and assignment
+ //
+ ObjectImpl(const ObjectImpl&);
+ ObjectImpl& operator=(const ObjectImpl&);
};
}
}
diff --git a/src/main/include/log4cxx/helpers/objectoutputstream.h b/src/main/include/log4cxx/helpers/objectoutputstream.h
index cf1742e..946e957 100644
--- a/src/main/include/log4cxx/helpers/objectoutputstream.h
+++ b/src/main/include/log4cxx/helpers/objectoutputstream.h
@@ -32,65 +32,65 @@
*/
class LOG4CXX_EXPORT ObjectOutputStream : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ObjectOutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ObjectOutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ObjectOutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ObjectOutputStream)
+ END_LOG4CXX_CAST_MAP()
- ObjectOutputStream(OutputStreamPtr os, Pool& p);
- virtual ~ObjectOutputStream();
+ ObjectOutputStream(OutputStreamPtr os, Pool& p);
+ virtual ~ObjectOutputStream();
- void close(Pool& p);
- void flush(Pool& p);
- void reset(Pool& p);
+ void close(Pool& p);
+ void flush(Pool& p);
+ void reset(Pool& p);
- void writeObject(const LogString&, Pool& p);
- void writeUTFString(const std::string&, Pool& p);
- void writeObject(const MDC::Map& mdc, Pool& p);
- void writeInt(int val, Pool& p);
- void writeLong(log4cxx_time_t val, Pool& p);
- void writeProlog(const char* className,
- int classDescIncrement,
- char* bytes,
- size_t len,
- Pool& p);
- void writeNull(Pool& p);
+ void writeObject(const LogString&, Pool& p);
+ void writeUTFString(const std::string&, Pool& p);
+ void writeObject(const MDC::Map& mdc, Pool& p);
+ void writeInt(int val, Pool& p);
+ void writeLong(log4cxx_time_t val, Pool& p);
+ void writeProlog(const char* className,
+ int classDescIncrement,
+ char* bytes,
+ size_t len,
+ Pool& p);
+ void writeNull(Pool& p);
- enum { STREAM_MAGIC = 0xACED };
- enum { STREAM_VERSION = 5 };
- enum
- {
- TC_NULL = 0x70,
- TC_REFERENCE = 0x71,
- TC_CLASSDESC = 0x72,
- TC_OBJECT = 0x73,
- TC_STRING = 0x74,
- TC_ARRAY = 0x75,
- TC_CLASS = 0x76,
- TC_BLOCKDATA = 0x77,
- TC_ENDBLOCKDATA = 0x78,
- TC_RESET = 0x79
- };
- enum
- {
- SC_WRITE_METHOD = 0x01,
- SC_SERIALIZABLE = 0x02
- };
+ enum { STREAM_MAGIC = 0xACED };
+ enum { STREAM_VERSION = 5 };
+ enum
+ {
+ TC_NULL = 0x70,
+ TC_REFERENCE = 0x71,
+ TC_CLASSDESC = 0x72,
+ TC_OBJECT = 0x73,
+ TC_STRING = 0x74,
+ TC_ARRAY = 0x75,
+ TC_CLASS = 0x76,
+ TC_BLOCKDATA = 0x77,
+ TC_ENDBLOCKDATA = 0x78,
+ TC_RESET = 0x79
+ };
+ enum
+ {
+ SC_WRITE_METHOD = 0x01,
+ SC_SERIALIZABLE = 0x02
+ };
- void writeByte(char val, Pool& p);
- void writeBytes(const char* bytes, size_t len, Pool& p);
+ void writeByte(char val, Pool& p);
+ void writeBytes(const char* bytes, size_t len, Pool& p);
- private:
- ObjectOutputStream(const ObjectOutputStream&);
- ObjectOutputStream& operator=(const ObjectOutputStream&);
+ private:
+ ObjectOutputStream(const ObjectOutputStream&);
+ ObjectOutputStream& operator=(const ObjectOutputStream&);
- OutputStreamPtr os;
- log4cxx::helpers::CharsetEncoderPtr utf8Encoder;
- const unsigned int objectHandleDefault;
- unsigned int objectHandle;
- typedef std::map<std::string, unsigned int> ClassDescriptionMap;
- ClassDescriptionMap* classDescriptions;
+ OutputStreamPtr os;
+ log4cxx::helpers::CharsetEncoderPtr utf8Encoder;
+ const unsigned int objectHandleDefault;
+ unsigned int objectHandle;
+ typedef std::map<std::string, unsigned int> ClassDescriptionMap;
+ ClassDescriptionMap* classDescriptions;
};
LOG4CXX_PTR_DEF(ObjectOutputStream);
diff --git a/src/main/include/log4cxx/helpers/objectptr.h b/src/main/include/log4cxx/helpers/objectptr.h
index fd10083..a831dd9 100644
--- a/src/main/include/log4cxx/helpers/objectptr.h
+++ b/src/main/include/log4cxx/helpers/objectptr.h
@@ -28,9 +28,9 @@
// switching between the initialization styles.
//
#if LOG4CXX_HELGRIND
- #define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase() { exchange(x);
+ #define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase() { exchange(x);
#else
- #define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase(), p(x) {
+ #define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase(), p(x) {
#endif
namespace log4cxx
@@ -41,22 +41,22 @@
class LOG4CXX_EXPORT ObjectPtrBase
{
- public:
- ObjectPtrBase();
- virtual ~ObjectPtrBase();
- static void checkNull(const int& null);
- static void* exchange(void** destination, void* newValue);
- virtual void* cast(const Class& cls) const = 0;
+ public:
+ ObjectPtrBase();
+ virtual ~ObjectPtrBase();
+ static void checkNull(const int& null);
+ static void* exchange(void** destination, void* newValue);
+ virtual void* cast(const Class& cls) const = 0;
};
/** smart pointer to a Object descendant */
template<typename T> class ObjectPtrT : public ObjectPtrBase
{
- public:
- ObjectPtrT(const int& null)
- _LOG4CXX_OBJECTPTR_INIT(0)
- ObjectPtrBase::checkNull(null);
+ public:
+ ObjectPtrT(const int& null)
+ _LOG4CXX_OBJECTPTR_INIT(0)
+ ObjectPtrBase::checkNull(null);
}
ObjectPtrT()
@@ -68,7 +68,7 @@
if (this->p != 0)
{
- this->p->addRef();
+ this->p->addRef();
}
}
@@ -78,7 +78,7 @@
if (this->p != 0)
{
- this->p->addRef();
+ this->p->addRef();
}
}
@@ -87,7 +87,7 @@
if (this->p != 0)
{
- this->p->addRef();
+ this->p->addRef();
}
}
@@ -96,119 +96,119 @@
if (this->p != 0)
{
- this->p->addRef();
+ this->p->addRef();
}
}
~ObjectPtrT()
{
- if (p != 0)
- {
- p->releaseRef();
- }
+ if (p != 0)
+ {
+ p->releaseRef();
+ }
}
ObjectPtrT& operator=(const ObjectPtrT& p1)
{
- T* newPtr = p1.p;
+ T* newPtr = p1.p;
- if (newPtr != 0)
- {
- newPtr->addRef();
- }
+ if (newPtr != 0)
+ {
+ newPtr->addRef();
+ }
- T* oldPtr = exchange(newPtr);
+ T* oldPtr = exchange(newPtr);
- if (oldPtr != 0)
- {
- oldPtr->releaseRef();
- }
+ if (oldPtr != 0)
+ {
+ oldPtr->releaseRef();
+ }
- return *this;
+ return *this;
}
ObjectPtrT& operator=(const int& null) //throw(IllegalArgumentException)
{
- //
- // throws IllegalArgumentException if null != 0
- //
- ObjectPtrBase::checkNull(null);
- T* oldPtr = exchange(0);
+ //
+ // throws IllegalArgumentException if null != 0
+ //
+ ObjectPtrBase::checkNull(null);
+ T* oldPtr = exchange(0);
- if (oldPtr != 0)
- {
- oldPtr->releaseRef();
- }
+ if (oldPtr != 0)
+ {
+ oldPtr->releaseRef();
+ }
- return *this;
+ return *this;
}
ObjectPtrT& operator=(T* p1)
{
- if (p1 != 0)
- {
- p1->addRef();
- }
+ if (p1 != 0)
+ {
+ p1->addRef();
+ }
- T* oldPtr = exchange(p1);
+ T* oldPtr = exchange(p1);
- if (oldPtr != 0)
- {
- oldPtr->releaseRef();
- }
+ if (oldPtr != 0)
+ {
+ oldPtr->releaseRef();
+ }
- return *this;
+ return *this;
}
ObjectPtrT& operator=(ObjectPtrBase& p1)
{
- T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));
- return operator=(newPtr);
+ T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));
+ return operator=(newPtr);
}
ObjectPtrT& operator=(const ObjectPtrBase& p1)
{
- T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));
- return operator=(newPtr);
+ T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));
+ return operator=(newPtr);
}
bool operator==(const ObjectPtrT& p1) const
{
- return (this->p == p1.p);
+ return (this->p == p1.p);
}
bool operator!=(const ObjectPtrT& p1) const
{
- return (this->p != p1.p);
+ return (this->p != p1.p);
}
bool operator<(const ObjectPtrT& p1) const
{
- return (this->p < p1.p);
+ return (this->p < p1.p);
}
bool operator==(const T* p1) const
{
- return (this->p == p1);
+ return (this->p == p1);
}
bool operator!=(const T* p1) const
{
- return (this->p != p1);
+ return (this->p != p1);
}
bool operator<(const T* p1) const
{
- return (this->p < p1);
+ return (this->p < p1);
}
T* operator->() const
{
- return p;
+ return p;
}
T& operator*() const
{
- return *p;
+ return *p;
}
operator T* () const
{
- return p;
+ return p;
}
@@ -217,24 +217,24 @@
T* p;
virtual void* cast(const Class& cls) const
{
- if (p != 0)
- {
- return const_cast<void*>(p->cast(cls));
- }
+ if (p != 0)
+ {
+ return const_cast<void*>(p->cast(cls));
+ }
- return 0;
+ return 0;
}
T* exchange(const T* newValue)
{
- // Avoid GCC strict aliasing warnings
- union
- {
- T** in;
- void** out;
- } temp = { &p };
- return static_cast<T*>(ObjectPtrBase::exchange(
- temp.out,
- const_cast<T*>(newValue)));
+ // Avoid GCC strict aliasing warnings
+ union
+ {
+ T** in;
+ void** out;
+ } temp = { &p };
+ return static_cast<T*>(ObjectPtrBase::exchange(
+ temp.out,
+ const_cast<T*>(newValue)));
}
};
diff --git a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
index 8a0e328..e817812 100644
--- a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
+++ b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
@@ -36,65 +36,65 @@
from being flooded with error messages when logging fails
*/
class LOG4CXX_EXPORT OnlyOnceErrorHandler :
- public virtual spi::ErrorHandler,
- public virtual ObjectImpl
+ public virtual spi::ErrorHandler,
+ public virtual ObjectImpl
{
- private:
- LogString WARN_PREFIX;
- LogString ERROR_PREFIX;
- mutable bool firstTime;
+ private:
+ LogString WARN_PREFIX;
+ LogString ERROR_PREFIX;
+ mutable bool firstTime;
- public:
- DECLARE_LOG4CXX_OBJECT(OnlyOnceErrorHandler)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- LOG4CXX_CAST_ENTRY(spi::ErrorHandler)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(OnlyOnceErrorHandler)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ LOG4CXX_CAST_ENTRY(spi::ErrorHandler)
+ END_LOG4CXX_CAST_MAP()
- OnlyOnceErrorHandler();
- void addRef() const;
- void releaseRef() const;
+ OnlyOnceErrorHandler();
+ void addRef() const;
+ void releaseRef() const;
- /**
- Does not do anything.
- */
- void setLogger(const LoggerPtr& logger);
+ /**
+ Does not do anything.
+ */
+ void setLogger(const LoggerPtr& logger);
- /**
- No options to activate.
- */
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option, const LogString& value);
+ /**
+ No options to activate.
+ */
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option, const LogString& value);
- /**
- Prints the message and the stack trace of the exception on
- <code>System.err</code>. */
- void error(const LogString& message, const std::exception& e,
- int errorCode) const;
- /**
- Prints the message and the stack trace of the exception on
- <code>System.err</code>.
- */
- void error(const LogString& message, const std::exception& e,
- int errorCode, const spi::LoggingEventPtr& event) const;
+ /**
+ Prints the message and the stack trace of the exception on
+ <code>System.err</code>. */
+ void error(const LogString& message, const std::exception& e,
+ int errorCode) const;
+ /**
+ Prints the message and the stack trace of the exception on
+ <code>System.err</code>.
+ */
+ void error(const LogString& message, const std::exception& e,
+ int errorCode, const spi::LoggingEventPtr& event) const;
- /**
- Print a the error message passed as parameter on
- <code>System.err</code>.
- */
- void error(const LogString& message) const;
+ /**
+ Print a the error message passed as parameter on
+ <code>System.err</code>.
+ */
+ void error(const LogString& message) const;
- /**
- Does not do anything.
- */
- void setAppender(const AppenderPtr& appender);
+ /**
+ Does not do anything.
+ */
+ void setAppender(const AppenderPtr& appender);
- /**
- Does not do anything.
- */
- void setBackupAppender(const AppenderPtr& appender);
+ /**
+ Does not do anything.
+ */
+ void setBackupAppender(const AppenderPtr& appender);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/optionconverter.h b/src/main/include/log4cxx/helpers/optionconverter.h
index f95d91b..f51777c 100644
--- a/src/main/include/log4cxx/helpers/optionconverter.h
+++ b/src/main/include/log4cxx/helpers/optionconverter.h
@@ -45,117 +45,117 @@
/** A convenience class to convert property values to specific types.*/
class LOG4CXX_EXPORT OptionConverter
{
- /** OptionConverter is a static class. */
- private:
- OptionConverter() {}
+ /** OptionConverter is a static class. */
+ private:
+ OptionConverter() {}
- public:
- static LogString convertSpecialChars(const LogString& s);
+ public:
+ static LogString convertSpecialChars(const LogString& s);
- /**
- If <code>value</code> is "true", then <code>true</code> is
- returned. If <code>value</code> is "false", then
- <code>true</code> is returned. Otherwise, <code>default</code> is
- returned.
+ /**
+ If <code>value</code> is "true", then <code>true</code> is
+ returned. If <code>value</code> is "false", then
+ <code>true</code> is returned. Otherwise, <code>default</code> is
+ returned.
- <p>Case of value is unimportant.
- */
- static bool toBoolean(const LogString& value, bool dEfault);
- static int toInt(const LogString& value, int dEfault);
- static long toFileSize(const LogString& value, long dEfault);
- static LevelPtr toLevel(const LogString& value,
- const LevelPtr& defaultValue);
+ <p>Case of value is unimportant.
+ */
+ static bool toBoolean(const LogString& value, bool dEfault);
+ static int toInt(const LogString& value, int dEfault);
+ static long toFileSize(const LogString& value, long dEfault);
+ static LevelPtr toLevel(const LogString& value,
+ const LevelPtr& defaultValue);
- /**
- Find the value corresponding to <code>key</code> in
- <code>props</code>. Then perform variable substitution on the
- found value.
- */
- static LogString findAndSubst(const LogString& key, Properties& props);
+ /**
+ Find the value corresponding to <code>key</code> in
+ <code>props</code>. Then perform variable substitution on the
+ found value.
+ */
+ static LogString findAndSubst(const LogString& key, Properties& props);
- /**
- Perform variable substitution in string <code>val</code> from the
- values of keys found in the system propeties.
+ /**
+ Perform variable substitution in string <code>val</code> from the
+ values of keys found in the system propeties.
- <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
+ <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
- <p>For example, if the System properties contains "key=value", then
- the call
- <pre>
- String s = OptionConverter.substituteVars("Value of key is ${key}.");
- </pre>
+ <p>For example, if the System properties contains "key=value", then
+ the call
+ <pre>
+ String s = OptionConverter.substituteVars("Value of key is ${key}.");
+ </pre>
- will set the variable <code>s</code> to "Value of key is value.".
+ will set the variable <code>s</code> to "Value of key is value.".
- <p>If no value could be found for the specified key, then the
- <code>props</code> parameter is searched, if the value could not
- be found there, then substitution defaults to the empty string.
+ <p>If no value could be found for the specified key, then the
+ <code>props</code> parameter is searched, if the value could not
+ be found there, then substitution defaults to the empty string.
- <p>For example, if system propeties contains no value for the key
- "inexistentKey", then the call
+ <p>For example, if system propeties contains no value for the key
+ "inexistentKey", then the call
- <pre>
- String s = OptionConverter.subsVars("Value of inexistentKey is [${inexistentKey}]");
- </pre>
- will set <code>s</code> to "Value of inexistentKey is []"
+ <pre>
+ String s = OptionConverter.subsVars("Value of inexistentKey is [${inexistentKey}]");
+ </pre>
+ will set <code>s</code> to "Value of inexistentKey is []"
- <p>An IllegalArgumentException is thrown if
- <code>val</code> contains a start delimeter "${" which is not
- balanced by a stop delimeter "}". </p>
+ <p>An IllegalArgumentException is thrown if
+ <code>val</code> contains a start delimeter "${" which is not
+ balanced by a stop delimeter "}". </p>
- @param val The string on which variable substitution is performed.
- @param props The properties from which variable substitution is performed.
- @throws IllegalArgumentException if <code>val</code> is malformed.
- */
- static LogString substVars(const LogString& val, Properties& props);
+ @param val The string on which variable substitution is performed.
+ @param props The properties from which variable substitution is performed.
+ @throws IllegalArgumentException if <code>val</code> is malformed.
+ */
+ static LogString substVars(const LogString& val, Properties& props);
- /**
- * Gets the specified system property.
- @param key The key to search for.
- @param def The default value to return.
- @return the string value of the system property, or the default
- value if there is no property with that key.
- */
- static LogString getSystemProperty(const LogString& key, const LogString& def);
+ /**
+ * Gets the specified system property.
+ @param key The key to search for.
+ @param def The default value to return.
+ @return the string value of the system property, or the default
+ value if there is no property with that key.
+ */
+ static LogString getSystemProperty(const LogString& key, const LogString& def);
- /**
- Instantiate an object given a class name. Check that the
- <code>className</code> is a subclass of
- <code>superClass</code>. If that test fails or the object could
- not be instantiated, then <code>defaultValue</code> is returned.
+ /**
+ Instantiate an object given a class name. Check that the
+ <code>className</code> is a subclass of
+ <code>superClass</code>. If that test fails or the object could
+ not be instantiated, then <code>defaultValue</code> is returned.
- @param className The fully qualified class name of the object to instantiate.
- @param superClass The class to which the new object should belong.
- @param defaultValue The object to return in case of non-fulfillment
- */
- static ObjectPtr instantiateByClassName(const LogString& className,
- const Class& superClass, const ObjectPtr& defaultValue);
+ @param className The fully qualified class name of the object to instantiate.
+ @param superClass The class to which the new object should belong.
+ @param defaultValue The object to return in case of non-fulfillment
+ */
+ static ObjectPtr instantiateByClassName(const LogString& className,
+ const Class& superClass, const ObjectPtr& defaultValue);
- static ObjectPtr instantiateByKey(Properties& props,
- const LogString& key, const Class& superClass,
- const ObjectPtr& defaultValue);
+ static ObjectPtr instantiateByKey(Properties& props,
+ const LogString& key, const Class& superClass,
+ const ObjectPtr& defaultValue);
- /**
- Configure log4cxx given a configFileName.
+ /**
+ Configure log4cxx given a configFileName.
- <p>The configFileName must point to a file which will be
- interpreted by a new instance of a log4cxx configurator.
+ <p>The configFileName must point to a file which will be
+ interpreted by a new instance of a log4cxx configurator.
- <p>All configurations steps are taken on the
- <code>hierarchy</code> passed as a parameter.
+ <p>All configurations steps are taken on the
+ <code>hierarchy</code> passed as a parameter.
- <p>
- @param configFileName The location of the configuration file.
- @param clazz The classname, of the log4cxx configurator which
- will parse the file <code>configFileName</code>. This must be
- a subclass of Configurator, or null. If this value is null then
- a default configurator of PropertyConfigurator is used, unless the
- filename pointed to by <code>configFileName</code> ends in '.xml',
- in which case DOMConfigurator is used.
- @param hierarchy The Hierarchy to act on.
- */
- static void selectAndConfigure(const File& configFileName,
- const LogString& clazz, spi::LoggerRepositoryPtr& hierarchy);
+ <p>
+ @param configFileName The location of the configuration file.
+ @param clazz The classname, of the log4cxx configurator which
+ will parse the file <code>configFileName</code>. This must be
+ a subclass of Configurator, or null. If this value is null then
+ a default configurator of PropertyConfigurator is used, unless the
+ filename pointed to by <code>configFileName</code> ends in '.xml',
+ in which case DOMConfigurator is used.
+ @param hierarchy The Hierarchy to act on.
+ */
+ static void selectAndConfigure(const File& configFileName,
+ const LogString& clazz, spi::LoggerRepositoryPtr& hierarchy);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/outputstream.h b/src/main/include/log4cxx/helpers/outputstream.h
index f283355..58e1a62 100644
--- a/src/main/include/log4cxx/helpers/outputstream.h
+++ b/src/main/include/log4cxx/helpers/outputstream.h
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/objectimpl.h>
#ifdef LOG4CXX_MULTI_PROCESS
- #include <apr_file_io.h>
+ #include <apr_file_io.h>
#endif
namespace log4cxx
@@ -35,28 +35,28 @@
*/
class LOG4CXX_EXPORT OutputStream : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(OutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(OutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(OutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(OutputStream)
+ END_LOG4CXX_CAST_MAP()
- protected:
- OutputStream();
- virtual ~OutputStream();
+ protected:
+ OutputStream();
+ virtual ~OutputStream();
- public:
- virtual void close(Pool& p) = 0;
- virtual void flush(Pool& p) = 0;
- virtual void write(ByteBuffer& buf, Pool& p) = 0;
+ public:
+ virtual void close(Pool& p) = 0;
+ virtual void flush(Pool& p) = 0;
+ virtual void write(ByteBuffer& buf, Pool& p) = 0;
#ifdef LOG4CXX_MULTI_PROCESS
- virtual apr_file_t* getFilePtr();
- virtual OutputStream& getFileOutPutStreamPtr();
+ virtual apr_file_t* getFilePtr();
+ virtual OutputStream& getFileOutPutStreamPtr();
#endif
- private:
- OutputStream(const OutputStream&);
- OutputStream& operator=(const OutputStream&);
+ private:
+ OutputStream(const OutputStream&);
+ OutputStream& operator=(const OutputStream&);
};
LOG4CXX_PTR_DEF(OutputStream);
diff --git a/src/main/include/log4cxx/helpers/outputstreamwriter.h b/src/main/include/log4cxx/helpers/outputstreamwriter.h
index 3491e6d..ee153b1 100644
--- a/src/main/include/log4cxx/helpers/outputstreamwriter.h
+++ b/src/main/include/log4cxx/helpers/outputstreamwriter.h
@@ -33,36 +33,36 @@
*/
class LOG4CXX_EXPORT OutputStreamWriter : public Writer
{
- private:
- OutputStreamPtr out;
- CharsetEncoderPtr enc;
+ private:
+ OutputStreamPtr out;
+ CharsetEncoderPtr enc;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(OutputStreamWriter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(OutputStreamWriter)
- LOG4CXX_CAST_ENTRY_CHAIN(Writer)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(OutputStreamWriter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(OutputStreamWriter)
+ LOG4CXX_CAST_ENTRY_CHAIN(Writer)
+ END_LOG4CXX_CAST_MAP()
- OutputStreamWriter(OutputStreamPtr& out);
- OutputStreamWriter(OutputStreamPtr& out, CharsetEncoderPtr& enc);
- ~OutputStreamWriter();
+ OutputStreamWriter(OutputStreamPtr& out);
+ OutputStreamWriter(OutputStreamPtr& out, CharsetEncoderPtr& enc);
+ ~OutputStreamWriter();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(const LogString& str, Pool& p);
- LogString getEncoding() const;
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(const LogString& str, Pool& p);
+ LogString getEncoding() const;
#ifdef LOG4CXX_MULTI_PROCESS
- OutputStreamPtr getOutPutStreamPtr()
- {
- return out;
- }
+ OutputStreamPtr getOutPutStreamPtr()
+ {
+ return out;
+ }
#endif
- private:
- OutputStreamWriter(const OutputStreamWriter&);
- OutputStreamWriter& operator=(const OutputStreamWriter&);
+ private:
+ OutputStreamWriter(const OutputStreamWriter&);
+ OutputStreamWriter& operator=(const OutputStreamWriter&);
};
LOG4CXX_PTR_DEF(OutputStreamWriter);
diff --git a/src/main/include/log4cxx/helpers/pool.h b/src/main/include/log4cxx/helpers/pool.h
index 9a18da1..ac41049 100644
--- a/src/main/include/log4cxx/helpers/pool.h
+++ b/src/main/include/log4cxx/helpers/pool.h
@@ -22,7 +22,7 @@
#include <string>
extern "C" {
- struct apr_pool_t;
+ struct apr_pool_t;
}
namespace log4cxx
@@ -31,27 +31,27 @@
{
class LOG4CXX_EXPORT Pool
{
- public:
- Pool();
- Pool(apr_pool_t* pool, bool release);
- ~Pool();
+ public:
+ Pool();
+ Pool(apr_pool_t* pool, bool release);
+ ~Pool();
- apr_pool_t* getAPRPool();
- apr_pool_t* create();
- void* palloc(size_t length);
- char* pstralloc(size_t length);
- char* itoa(int n);
- char* pstrndup(const char* s, size_t len);
- char* pstrdup(const char* s);
- char* pstrdup(const std::string&);
+ apr_pool_t* getAPRPool();
+ apr_pool_t* create();
+ void* palloc(size_t length);
+ char* pstralloc(size_t length);
+ char* itoa(int n);
+ char* pstrndup(const char* s, size_t len);
+ char* pstrdup(const char* s);
+ char* pstrdup(const std::string&);
- protected:
- apr_pool_t* pool;
- const bool release;
+ protected:
+ apr_pool_t* pool;
+ const bool release;
- private:
- Pool(const log4cxx::helpers::Pool&);
- Pool& operator=(const Pool&);
+ private:
+ Pool(const log4cxx::helpers::Pool&);
+ Pool& operator=(const Pool&);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/properties.h b/src/main/include/log4cxx/helpers/properties.h
index 951cad6..e1182d2 100644
--- a/src/main/include/log4cxx/helpers/properties.h
+++ b/src/main/include/log4cxx/helpers/properties.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPER_PROPERTIES_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -38,148 +38,148 @@
{
class LOG4CXX_EXPORT Properties
{
- private:
- typedef std::map<LogString, LogString> PropertyMap;
- PropertyMap* properties;
- Properties(const Properties&);
- Properties& operator=(const Properties&);
+ private:
+ typedef std::map<LogString, LogString> PropertyMap;
+ PropertyMap* properties;
+ Properties(const Properties&);
+ Properties& operator=(const Properties&);
- public:
- /**
- * Create new instance.
- */
- Properties();
- /**
- * Destructor.
- */
- ~Properties();
- /**
- Reads a property list (key and element pairs) from the input stream.
- The stream is assumed to be using the ISO 8859-1 character encoding.
+ public:
+ /**
+ * Create new instance.
+ */
+ Properties();
+ /**
+ * Destructor.
+ */
+ ~Properties();
+ /**
+ Reads a property list (key and element pairs) from the input stream.
+ The stream is assumed to be using the ISO 8859-1 character encoding.
- <p>Every property occupies one line of the input stream.
- Each line is terminated by a line terminator (<code>\\n</code> or
- <code>\\r</code> or <code>\\r\\n</code>).
- Lines from the input stream are processed until end of file is reached
- on the input stream.
+ <p>Every property occupies one line of the input stream.
+ Each line is terminated by a line terminator (<code>\\n</code> or
+ <code>\\r</code> or <code>\\r\\n</code>).
+ Lines from the input stream are processed until end of file is reached
+ on the input stream.
- <p>A line that contains only whitespace or whose first non-whitespace
- character is an ASCII <code>#</code> or <code>!</code> is ignored
- (thus, <code>#</code> or <code>!</code> indicate comment lines).
+ <p>A line that contains only whitespace or whose first non-whitespace
+ character is an ASCII <code>#</code> or <code>!</code> is ignored
+ (thus, <code>#</code> or <code>!</code> indicate comment lines).
- <p>Every line other than a blank line or a comment line describes one
- property to be added to the table (except that if a line ends with \,
- then the following line, if it exists, is treated as a continuation
- line, as described below). The key consists of all the characters in
- the line starting with the first non-whitespace character and up to,
- but not including, the first ASCII <code>=</code>, <code>:</code>,
- or whitespace character. All of the
- key termination characters may be included in the key by preceding them
- with a <code>\\</code>. Any whitespace after the key is skipped;
- if the first
- non-whitespace character after the key is <code>=</code> or
- <code>:</code>, then it is ignored
- and any whitespace characters after it are also skipped. All remaining
- characters on the line become part of the associated element string.
- Within the element string, the ASCII escape sequences <code>\\t</code>,
- <code>\\n</code>, <code>\\r</code>, <code>\\</code>, <code>\\"</code>,
- <code>\\'</code>, <code>\\</code> (a backslash and a space), and
- <code>\\uxxxx</code> are recognized
- and converted to single characters. Moreover, if the last character on
- the line is <code>\\</code>, then the next line is treated as a
- continuation of the
- current line; the <code>\\</code> and line terminator are simply
- discarded, and any
- leading whitespace characters on the continuation line are also
- discarded and are not part of the element string.
+ <p>Every line other than a blank line or a comment line describes one
+ property to be added to the table (except that if a line ends with \,
+ then the following line, if it exists, is treated as a continuation
+ line, as described below). The key consists of all the characters in
+ the line starting with the first non-whitespace character and up to,
+ but not including, the first ASCII <code>=</code>, <code>:</code>,
+ or whitespace character. All of the
+ key termination characters may be included in the key by preceding them
+ with a <code>\\</code>. Any whitespace after the key is skipped;
+ if the first
+ non-whitespace character after the key is <code>=</code> or
+ <code>:</code>, then it is ignored
+ and any whitespace characters after it are also skipped. All remaining
+ characters on the line become part of the associated element string.
+ Within the element string, the ASCII escape sequences <code>\\t</code>,
+ <code>\\n</code>, <code>\\r</code>, <code>\\</code>, <code>\\"</code>,
+ <code>\\'</code>, <code>\\</code> (a backslash and a space), and
+ <code>\\uxxxx</code> are recognized
+ and converted to single characters. Moreover, if the last character on
+ the line is <code>\\</code>, then the next line is treated as a
+ continuation of the
+ current line; the <code>\\</code> and line terminator are simply
+ discarded, and any
+ leading whitespace characters on the continuation line are also
+ discarded and are not part of the element string.
- <p>As an example, each of the following four lines specifies the key
- "Truth" and the associated element value "Beauty":
+ <p>As an example, each of the following four lines specifies the key
+ "Truth" and the associated element value "Beauty":
- <pre>
- Truth = Beauty
- Truth:Beauty
- Truth :Beauty
- </pre>
+ <pre>
+ Truth = Beauty
+ Truth:Beauty
+ Truth :Beauty
+ </pre>
- As another example, the following three lines specify a single
- property:
- <pre>
- fruits apple, banana, pear, \
- cantaloupe, watermelon, \
- kiwi, mango
- </pre>
- The key is "<code>fruits</code>" and the associated element is:
- <pre>
- "apple, banana, pear, cantaloupe, watermelon, kiwi, mango"
- </pre>
- Note that a space appears before each \ so that a space will appear
- after each comma in the final result; the \, line terminator, and
- leading whitespace on the continuation line are merely discarded and are
- not replaced by one or more other characters.
+ As another example, the following three lines specify a single
+ property:
+ <pre>
+ fruits apple, banana, pear, \
+ cantaloupe, watermelon, \
+ kiwi, mango
+ </pre>
+ The key is "<code>fruits</code>" and the associated element is:
+ <pre>
+ "apple, banana, pear, cantaloupe, watermelon, kiwi, mango"
+ </pre>
+ Note that a space appears before each \ so that a space will appear
+ after each comma in the final result; the \, line terminator, and
+ leading whitespace on the continuation line are merely discarded and are
+ not replaced by one or more other characters.
- <p>As a third example, the line:
- <pre>
- cheeses
- </pre>
- specifies that the key is "<code>cheeses</code>" and the associated
- element is the empty string.
+ <p>As a third example, the line:
+ <pre>
+ cheeses
+ </pre>
+ specifies that the key is "<code>cheeses</code>" and the associated
+ element is the empty string.
- @param inStream the input stream.
+ @param inStream the input stream.
- @throw IOException if an error occurred when reading from the input
- stream.
- */
- void load(InputStreamPtr inStream);
+ @throw IOException if an error occurred when reading from the input
+ stream.
+ */
+ void load(InputStreamPtr inStream);
- /**
- * Calls Properties::put.
- * @param key the key to be placed into this property list.
- * @param value the value corresponding to key.
- * @return the previous value of the specified key in this
- * property list, or an empty string if it did not have one.
- */
- LogString setProperty(const LogString& key, const LogString& value);
- /**
- * Puts a property value into the collection.
- * @param key the key to be placed into this property list.
- * @param value the value corresponding to key.
- * @return the previous value of the specified key in this
- * property list, or an empty string if it did not have one.
- */
- LogString put(const LogString& key, const LogString& value);
+ /**
+ * Calls Properties::put.
+ * @param key the key to be placed into this property list.
+ * @param value the value corresponding to key.
+ * @return the previous value of the specified key in this
+ * property list, or an empty string if it did not have one.
+ */
+ LogString setProperty(const LogString& key, const LogString& value);
+ /**
+ * Puts a property value into the collection.
+ * @param key the key to be placed into this property list.
+ * @param value the value corresponding to key.
+ * @return the previous value of the specified key in this
+ * property list, or an empty string if it did not have one.
+ */
+ LogString put(const LogString& key, const LogString& value);
- /**
- * Calls Properties::get.
- * @param key the property key.
- * @return the value in this property list with the specified
- * key value or empty string.
- */
- LogString getProperty(const LogString& key) const;
- /**
- * Gets a property value.
- * @param key the property key.
- * @return the value in this property list with the specified
- * key value or empty string.
- */
- LogString get(const LogString& key) const;
+ /**
+ * Calls Properties::get.
+ * @param key the property key.
+ * @return the value in this property list with the specified
+ * key value or empty string.
+ */
+ LogString getProperty(const LogString& key) const;
+ /**
+ * Gets a property value.
+ * @param key the property key.
+ * @return the value in this property list with the specified
+ * key value or empty string.
+ */
+ LogString get(const LogString& key) const;
- /**
- Returns an enumeration of all the keys in this property list,
- including distinct keys in the default property list if a key
- of the same name has not already been found from the main
- properties list.
- @return an array of all the keys in this
- property list, including the keys in the default property list.
- */
- std::vector<LogString> propertyNames() const;
+ /**
+ Returns an enumeration of all the keys in this property list,
+ including distinct keys in the default property list if a key
+ of the same name has not already been found from the main
+ properties list.
+ @return an array of all the keys in this
+ property list, including the keys in the default property list.
+ */
+ std::vector<LogString> propertyNames() const;
}; // class Properties
} // namespace helpers
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/helpers/propertyresourcebundle.h b/src/main/include/log4cxx/helpers/propertyresourcebundle.h
index 2ab2f0c..1bba8c5 100644
--- a/src/main/include/log4cxx/helpers/propertyresourcebundle.h
+++ b/src/main/include/log4cxx/helpers/propertyresourcebundle.h
@@ -34,25 +34,25 @@
*/
class LOG4CXX_EXPORT PropertyResourceBundle : public ResourceBundle
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(PropertyResourceBundle)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(PropertyResourceBundle)
- LOG4CXX_CAST_ENTRY_CHAIN(ResourceBundle)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(PropertyResourceBundle)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(PropertyResourceBundle)
+ LOG4CXX_CAST_ENTRY_CHAIN(ResourceBundle)
+ END_LOG4CXX_CAST_MAP()
- /**
- Creates a property resource bundle.
- @param inStream property file to read from.
- @throw IOException if an error occurred when reading from the
- input stream.
- */
- PropertyResourceBundle(InputStreamPtr inStream);
+ /**
+ Creates a property resource bundle.
+ @param inStream property file to read from.
+ @throw IOException if an error occurred when reading from the
+ input stream.
+ */
+ PropertyResourceBundle(InputStreamPtr inStream);
- virtual LogString getString(const LogString& key) const;
+ virtual LogString getString(const LogString& key) const;
- protected:
- Properties properties;
+ protected:
+ Properties properties;
}; // class PropertyResourceBundle
LOG4CXX_PTR_DEF(PropertyResourceBundle);
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/reader.h b/src/main/include/log4cxx/helpers/reader.h
index 19ab81c..d3ed41a 100644
--- a/src/main/include/log4cxx/helpers/reader.h
+++ b/src/main/include/log4cxx/helpers/reader.h
@@ -32,37 +32,37 @@
*/
class LOG4CXX_EXPORT Reader : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Reader)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Reader)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Reader)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Reader)
+ END_LOG4CXX_CAST_MAP()
- protected:
- /**
- * Creates a new character-stream reader.
- */
- Reader();
+ protected:
+ /**
+ * Creates a new character-stream reader.
+ */
+ Reader();
- virtual ~Reader();
+ virtual ~Reader();
- public:
- /**
- * Closes the stream.
- * @param p The memory pool associated with the reader.
- */
- virtual void close(Pool& p) = 0;
+ public:
+ /**
+ * Closes the stream.
+ * @param p The memory pool associated with the reader.
+ */
+ virtual void close(Pool& p) = 0;
- /**
- * @return The complete stream contents as a LogString.
- * @param p The memory pool associated with the reader.
- */
- virtual LogString read(Pool& p) = 0;
+ /**
+ * @return The complete stream contents as a LogString.
+ * @param p The memory pool associated with the reader.
+ */
+ virtual LogString read(Pool& p) = 0;
- private:
- Reader(const Reader&);
+ private:
+ Reader(const Reader&);
- Reader& operator=(const Reader&);
+ Reader& operator=(const Reader&);
};
LOG4CXX_PTR_DEF(Reader);
diff --git a/src/main/include/log4cxx/helpers/relativetimedateformat.h b/src/main/include/log4cxx/helpers/relativetimedateformat.h
index b92997e..835cdeb 100644
--- a/src/main/include/log4cxx/helpers/relativetimedateformat.h
+++ b/src/main/include/log4cxx/helpers/relativetimedateformat.h
@@ -31,14 +31,14 @@
*/
class LOG4CXX_EXPORT RelativeTimeDateFormat : public DateFormat
{
- public:
- RelativeTimeDateFormat();
- virtual void format(LogString& s,
- log4cxx_time_t tm,
- log4cxx::helpers::Pool& p) const;
+ public:
+ RelativeTimeDateFormat();
+ virtual void format(LogString& s,
+ log4cxx_time_t tm,
+ log4cxx::helpers::Pool& p) const;
- private:
- log4cxx_time_t startTime;
+ private:
+ log4cxx_time_t startTime;
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/resourcebundle.h b/src/main/include/log4cxx/helpers/resourcebundle.h
index 4dddd36..56ada06 100644
--- a/src/main/include/log4cxx/helpers/resourcebundle.h
+++ b/src/main/include/log4cxx/helpers/resourcebundle.h
@@ -35,54 +35,54 @@
*/
class LOG4CXX_EXPORT ResourceBundle : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ResourceBundle)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ResourceBundle)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ResourceBundle)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ResourceBundle)
+ END_LOG4CXX_CAST_MAP()
- /**
- Gets a string for the given key from this resource bundle or one of
- its parents. Calling this method is equivalent to calling
+ /**
+ Gets a string for the given key from this resource bundle or one of
+ its parents. Calling this method is equivalent to calling
- @param key the key for the desired string
- @return the string for the given key
- @throw MissingResourceException - if no object for the given key
- can be found
- */
- virtual LogString getString(const LogString& key) const = 0;
+ @param key the key for the desired string
+ @return the string for the given key
+ @throw MissingResourceException - if no object for the given key
+ can be found
+ */
+ virtual LogString getString(const LogString& key) const = 0;
- /**
- Gets a resource bundle using the specified base name and locale
+ /**
+ Gets a resource bundle using the specified base name and locale
- @param baseName the base name of the resource bundle, a fully
- qualified class name or property filename
- @param locale the locale for which a resource bundle is desired
- */
- static ResourceBundlePtr getBundle(const LogString& baseName,
- const Locale& locale);
+ @param baseName the base name of the resource bundle, a fully
+ qualified class name or property filename
+ @param locale the locale for which a resource bundle is desired
+ */
+ static ResourceBundlePtr getBundle(const LogString& baseName,
+ const Locale& locale);
- protected:
- /*
- Sets the parent bundle of this bundle. The parent bundle is
- searched by #getString when this bundle does not contain a particular
- resource.
+ protected:
+ /*
+ Sets the parent bundle of this bundle. The parent bundle is
+ searched by #getString when this bundle does not contain a particular
+ resource.
- Parameters:
- parent - this bundle's parent bundle.
- */
- inline void setParent(const ResourceBundlePtr& parent1)
- {
- this->parent = parent1;
- }
+ Parameters:
+ parent - this bundle's parent bundle.
+ */
+ inline void setParent(const ResourceBundlePtr& parent1)
+ {
+ this->parent = parent1;
+ }
- /**
- The parent bundle of this bundle.
+ /**
+ The parent bundle of this bundle.
- The parent bundle is searched by #getString when this bundle does
- not contain a particular resource.
- */
- ResourceBundlePtr parent;
+ The parent bundle is searched by #getString when this bundle does
+ not contain a particular resource.
+ */
+ ResourceBundlePtr parent;
}; // class ResourceBundle
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/serversocket.h b/src/main/include/log4cxx/helpers/serversocket.h
index 935d455..322dcd0 100644
--- a/src/main/include/log4cxx/helpers/serversocket.h
+++ b/src/main/include/log4cxx/helpers/serversocket.h
@@ -27,35 +27,35 @@
{
class LOG4CXX_EXPORT ServerSocket
{
- public:
- /** Creates a server socket on a specified port.
- */
- ServerSocket(int port);
+ public:
+ /** Creates a server socket on a specified port.
+ */
+ ServerSocket(int port);
- virtual ~ServerSocket();
+ virtual ~ServerSocket();
- /** Listens for a connection to be made to this socket and
- accepts it
- */
- SocketPtr accept();
+ /** Listens for a connection to be made to this socket and
+ accepts it
+ */
+ SocketPtr accept();
- /** Closes this socket.
- */
- void close();
+ /** Closes this socket.
+ */
+ void close();
- /** Retrive setting for SO_TIMEOUT.
- */
- int getSoTimeout() const;
+ /** Retrive setting for SO_TIMEOUT.
+ */
+ int getSoTimeout() const;
- /** Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
- */
- void setSoTimeout(int timeout);
+ /** Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
+ */
+ void setSoTimeout(int timeout);
- private:
- Pool pool;
- Mutex mutex;
- apr_socket_t* socket;
- int timeout;
+ private:
+ Pool pool;
+ Mutex mutex;
+ apr_socket_t* socket;
+ int timeout;
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/simpledateformat.h b/src/main/include/log4cxx/helpers/simpledateformat.h
index a650b4d..4f401d9 100644
--- a/src/main/include/log4cxx/helpers/simpledateformat.h
+++ b/src/main/include/log4cxx/helpers/simpledateformat.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_SIMPLE_DATE_FORMAT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -51,40 +51,40 @@
*/
class LOG4CXX_EXPORT SimpleDateFormat : public DateFormat
{
- public:
- /**
- * Constructs a DateFormat using the given pattern and the default
- * time zone.
- *
- * @param pattern the pattern describing the date and time format
- */
- SimpleDateFormat(const LogString& pattern);
- SimpleDateFormat(const LogString& pattern, const std::locale* locale);
- ~SimpleDateFormat();
+ public:
+ /**
+ * Constructs a DateFormat using the given pattern and the default
+ * time zone.
+ *
+ * @param pattern the pattern describing the date and time format
+ */
+ SimpleDateFormat(const LogString& pattern);
+ SimpleDateFormat(const LogString& pattern, const std::locale* locale);
+ ~SimpleDateFormat();
- virtual void format(LogString& s,
- log4cxx_time_t tm,
- log4cxx::helpers::Pool& p) const;
+ virtual void format(LogString& s,
+ log4cxx_time_t tm,
+ log4cxx::helpers::Pool& p) const;
- /**
- * Set time zone.
- * @param zone new time zone.
- */
- void setTimeZone(const TimeZonePtr& zone);
+ /**
+ * Set time zone.
+ * @param zone new time zone.
+ */
+ void setTimeZone(const TimeZonePtr& zone);
- private:
- /**
- * Time zone.
- */
- TimeZonePtr timeZone;
+ private:
+ /**
+ * Time zone.
+ */
+ TimeZonePtr timeZone;
- /**
- * List of tokens.
- */
- PatternTokenList pattern;
+ /**
+ * List of tokens.
+ */
+ PatternTokenList pattern;
- static void addToken(const logchar spec, const int repeat, const std::locale* locale, PatternTokenList& pattern);
- static void parsePattern(const LogString& spec, const std::locale* locale, PatternTokenList& pattern);
+ static void addToken(const logchar spec, const int repeat, const std::locale* locale, PatternTokenList& pattern);
+ static void parsePattern(const LogString& spec, const std::locale* locale, PatternTokenList& pattern);
};
@@ -92,7 +92,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/helpers/socket.h b/src/main/include/log4cxx/helpers/socket.h
index 11c84ac..4bfbd1f 100644
--- a/src/main/include/log4cxx/helpers/socket.h
+++ b/src/main/include/log4cxx/helpers/socket.h
@@ -19,7 +19,7 @@
#define _LOG4CXX_HELPERS_SOCKET_H
extern "C" {
- struct apr_socket_t;
+ struct apr_socket_t;
}
@@ -42,44 +42,44 @@
*/
class LOG4CXX_EXPORT Socket : public helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Socket)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Socket)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Socket)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Socket)
+ END_LOG4CXX_CAST_MAP()
- /** Creates a stream socket and connects it to the specified port
- number at the specified IP address.
- */
- Socket(InetAddressPtr& address, int port);
- Socket(apr_socket_t* socket, apr_pool_t* pool);
- ~Socket();
+ /** Creates a stream socket and connects it to the specified port
+ number at the specified IP address.
+ */
+ Socket(InetAddressPtr& address, int port);
+ Socket(apr_socket_t* socket, apr_pool_t* pool);
+ ~Socket();
- size_t write(ByteBuffer&);
+ size_t write(ByteBuffer&);
- /** Closes this socket. */
- void close();
+ /** Closes this socket. */
+ void close();
- /** Returns the value of this socket's address field. */
- InetAddressPtr getInetAddress() const;
+ /** Returns the value of this socket's address field. */
+ InetAddressPtr getInetAddress() const;
- /** Returns the value of this socket's port field. */
- int getPort() const;
- private:
- Socket(const Socket&);
- Socket& operator=(const Socket&);
+ /** Returns the value of this socket's port field. */
+ int getPort() const;
+ private:
+ Socket(const Socket&);
+ Socket& operator=(const Socket&);
- Pool pool;
+ Pool pool;
- apr_socket_t* socket;
+ apr_socket_t* socket;
- /** The IP address of the remote end of this socket. */
- InetAddressPtr address;
+ /** The IP address of the remote end of this socket. */
+ InetAddressPtr address;
- /** The port number on the remote host to which
- this socket is connected. */
- int port;
+ /** The port number on the remote host to which
+ this socket is connected. */
+ int port;
};
LOG4CXX_PTR_DEF(Socket);
diff --git a/src/main/include/log4cxx/helpers/socketoutputstream.h b/src/main/include/log4cxx/helpers/socketoutputstream.h
index 476fc50..4cc9b8a 100644
--- a/src/main/include/log4cxx/helpers/socketoutputstream.h
+++ b/src/main/include/log4cxx/helpers/socketoutputstream.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_SOCKET_OUTPUT_STREAM_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -36,27 +36,27 @@
class LOG4CXX_EXPORT SocketOutputStream : public OutputStream
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(SocketOutputStream)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SocketOutputStream)
- LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(SocketOutputStream)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SocketOutputStream)
+ LOG4CXX_CAST_ENTRY_CHAIN(OutputStream)
+ END_LOG4CXX_CAST_MAP()
- SocketOutputStream(const SocketPtr& socket);
- ~SocketOutputStream();
+ SocketOutputStream(const SocketPtr& socket);
+ ~SocketOutputStream();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(ByteBuffer& buf, Pool& p);
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(ByteBuffer& buf, Pool& p);
- private:
- ByteList array;
- SocketPtr socket;
- //
- // prevent copy and assignment statements
- SocketOutputStream(const SocketOutputStream&);
- SocketOutputStream& operator=(const SocketOutputStream&);
+ private:
+ ByteList array;
+ SocketPtr socket;
+ //
+ // prevent copy and assignment statements
+ SocketOutputStream(const SocketOutputStream&);
+ SocketOutputStream& operator=(const SocketOutputStream&);
};
@@ -66,7 +66,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/helpers/strftimedateformat.h b/src/main/include/log4cxx/helpers/strftimedateformat.h
index ecacd89..a9b3ff7 100644
--- a/src/main/include/log4cxx/helpers/strftimedateformat.h
+++ b/src/main/include/log4cxx/helpers/strftimedateformat.h
@@ -32,33 +32,33 @@
*/
class LOG4CXX_EXPORT StrftimeDateFormat : public DateFormat
{
- public:
- /**
- Constructs a DateFormat using the given pattern and the default
- time zone.
+ public:
+ /**
+ Constructs a DateFormat using the given pattern and the default
+ time zone.
- @param pattern the pattern describing the date and time format
- */
- StrftimeDateFormat(const LogString& pattern);
- ~StrftimeDateFormat();
+ @param pattern the pattern describing the date and time format
+ */
+ StrftimeDateFormat(const LogString& pattern);
+ ~StrftimeDateFormat();
- virtual void format(LogString& s,
- log4cxx_time_t tm,
- log4cxx::helpers::Pool& p) const;
+ virtual void format(LogString& s,
+ log4cxx_time_t tm,
+ log4cxx::helpers::Pool& p) const;
- /**
- * Set time zone.
- * @param zone new time zone.
- */
- void setTimeZone(const TimeZonePtr& zone);
+ /**
+ * Set time zone.
+ * @param zone new time zone.
+ */
+ void setTimeZone(const TimeZonePtr& zone);
- private:
- /**
- * Time zone.
- */
- TimeZonePtr timeZone;
- std::string pattern;
+ private:
+ /**
+ * Time zone.
+ */
+ TimeZonePtr timeZone;
+ std::string pattern;
};
diff --git a/src/main/include/log4cxx/helpers/strictmath.h b/src/main/include/log4cxx/helpers/strictmath.h
index 8eff4d3..5f642cd 100644
--- a/src/main/include/log4cxx/helpers/strictmath.h
+++ b/src/main/include/log4cxx/helpers/strictmath.h
@@ -30,18 +30,18 @@
*/
class StrictMath
{
- public:
- template<typename _type> static inline const _type&
- minimum(const _type& a, const _type& b)
- {
- return (a < b) ? a : b;
- }
+ public:
+ template<typename _type> static inline const _type&
+ minimum(const _type& a, const _type& b)
+ {
+ return (a < b) ? a : b;
+ }
- template<typename _type> static inline const _type&
- maximum(const _type& a, const _type& b)
- {
- return (a > b) ? a : b;
- }
+ template<typename _type> static inline const _type&
+ maximum(const _type& a, const _type& b)
+ {
+ return (a > b) ? a : b;
+ }
}; // class StrictMath
} // namespace helpers
} // namespace log4cx
diff --git a/src/main/include/log4cxx/helpers/stringhelper.h b/src/main/include/log4cxx/helpers/stringhelper.h
index 82ffb18..cfbb0c2 100644
--- a/src/main/include/log4cxx/helpers/stringhelper.h
+++ b/src/main/include/log4cxx/helpers/stringhelper.h
@@ -32,28 +32,28 @@
*/
class LOG4CXX_EXPORT StringHelper
{
- public:
- static LogString trim(const LogString& s);
- static bool startsWith(const LogString& s, const LogString& suffix);
- static bool endsWith(const LogString& s, const LogString& suffix);
- static bool equalsIgnoreCase(const LogString& s1,
- const logchar* upper, const logchar* lower);
- static bool equalsIgnoreCase(const LogString& s1,
- const LogString& upper, const LogString& lower);
+ public:
+ static LogString trim(const LogString& s);
+ static bool startsWith(const LogString& s, const LogString& suffix);
+ static bool endsWith(const LogString& s, const LogString& suffix);
+ static bool equalsIgnoreCase(const LogString& s1,
+ const logchar* upper, const logchar* lower);
+ static bool equalsIgnoreCase(const LogString& s1,
+ const LogString& upper, const LogString& lower);
- static int toInt(const LogString& s);
- static log4cxx_int64_t toInt64(const LogString& s);
+ static int toInt(const LogString& s);
+ static log4cxx_int64_t toInt64(const LogString& s);
- static void toString(int i, log4cxx::helpers::Pool& pool, LogString& dst);
- static void toString(log4cxx_int64_t i, log4cxx::helpers::Pool& pool, LogString& dst);
- static void toString(size_t i, log4cxx::helpers::Pool& pool, LogString& dst);
+ static void toString(int i, log4cxx::helpers::Pool& pool, LogString& dst);
+ static void toString(log4cxx_int64_t i, log4cxx::helpers::Pool& pool, LogString& dst);
+ static void toString(size_t i, log4cxx::helpers::Pool& pool, LogString& dst);
- static void toString(bool val, LogString& dst);
+ static void toString(bool val, LogString& dst);
- static LogString toLowerCase(const LogString& s);
+ static LogString toLowerCase(const LogString& s);
- static LogString format(const LogString& pattern, const std::vector<LogString>& params);
+ static LogString format(const LogString& pattern, const std::vector<LogString>& params);
};
}
}
diff --git a/src/main/include/log4cxx/helpers/stringtokenizer.h b/src/main/include/log4cxx/helpers/stringtokenizer.h
index 692467b..f227724 100644
--- a/src/main/include/log4cxx/helpers/stringtokenizer.h
+++ b/src/main/include/log4cxx/helpers/stringtokenizer.h
@@ -27,21 +27,21 @@
{
class LOG4CXX_EXPORT StringTokenizer
{
- public:
- StringTokenizer(const LogString& str, const LogString& delim);
- ~StringTokenizer();
- bool hasMoreTokens() const;
- LogString nextToken();
+ public:
+ StringTokenizer(const LogString& str, const LogString& delim);
+ ~StringTokenizer();
+ bool hasMoreTokens() const;
+ LogString nextToken();
- protected:
- LogString src;
- LogString delim;
- size_t pos;
+ protected:
+ LogString src;
+ LogString delim;
+ size_t pos;
- private:
- // prevent copy and assignment statements
- StringTokenizer(const StringTokenizer&);
- StringTokenizer& operator=(const StringTokenizer&);
+ private:
+ // prevent copy and assignment statements
+ StringTokenizer(const StringTokenizer&);
+ StringTokenizer& operator=(const StringTokenizer&);
}; // class StringTokenizer
} // namespace helpers;
} // namespace log4cxx;
diff --git a/src/main/include/log4cxx/helpers/synchronized.h b/src/main/include/log4cxx/helpers/synchronized.h
index 18963ae..ad0bf2f 100644
--- a/src/main/include/log4cxx/helpers/synchronized.h
+++ b/src/main/include/log4cxx/helpers/synchronized.h
@@ -20,7 +20,7 @@
#include <log4cxx/log4cxx.h>
extern "C" {
- typedef struct apr_thread_mutex_t apr_thread_mutex_t;
+ typedef struct apr_thread_mutex_t apr_thread_mutex_t;
}
namespace log4cxx
@@ -32,17 +32,17 @@
/** utility class for objects multi-thread synchronization.*/
class LOG4CXX_EXPORT synchronized
{
- public:
- synchronized(const Mutex& mutex);
- synchronized(apr_thread_mutex_t* mutex);
- ~synchronized();
+ public:
+ synchronized(const Mutex& mutex);
+ synchronized(apr_thread_mutex_t* mutex);
+ ~synchronized();
- private:
- void* mutex;
- // prevent use of copy and assignment
- synchronized(const synchronized&);
- synchronized& operator=(const synchronized&);
+ private:
+ void* mutex;
+ // prevent use of copy and assignment
+ synchronized(const synchronized&);
+ synchronized& operator=(const synchronized&);
};
}
}
@@ -58,16 +58,16 @@
// utility class for objects multi-thread synchronization.
class LOG4CXX_EXPORT synchronized_read
{
- public:
- synchronized_read(const RWMutex& mutex);
- ~synchronized_read();
+ public:
+ synchronized_read(const RWMutex& mutex);
+ ~synchronized_read();
- private:
- const RWMutex& mutex;
- // prevent use of copy and assignment
- synchronized_read(const synchronized_read&);
- synchronized_read& operator=(const synchronized_read&);
+ private:
+ const RWMutex& mutex;
+ // prevent use of copy and assignment
+ synchronized_read(const synchronized_read&);
+ synchronized_read& operator=(const synchronized_read&);
};
}
}
@@ -81,16 +81,16 @@
// utility class for objects multi-thread synchronization.
class LOG4CXX_EXPORT synchronized_write
{
- public:
- synchronized_write(const RWMutex& mutex);
- ~synchronized_write();
+ public:
+ synchronized_write(const RWMutex& mutex);
+ ~synchronized_write();
- private:
- const RWMutex& mutex;
- // prevent use of copy and assignment
- synchronized_write(const synchronized_write&);
- synchronized_write& operator=(const synchronized_write&);
+ private:
+ const RWMutex& mutex;
+ // prevent use of copy and assignment
+ synchronized_write(const synchronized_write&);
+ synchronized_write& operator=(const synchronized_write&);
};
}
}
diff --git a/src/main/include/log4cxx/helpers/syslogwriter.h b/src/main/include/log4cxx/helpers/syslogwriter.h
index ada08fb..faeb565 100644
--- a/src/main/include/log4cxx/helpers/syslogwriter.h
+++ b/src/main/include/log4cxx/helpers/syslogwriter.h
@@ -33,16 +33,16 @@
*/
class LOG4CXX_EXPORT SyslogWriter
{
- public:
+ public:
#define SYSLOG_PORT 514
- SyslogWriter(const LogString& syslogHost, int syslogHostPort = SYSLOG_PORT);
- void write(const LogString& string);
+ SyslogWriter(const LogString& syslogHost, int syslogHostPort = SYSLOG_PORT);
+ void write(const LogString& string);
- private:
- LogString syslogHost;
- int syslogHostPort;
- InetAddressPtr address;
- DatagramSocketPtr ds;
+ private:
+ LogString syslogHost;
+ int syslogHostPort;
+ InetAddressPtr address;
+ DatagramSocketPtr ds;
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/system.h b/src/main/include/log4cxx/helpers/system.h
index 2641adf..3f7e2d6 100644
--- a/src/main/include/log4cxx/helpers/system.h
+++ b/src/main/include/log4cxx/helpers/system.h
@@ -32,19 +32,19 @@
*/
class LOG4CXX_EXPORT System
{
- public:
+ public:
- /**
- Gets the system property indicated by the specified key.
+ /**
+ Gets the system property indicated by the specified key.
- @param key the name of the system property.
+ @param key the name of the system property.
- @return the string value of the system property, or the default value if
- there is no property with that key.
+ @return the string value of the system property, or the default value if
+ there is no property with that key.
- @throws IllegalArgumentException if key is empty.
- */
- static LogString getProperty(const LogString& key);
+ @throws IllegalArgumentException if key is empty.
+ */
+ static LogString getProperty(const LogString& key);
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/systemerrwriter.h b/src/main/include/log4cxx/helpers/systemerrwriter.h
index eab756f..6793b4f 100644
--- a/src/main/include/log4cxx/helpers/systemerrwriter.h
+++ b/src/main/include/log4cxx/helpers/systemerrwriter.h
@@ -30,27 +30,27 @@
*/
class LOG4CXX_EXPORT SystemErrWriter : public Writer
{
- public:
- DECLARE_LOG4CXX_OBJECT(SystemErrWriter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SystemErrWriter)
- LOG4CXX_CAST_ENTRY_CHAIN(Writer)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SystemErrWriter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SystemErrWriter)
+ LOG4CXX_CAST_ENTRY_CHAIN(Writer)
+ END_LOG4CXX_CAST_MAP()
- SystemErrWriter();
- virtual ~SystemErrWriter();
+ SystemErrWriter();
+ virtual ~SystemErrWriter();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(const LogString& str, Pool& p);
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(const LogString& str, Pool& p);
- static void write(const LogString& str);
- static void flush();
+ static void write(const LogString& str);
+ static void flush();
- private:
- SystemErrWriter(const SystemErrWriter&);
- SystemErrWriter& operator=(const SystemErrWriter&);
- static bool isWide();
+ private:
+ SystemErrWriter(const SystemErrWriter&);
+ SystemErrWriter& operator=(const SystemErrWriter&);
+ static bool isWide();
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/systemoutwriter.h b/src/main/include/log4cxx/helpers/systemoutwriter.h
index 9d942e4..642e039 100644
--- a/src/main/include/log4cxx/helpers/systemoutwriter.h
+++ b/src/main/include/log4cxx/helpers/systemoutwriter.h
@@ -30,26 +30,26 @@
*/
class LOG4CXX_EXPORT SystemOutWriter : public Writer
{
- public:
- DECLARE_LOG4CXX_OBJECT(SystemOutWriter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SystemOutWriter)
- LOG4CXX_CAST_ENTRY_CHAIN(Writer)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SystemOutWriter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SystemOutWriter)
+ LOG4CXX_CAST_ENTRY_CHAIN(Writer)
+ END_LOG4CXX_CAST_MAP()
- SystemOutWriter();
- ~SystemOutWriter();
+ SystemOutWriter();
+ ~SystemOutWriter();
- virtual void close(Pool& p);
- virtual void flush(Pool& p);
- virtual void write(const LogString& str, Pool& p);
+ virtual void close(Pool& p);
+ virtual void flush(Pool& p);
+ virtual void write(const LogString& str, Pool& p);
- static void write(const LogString& str);
- static void flush();
- private:
- SystemOutWriter(const SystemOutWriter&);
- SystemOutWriter& operator=(const SystemOutWriter&);
- static bool isWide();
+ static void write(const LogString& str);
+ static void flush();
+ private:
+ SystemOutWriter(const SystemOutWriter&);
+ SystemOutWriter& operator=(const SystemOutWriter&);
+ static bool isWide();
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/thread.h b/src/main/include/log4cxx/helpers/thread.h
index 10806a5..c131c03 100644
--- a/src/main/include/log4cxx/helpers/thread.h
+++ b/src/main/include/log4cxx/helpers/thread.h
@@ -22,21 +22,21 @@
#include <log4cxx/helpers/pool.h>
#if !defined(LOG4CXX_THREAD_FUNC)
- #if defined(_WIN32)
- #if defined(__MINGW32__)
- #define LOG4CXX_THREAD_FUNC
- #else
- #define LOG4CXX_THREAD_FUNC __stdcall
- #endif
- #else
- #define LOG4CXX_THREAD_FUNC
- #endif
+ #if defined(_WIN32)
+ #if defined(__MINGW32__)
+ #define LOG4CXX_THREAD_FUNC
+ #else
+ #define LOG4CXX_THREAD_FUNC __stdcall
+ #endif
+ #else
+ #define LOG4CXX_THREAD_FUNC
+ #endif
#endif
extern "C" {
- typedef struct apr_thread_t apr_thread_t;
- typedef struct apr_thread_cond_t apr_thread_cond_t;
- typedef struct apr_thread_mutex_t apr_thread_mutex_t;
+ typedef struct apr_thread_t apr_thread_t;
+ typedef struct apr_thread_cond_t apr_thread_cond_t;
+ typedef struct apr_thread_mutex_t apr_thread_mutex_t;
}
@@ -58,63 +58,63 @@
*/
class LOG4CXX_EXPORT Thread
{
- public:
- /**
- * Create new instance.
- */
- Thread();
- /**
- * Destructor.
- */
- ~Thread();
+ public:
+ /**
+ * Create new instance.
+ */
+ Thread();
+ /**
+ * Destructor.
+ */
+ ~Thread();
- /**
- * Runs the specified method on a newly created thread.
- */
- void run(Runnable start, void* data);
- void join();
+ /**
+ * Runs the specified method on a newly created thread.
+ */
+ void run(Runnable start, void* data);
+ void join();
- inline bool isActive()
- {
- return thread != 0;
- }
+ inline bool isActive()
+ {
+ return thread != 0;
+ }
- /**
- * Causes the currently executing thread to sleep for the
- * specified number of milliseconds.
- * @param millis milliseconds.
- * @throws Interrupted Exception if the thread is interrupted.
- */
- static void sleep(int millis);
- /**
- * Sets interrupted status for current thread to true.
- */
- static void currentThreadInterrupt();
- /**
- * Sets interrupted status to true.
- */
- void interrupt();
- /**
- * Tests if the current thread has been interrupted and
- * sets the interrupted status to false.
- */
- static bool interrupted();
+ /**
+ * Causes the currently executing thread to sleep for the
+ * specified number of milliseconds.
+ * @param millis milliseconds.
+ * @throws Interrupted Exception if the thread is interrupted.
+ */
+ static void sleep(int millis);
+ /**
+ * Sets interrupted status for current thread to true.
+ */
+ static void currentThreadInterrupt();
+ /**
+ * Sets interrupted status to true.
+ */
+ void interrupt();
+ /**
+ * Tests if the current thread has been interrupted and
+ * sets the interrupted status to false.
+ */
+ static bool interrupted();
- bool isAlive();
- bool isCurrentThread() const;
- void ending();
+ bool isAlive();
+ bool isCurrentThread() const;
+ void ending();
- private:
- Pool p;
- apr_thread_t* thread;
- volatile unsigned int alive;
- volatile unsigned int interruptedStatus;
- apr_thread_mutex_t* interruptedMutex;
- apr_thread_cond_t* interruptedCondition;
- Thread(const Thread&);
- Thread& operator=(const Thread&);
- friend void* LOG4CXX_THREAD_FUNC ThreadLaunch::launcher(apr_thread_t* thread, void* data);
+ private:
+ Pool p;
+ apr_thread_t* thread;
+ volatile unsigned int alive;
+ volatile unsigned int interruptedStatus;
+ apr_thread_mutex_t* interruptedMutex;
+ apr_thread_cond_t* interruptedCondition;
+ Thread(const Thread&);
+ Thread& operator=(const Thread&);
+ friend void* LOG4CXX_THREAD_FUNC ThreadLaunch::launcher(apr_thread_t* thread, void* data);
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/threadlocal.h b/src/main/include/log4cxx/helpers/threadlocal.h
index a0f2917..e4dc1d9 100644
--- a/src/main/include/log4cxx/helpers/threadlocal.h
+++ b/src/main/include/log4cxx/helpers/threadlocal.h
@@ -22,16 +22,16 @@
#include <log4cxx/helpers/pool.h>
#if !defined(LOG4CXX_THREAD_FUNC)
- #if defined(_WIN32)
- #define LOG4CXX_THREAD_FUNC __stdcall
- #else
- #define LOG4CXX_THREAD_FUNC
- #endif
+ #if defined(_WIN32)
+ #define LOG4CXX_THREAD_FUNC __stdcall
+ #else
+ #define LOG4CXX_THREAD_FUNC
+ #endif
#endif
extern "C" {
- struct apr_threadkey_t;
+ struct apr_threadkey_t;
}
namespace log4cxx
@@ -45,40 +45,40 @@
*/
class LOG4CXX_EXPORT ThreadLocal
{
- public:
- /**
- * Create new instance.
- */
- ThreadLocal();
- /**
- * Destructor.
- */
- ~ThreadLocal();
- /**
- * Sets the value in the current thread's copy of this thread-local variable.
- * @param priv new value.
- */
- void set(void* priv);
- /**
- * Returns the value in the current thread's copy of this thread-local variable.
- * @return value of thread-local variable for the current thread.
- */
- void* get();
+ public:
+ /**
+ * Create new instance.
+ */
+ ThreadLocal();
+ /**
+ * Destructor.
+ */
+ ~ThreadLocal();
+ /**
+ * Sets the value in the current thread's copy of this thread-local variable.
+ * @param priv new value.
+ */
+ void set(void* priv);
+ /**
+ * Returns the value in the current thread's copy of this thread-local variable.
+ * @return value of thread-local variable for the current thread.
+ */
+ void* get();
- private:
- /**
- * Prevent use of default copy constructor.
- */
- ThreadLocal(const ThreadLocal&);
- /**
- * Prevent use of default assignment operator.
- */
- ThreadLocal& operator=(const ThreadLocal&);
+ private:
+ /**
+ * Prevent use of default copy constructor.
+ */
+ ThreadLocal(const ThreadLocal&);
+ /**
+ * Prevent use of default assignment operator.
+ */
+ ThreadLocal& operator=(const ThreadLocal&);
- static apr_threadkey_t* create(Pool& p);
+ static apr_threadkey_t* create(Pool& p);
- Pool p;
- apr_threadkey_t* key;
+ Pool p;
+ apr_threadkey_t* key;
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/threadspecificdata.h b/src/main/include/log4cxx/helpers/threadspecificdata.h
index a76bb90..66b8307 100644
--- a/src/main/include/log4cxx/helpers/threadspecificdata.h
+++ b/src/main/include/log4cxx/helpers/threadspecificdata.h
@@ -32,33 +32,33 @@
*/
class LOG4CXX_EXPORT ThreadSpecificData
{
- public:
- ThreadSpecificData();
- ~ThreadSpecificData();
+ public:
+ ThreadSpecificData();
+ ~ThreadSpecificData();
- /**
- * Gets current thread specific data.
- * @return thread specific data, may be null.
- */
- static ThreadSpecificData* getCurrentData();
- /**
- * Release this ThreadSpecficData if empty.
- */
- void recycle();
+ /**
+ * Gets current thread specific data.
+ * @return thread specific data, may be null.
+ */
+ static ThreadSpecificData* getCurrentData();
+ /**
+ * Release this ThreadSpecficData if empty.
+ */
+ void recycle();
- static void put(const LogString& key, const LogString& val);
- static void push(const LogString& val);
- static void inherit(const log4cxx::NDC::Stack& stack);
+ static void put(const LogString& key, const LogString& val);
+ static void push(const LogString& val);
+ static void inherit(const log4cxx::NDC::Stack& stack);
- log4cxx::NDC::Stack& getStack();
- log4cxx::MDC::Map& getMap();
+ log4cxx::NDC::Stack& getStack();
+ log4cxx::MDC::Map& getMap();
- private:
- static ThreadSpecificData& getDataNoThreads();
- static ThreadSpecificData* createCurrentData();
- log4cxx::NDC::Stack ndcStack;
- log4cxx::MDC::Map mdcMap;
+ private:
+ static ThreadSpecificData& getDataNoThreads();
+ static ThreadSpecificData* createCurrentData();
+ log4cxx::NDC::Stack ndcStack;
+ log4cxx::MDC::Map mdcMap;
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/timezone.h b/src/main/include/log4cxx/helpers/timezone.h
index 3086669..1a105d0 100644
--- a/src/main/include/log4cxx/helpers/timezone.h
+++ b/src/main/include/log4cxx/helpers/timezone.h
@@ -33,35 +33,35 @@
class LOG4CXX_EXPORT TimeZone : public helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(TimeZone)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TimeZone)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(TimeZone)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TimeZone)
+ END_LOG4CXX_CAST_MAP()
- static const TimeZonePtr& getDefault();
- static const TimeZonePtr& getGMT();
- static const TimeZonePtr getTimeZone(const LogString& ID);
+ static const TimeZonePtr& getDefault();
+ static const TimeZonePtr& getGMT();
+ static const TimeZonePtr getTimeZone(const LogString& ID);
- const LogString getID() const
- {
- return id;
- }
+ const LogString getID() const
+ {
+ return id;
+ }
- /**
- * Expand an APR time into the human readable
- * components for this timezone.
- */
- virtual log4cxx_status_t explode(apr_time_exp_t* result,
- log4cxx_time_t input) const = 0;
+ /**
+ * Expand an APR time into the human readable
+ * components for this timezone.
+ */
+ virtual log4cxx_status_t explode(apr_time_exp_t* result,
+ log4cxx_time_t input) const = 0;
- protected:
- TimeZone(const LogString& ID);
- virtual ~TimeZone();
+ protected:
+ TimeZone(const LogString& ID);
+ virtual ~TimeZone();
- const LogString id;
+ const LogString id;
};
diff --git a/src/main/include/log4cxx/helpers/transcoder.h b/src/main/include/log4cxx/helpers/transcoder.h
index 5f73b32..83be52e 100644
--- a/src/main/include/log4cxx/helpers/transcoder.h
+++ b/src/main/include/log4cxx/helpers/transcoder.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_TRANSCODER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -40,220 +40,220 @@
*/
class LOG4CXX_EXPORT Transcoder
{
- public:
+ public:
- /**
- * Appends this specified string of UTF-8 characters to LogString.
- */
- static void decodeUTF8(const std::string& src, LogString& dst);
- /**
- * Converts the LogString to a UTF-8 string.
- */
- static void encodeUTF8(const LogString& src, std::string& dst);
- /**
- * Converts the LogString to a UTF-8 string.
- */
- static char* encodeUTF8(const LogString& src, log4cxx::helpers::Pool& p);
- /**
- * Append UCS-4 code point to a byte buffer as UTF-8.
- */
- static void encodeUTF8(unsigned int sv, ByteBuffer& dst);
- /**
- * Append UCS-4 code point to a byte buffer as UTF-16LE.
- */
- static void encodeUTF16LE(unsigned int sv, ByteBuffer& dst);
- /**
- * Append UCS-4 code point to a byte buffer as UTF-16BE.
- */
- static void encodeUTF16BE(unsigned int sv, ByteBuffer& dst);
+ /**
+ * Appends this specified string of UTF-8 characters to LogString.
+ */
+ static void decodeUTF8(const std::string& src, LogString& dst);
+ /**
+ * Converts the LogString to a UTF-8 string.
+ */
+ static void encodeUTF8(const LogString& src, std::string& dst);
+ /**
+ * Converts the LogString to a UTF-8 string.
+ */
+ static char* encodeUTF8(const LogString& src, log4cxx::helpers::Pool& p);
+ /**
+ * Append UCS-4 code point to a byte buffer as UTF-8.
+ */
+ static void encodeUTF8(unsigned int sv, ByteBuffer& dst);
+ /**
+ * Append UCS-4 code point to a byte buffer as UTF-16LE.
+ */
+ static void encodeUTF16LE(unsigned int sv, ByteBuffer& dst);
+ /**
+ * Append UCS-4 code point to a byte buffer as UTF-16BE.
+ */
+ static void encodeUTF16BE(unsigned int sv, ByteBuffer& dst);
- /**
- * Decodes next character from a UTF-8 string.
- * @param in string from which the character is extracted.
- * @param iter iterator addressing start of character, will be
- * advanced to next character if successful.
- * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
- */
- static unsigned int decode(const std::string& in,
- std::string::const_iterator& iter);
+ /**
+ * Decodes next character from a UTF-8 string.
+ * @param in string from which the character is extracted.
+ * @param iter iterator addressing start of character, will be
+ * advanced to next character if successful.
+ * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
+ */
+ static unsigned int decode(const std::string& in,
+ std::string::const_iterator& iter);
- /**
- * Appends UCS-4 value to a UTF-8 string.
- * @param ch UCS-4 value.
- * @param dst destination.
- */
- static void encode(unsigned int ch, std::string& dst);
+ /**
+ * Appends UCS-4 value to a UTF-8 string.
+ * @param ch UCS-4 value.
+ * @param dst destination.
+ */
+ static void encode(unsigned int ch, std::string& dst);
- /**
- * Appends string in the current code-page
- * to a LogString.
- */
- static void decode(const std::string& src, LogString& dst);
- /**
- * Appends a LogString to a string in the current
- * code-page. Unrepresentable characters may be
- * replaced with loss characters.
- */
- static void encode(const LogString& src, std::string& dst);
+ /**
+ * Appends string in the current code-page
+ * to a LogString.
+ */
+ static void decode(const std::string& src, LogString& dst);
+ /**
+ * Appends a LogString to a string in the current
+ * code-page. Unrepresentable characters may be
+ * replaced with loss characters.
+ */
+ static void encode(const LogString& src, std::string& dst);
- /**
- * Encodes the specified LogString to the current
- * character set.
- * @param src string to encode.
- * @param p pool from which to allocate return value.
- * @return pool allocated string.
- */
- static char* encode(const LogString& src, log4cxx::helpers::Pool& p);
+ /**
+ * Encodes the specified LogString to the current
+ * character set.
+ * @param src string to encode.
+ * @param p pool from which to allocate return value.
+ * @return pool allocated string.
+ */
+ static char* encode(const LogString& src, log4cxx::helpers::Pool& p);
#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T || defined(WIN32) || defined(_WIN32)
- static void decode(const std::wstring& src, LogString& dst);
- static void encode(const LogString& src, std::wstring& dst);
- static wchar_t* wencode(const LogString& src, log4cxx::helpers::Pool& p);
+ static void decode(const std::wstring& src, LogString& dst);
+ static void encode(const LogString& src, std::wstring& dst);
+ static wchar_t* wencode(const LogString& src, log4cxx::helpers::Pool& p);
- /**
- * Decodes next character from a wstring.
- * @param in string from which the character is extracted.
- * @param iter iterator addressing start of character, will be
- * advanced to next character if successful.
- * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
- */
- static unsigned int decode(const std::wstring& in,
- std::wstring::const_iterator& iter);
+ /**
+ * Decodes next character from a wstring.
+ * @param in string from which the character is extracted.
+ * @param iter iterator addressing start of character, will be
+ * advanced to next character if successful.
+ * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
+ */
+ static unsigned int decode(const std::wstring& in,
+ std::wstring::const_iterator& iter);
- /**
- * Appends UCS-4 value to a UTF-8 string.
- * @param ch UCS-4 value.
- * @param dst destination.
- */
- static void encode(unsigned int ch, std::wstring& dst);
+ /**
+ * Appends UCS-4 value to a UTF-8 string.
+ * @param ch UCS-4 value.
+ * @param dst destination.
+ */
+ static void encode(unsigned int ch, std::wstring& dst);
#endif
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API || LOG4CXX_LOGCHAR_IS_UNICHAR
- static void decode(const std::basic_string<UniChar>& src, LogString& dst);
- static void encode(const LogString& src, std::basic_string<UniChar>& dst);
+ static void decode(const std::basic_string<UniChar>& src, LogString& dst);
+ static void encode(const LogString& src, std::basic_string<UniChar>& dst);
- /**
- * Decodes next character from a UniChar string.
- * @param in string from which the character is extracted.
- * @param iter iterator addressing start of character, will be
- * advanced to next character if successful.
- * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
- */
- static unsigned int decode(const std::basic_string<UniChar>& in,
- std::basic_string<UniChar>::const_iterator& iter);
+ /**
+ * Decodes next character from a UniChar string.
+ * @param in string from which the character is extracted.
+ * @param iter iterator addressing start of character, will be
+ * advanced to next character if successful.
+ * @return scalar value (UCS-4) or 0xFFFF if invalid sequence.
+ */
+ static unsigned int decode(const std::basic_string<UniChar>& in,
+ std::basic_string<UniChar>::const_iterator& iter);
- /**
- * Appends UCS-4 value to a UTF-8 string.
- * @param ch UCS-4 value.
- * @param dst destination.
- */
- static void encode(unsigned int ch, std::basic_string<UniChar>& dst);
+ /**
+ * Appends UCS-4 value to a UTF-8 string.
+ * @param ch UCS-4 value.
+ * @param dst destination.
+ */
+ static void encode(unsigned int ch, std::basic_string<UniChar>& dst);
#endif
#if LOG4CXX_CFSTRING_API
- static void decode(const CFStringRef& src, LogString& dst);
- static CFStringRef encode(const LogString& src);
+ static void decode(const CFStringRef& src, LogString& dst);
+ static CFStringRef encode(const LogString& src);
#endif
- enum { LOSSCHAR = 0x3F };
+ enum { LOSSCHAR = 0x3F };
- /**
- * Returns a logchar value given a character literal in the ASCII charset.
- * Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.
- */
- static logchar decode(char v);
- /**
- * Returns a LogString given a string literal in the ASCII charset.
- * Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.
- */
- static LogString decode(const char* v);
+ /**
+ * Returns a logchar value given a character literal in the ASCII charset.
+ * Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.
+ */
+ static logchar decode(char v);
+ /**
+ * Returns a LogString given a string literal in the ASCII charset.
+ * Used to implement the LOG4CXX_STR macro for EBCDIC and UNICHAR.
+ */
+ static LogString decode(const char* v);
- /**
- * Encodes a charset name in the default encoding
- * without using a CharsetEncoder (which could trigger recursion).
- */
- static std::string encodeCharsetName(const LogString& charsetName);
+ /**
+ * Encodes a charset name in the default encoding
+ * without using a CharsetEncoder (which could trigger recursion).
+ */
+ static std::string encodeCharsetName(const LogString& charsetName);
- private:
+ private:
- private:
- Transcoder();
- Transcoder(const Transcoder&);
- Transcoder& operator=(const Transcoder&);
- enum { BUFSIZE = 256 };
- static size_t encodeUTF8(unsigned int ch, char* dst);
- static size_t encodeUTF16BE(unsigned int ch, char* dst);
- static size_t encodeUTF16LE(unsigned int ch, char* dst);
+ private:
+ Transcoder();
+ Transcoder(const Transcoder&);
+ Transcoder& operator=(const Transcoder&);
+ enum { BUFSIZE = 256 };
+ static size_t encodeUTF8(unsigned int ch, char* dst);
+ static size_t encodeUTF16BE(unsigned int ch, char* dst);
+ static size_t encodeUTF16LE(unsigned int ch, char* dst);
};
}
}
#define LOG4CXX_ENCODE_CHAR(var, src) \
- std::string var; \
- log4cxx::helpers::Transcoder::encode(src, var)
+ std::string var; \
+ log4cxx::helpers::Transcoder::encode(src, var)
#define LOG4CXX_DECODE_CHAR(var, src) \
- log4cxx::LogString var; \
- log4cxx::helpers::Transcoder::decode(src, var)
+ log4cxx::LogString var; \
+ log4cxx::helpers::Transcoder::decode(src, var)
#define LOG4CXX_DECODE_CFSTRING(var, src) \
- log4cxx::LogString var; \
- log4cxx::helpers::Transcoder::decode(src, var)
+ log4cxx::LogString var; \
+ log4cxx::helpers::Transcoder::decode(src, var)
#define LOG4CXX_ENCODE_CFSTRING(var, src) \
- CFStringRef var = log4cxx::helpers::Transcoder::encode(src)
+ CFStringRef var = log4cxx::helpers::Transcoder::encode(src)
#if LOG4CXX_LOGCHAR_IS_WCHAR
#define LOG4CXX_ENCODE_WCHAR(var, src) \
- const std::wstring& var = src
+ const std::wstring& var = src
#define LOG4CXX_DECODE_WCHAR(var, src) \
- const log4cxx::LogString& var = src
+ const log4cxx::LogString& var = src
#else
#define LOG4CXX_ENCODE_WCHAR(var, src) \
- std::wstring var; \
- log4cxx::helpers::Transcoder::encode(src, var)
+ std::wstring var; \
+ log4cxx::helpers::Transcoder::encode(src, var)
#define LOG4CXX_DECODE_WCHAR(var, src) \
- log4cxx::LogString var; \
- log4cxx::helpers::Transcoder::decode(src, var)
+ log4cxx::LogString var; \
+ log4cxx::helpers::Transcoder::decode(src, var)
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR
#define LOG4CXX_ENCODE_UNICHAR(var, src) \
- const std::basic_string<UniChar>& var = src
+ const std::basic_string<UniChar>& var = src
#define LOG4CXX_DECODE_UNICHAR(var, src) \
- const log4cxx::LogString& var = src
+ const log4cxx::LogString& var = src
#else
#define LOG4CXX_ENCODE_UNICHAR(var, src) \
- std::basic_string<UniChar> var; \
- log4cxx::helpers::Transcoder::encode(src, var)
+ std::basic_string<UniChar> var; \
+ log4cxx::helpers::Transcoder::encode(src, var)
#define LOG4CXX_DECODE_UNICHAR(var, src) \
- log4cxx::LogString var; \
- log4cxx::helpers::Transcoder::decode(src, var)
+ log4cxx::LogString var; \
+ log4cxx::helpers::Transcoder::decode(src, var)
#endif
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif //_LOG4CXX_HELPERS_TRANSCODER_H
diff --git a/src/main/include/log4cxx/helpers/transform.h b/src/main/include/log4cxx/helpers/transform.h
index f866b35..87a2ae6 100644
--- a/src/main/include/log4cxx/helpers/transform.h
+++ b/src/main/include/log4cxx/helpers/transform.h
@@ -29,32 +29,32 @@
*/
class LOG4CXX_EXPORT Transform
{
- public:
- /**
- * This method takes a string which may contain HTML tags (ie,
- * <b>, <table>, etc) and replaces any '<' and '>'
- * characters with respective predefined entity references.
- *
- * @param buf output stream where to write the modified string.
- * @param input The text to be converted.
- * @return The input string with the characters '<' and '>' replaced with
- * &lt; and &gt; respectively.
- * */
- static void appendEscapingTags(
- LogString& buf, const LogString& input);
+ public:
+ /**
+ * This method takes a string which may contain HTML tags (ie,
+ * <b>, <table>, etc) and replaces any '<' and '>'
+ * characters with respective predefined entity references.
+ *
+ * @param buf output stream where to write the modified string.
+ * @param input The text to be converted.
+ * @return The input string with the characters '<' and '>' replaced with
+ * &lt; and &gt; respectively.
+ * */
+ static void appendEscapingTags(
+ LogString& buf, const LogString& input);
- /**
- * Ensures that embeded CDEnd strings (]]>) are handled properly
- * within message, NDC and throwable tag text.
- *
- * @param buf output stream holding the XML data to this point. The
- * initial CDStart (<![CDATA[) and final CDEnd (]]>) of the CDATA
- * section are the responsibility of the calling method.
- * @param input The String that is inserted into an existing CDATA
- * Section within buf.
- */
- static void appendEscapingCDATA(
- LogString& buf, const LogString& input);
+ /**
+ * Ensures that embeded CDEnd strings (]]>) are handled properly
+ * within message, NDC and throwable tag text.
+ *
+ * @param buf output stream holding the XML data to this point. The
+ * initial CDStart (<![CDATA[) and final CDEnd (]]>) of the CDATA
+ * section are the responsibility of the calling method.
+ * @param input The String that is inserted into an existing CDATA
+ * Section within buf.
+ */
+ static void appendEscapingCDATA(
+ LogString& buf, const LogString& input);
}; // class Transform
} // namespace helpers
} //namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/writer.h b/src/main/include/log4cxx/helpers/writer.h
index d396b36..b5bc98f 100644
--- a/src/main/include/log4cxx/helpers/writer.h
+++ b/src/main/include/log4cxx/helpers/writer.h
@@ -32,27 +32,27 @@
*/
class LOG4CXX_EXPORT Writer : public ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Writer)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Writer)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Writer)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Writer)
+ END_LOG4CXX_CAST_MAP()
- protected:
- Writer();
- virtual ~Writer();
+ protected:
+ Writer();
+ virtual ~Writer();
- public:
- virtual void close(Pool& p) = 0;
- virtual void flush(Pool& p) = 0;
- virtual void write(const LogString& str, Pool& p) = 0;
+ public:
+ virtual void close(Pool& p) = 0;
+ virtual void flush(Pool& p) = 0;
+ virtual void write(const LogString& str, Pool& p) = 0;
#ifdef LOG4CXX_MULTI_PROCESS
- virtual OutputStreamPtr getOutPutStreamPtr();
+ virtual OutputStreamPtr getOutPutStreamPtr();
#endif
- private:
- Writer(const Writer&);
- Writer& operator=(const Writer&);
+ private:
+ Writer(const Writer&);
+ Writer& operator=(const Writer&);
};
LOG4CXX_PTR_DEF(Writer);
diff --git a/src/main/include/log4cxx/helpers/xml.h b/src/main/include/log4cxx/helpers/xml.h
index 965e460..c132578 100644
--- a/src/main/include/log4cxx/helpers/xml.h
+++ b/src/main/include/log4cxx/helpers/xml.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HELPERS_XML_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -45,8 +45,8 @@
class LOG4CXX_EXPORT DOMException : public RuntimeException
{
- public:
- DOMException() : RuntimeException(LOG4CXX_STR("DOM exception")) {}
+ public:
+ DOMException() : RuntimeException(LOG4CXX_STR("DOM exception")) {}
};
@@ -56,18 +56,18 @@
*/
class LOG4CXX_EXPORT XMLDOMNode : virtual public Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNode)
- enum XMLDOMNodeType
- {
- NOT_IMPLEMENTED_NODE = 0,
- ELEMENT_NODE = 1,
- DOCUMENT_NODE = 9
- };
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNode)
+ enum XMLDOMNodeType
+ {
+ NOT_IMPLEMENTED_NODE = 0,
+ ELEMENT_NODE = 1,
+ DOCUMENT_NODE = 9
+ };
- virtual XMLDOMNodeListPtr getChildNodes() = 0;
- virtual XMLDOMNodeType getNodeType() = 0;
- virtual XMLDOMDocumentPtr getOwnerDocument() = 0;
+ virtual XMLDOMNodeListPtr getChildNodes() = 0;
+ virtual XMLDOMNodeType getNodeType() = 0;
+ virtual XMLDOMDocumentPtr getOwnerDocument() = 0;
};
LOG4CXX_PTR_DEF(XMLDOMNode);
@@ -77,10 +77,10 @@
*/
class LOG4CXX_EXPORT XMLDOMElement : virtual public XMLDOMNode
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMElement)
- virtual LogString getTagName() = 0;
- virtual LogString getAttribute(const LogString& name) = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMElement)
+ virtual LogString getTagName() = 0;
+ virtual LogString getAttribute(const LogString& name) = 0;
};
LOG4CXX_PTR_DEF(XMLDOMElement);
@@ -92,12 +92,12 @@
*/
class LOG4CXX_EXPORT XMLDOMDocument : virtual public XMLDOMNode
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMDocument)
- virtual void load(const File& fileName) = 0;
- virtual XMLDOMElementPtr getDocumentElement() = 0;
- virtual XMLDOMElementPtr getElementById(const LogString& tagName,
- const LogString& elementId) = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMDocument)
+ virtual void load(const File& fileName) = 0;
+ virtual XMLDOMElementPtr getDocumentElement() = 0;
+ virtual XMLDOMElementPtr getElementById(const LogString& tagName,
+ const LogString& elementId) = 0;
};
LOG4CXX_PTR_DEF(XMLDOMDocument);
@@ -113,10 +113,10 @@
*/
class LOG4CXX_EXPORT XMLDOMNodeList : virtual public Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNodeList)
- virtual int getLength() = 0;
- virtual XMLDOMNodePtr item(int index) = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNodeList)
+ virtual int getLength() = 0;
+ virtual XMLDOMNodePtr item(int index) = 0;
};
LOG4CXX_PTR_DEF(XMLDOMNodeList);
} // namespace helpers
@@ -124,7 +124,7 @@
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_HELPERS_XML_H
diff --git a/src/main/include/log4cxx/hierarchy.h b/src/main/include/log4cxx/hierarchy.h
index 89a0be1..a8448c3 100644
--- a/src/main/include/log4cxx/hierarchy.h
+++ b/src/main/include/log4cxx/hierarchy.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HIERARCHY_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/spi/loggerrepository.h>
@@ -53,231 +53,231 @@
themselves to the previously created provision node.
*/
class LOG4CXX_EXPORT Hierarchy :
- public virtual spi::LoggerRepository,
- public virtual helpers::ObjectImpl
+ public virtual spi::LoggerRepository,
+ public virtual helpers::ObjectImpl
{
- private:
- log4cxx::helpers::Pool pool;
- log4cxx::helpers::Mutex mutex;
- bool configured;
+ private:
+ log4cxx::helpers::Pool pool;
+ log4cxx::helpers::Mutex mutex;
+ bool configured;
- spi::LoggerFactoryPtr defaultFactory;
- spi::HierarchyEventListenerList listeners;
+ spi::LoggerFactoryPtr defaultFactory;
+ spi::HierarchyEventListenerList listeners;
- typedef std::map<LogString, LoggerPtr> LoggerMap;
- LoggerMap* loggers;
+ typedef std::map<LogString, LoggerPtr> LoggerMap;
+ LoggerMap* loggers;
- typedef std::map<LogString, ProvisionNode> ProvisionNodeMap;
- ProvisionNodeMap* provisionNodes;
+ typedef std::map<LogString, ProvisionNode> ProvisionNodeMap;
+ ProvisionNodeMap* provisionNodes;
- LoggerPtr root;
+ LoggerPtr root;
- int thresholdInt;
- LevelPtr threshold;
+ int thresholdInt;
+ LevelPtr threshold;
- bool emittedNoAppenderWarning;
- bool emittedNoResourceBundleWarning;
+ bool emittedNoAppenderWarning;
+ bool emittedNoResourceBundleWarning;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Hierarchy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(spi::LoggerRepository)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Hierarchy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(spi::LoggerRepository)
+ END_LOG4CXX_CAST_MAP()
- /**
- Create a new logger hierarchy.
- */
- Hierarchy();
+ /**
+ Create a new logger hierarchy.
+ */
+ Hierarchy();
- ~Hierarchy();
+ ~Hierarchy();
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- void addHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener);
+ void addHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener);
- /**
- This call will clear all logger definitions from the internal
- hashtable. Invoking this method will irrevocably mess up the
- logger hierarchy.
+ /**
+ This call will clear all logger definitions from the internal
+ hashtable. Invoking this method will irrevocably mess up the
+ logger hierarchy.
- <p>You should <em>really</em> know what you are doing before
- invoking this method.
- */
- void clear();
+ <p>You should <em>really</em> know what you are doing before
+ invoking this method.
+ */
+ void clear();
- void emitNoAppenderWarning(const LoggerPtr& logger);
+ void emitNoAppenderWarning(const LoggerPtr& logger);
- /**
- Check if the named logger exists in the hierarchy. If so return
- its reference, otherwise returns <code>null</code>.
+ /**
+ Check if the named logger exists in the hierarchy. If so return
+ its reference, otherwise returns <code>null</code>.
- @param name The name of the logger to search for.
+ @param name The name of the logger to search for.
- */
- LoggerPtr exists(const LogString& name);
+ */
+ LoggerPtr exists(const LogString& name);
- /**
- The string form of {@link #setThreshold(const LevelPtr&) setThreshold}.
- */
- void setThreshold(const LogString& levelStr);
+ /**
+ The string form of {@link #setThreshold(const LevelPtr&) setThreshold}.
+ */
+ void setThreshold(const LogString& levelStr);
- /**
- Enable logging for logging requests with level <code>l</code> or
- higher. By default all levels are enabled.
+ /**
+ Enable logging for logging requests with level <code>l</code> or
+ higher. By default all levels are enabled.
- @param l The minimum level for which logging requests are sent to
- their appenders. */
- void setThreshold(const LevelPtr& l);
+ @param l The minimum level for which logging requests are sent to
+ their appenders. */
+ void setThreshold(const LevelPtr& l);
- void fireAddAppenderEvent(const LoggerPtr& logger, const AppenderPtr& appender);
+ void fireAddAppenderEvent(const LoggerPtr& logger, const AppenderPtr& appender);
- void fireRemoveAppenderEvent(const LoggerPtr& logger,
- const AppenderPtr& appender);
+ void fireRemoveAppenderEvent(const LoggerPtr& logger,
+ const AppenderPtr& appender);
- /**
- Returns a Level representation of the <code>enable</code>
- state.
- */
- const LevelPtr& getThreshold() const;
+ /**
+ Returns a Level representation of the <code>enable</code>
+ state.
+ */
+ const LevelPtr& getThreshold() const;
- /**
- Return a new logger instance named as the first parameter using
- the default factory.
+ /**
+ Return a new logger instance named as the first parameter using
+ the default factory.
- <p>If a logger of that name already exists, then it will be
- returned. Otherwise, a new logger will be instantiated and
- then linked with its existing ancestors as well as children.
+ <p>If a logger of that name already exists, then it will be
+ returned. Otherwise, a new logger will be instantiated and
+ then linked with its existing ancestors as well as children.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- */
- LoggerPtr getLogger(const LogString& name);
+ */
+ LoggerPtr getLogger(const LogString& name);
- /**
- Return a new logger instance named as the first parameter using
- <code>factory</code>.
+ /**
+ Return a new logger instance named as the first parameter using
+ <code>factory</code>.
- <p>If a logger of that name already exists, then it will be
- returned. Otherwise, a new logger will be instantiated by the
- <code>factory</code> parameter and linked with its existing
- ancestors as well as children.
+ <p>If a logger of that name already exists, then it will be
+ returned. Otherwise, a new logger will be instantiated by the
+ <code>factory</code> parameter and linked with its existing
+ ancestors as well as children.
- @param name The name of the logger to retrieve.
- @param factory The factory that will make the new logger instance.
+ @param name The name of the logger to retrieve.
+ @param factory The factory that will make the new logger instance.
- */
- LoggerPtr getLogger(const LogString& name,
- const spi::LoggerFactoryPtr& factory);
+ */
+ LoggerPtr getLogger(const LogString& name,
+ const spi::LoggerFactoryPtr& factory);
- /**
- Returns all the currently defined loggers in this hierarchy as
- a LoggerList.
+ /**
+ Returns all the currently defined loggers in this hierarchy as
+ a LoggerList.
- <p>The root logger is <em>not</em> included in the returned
- LoggerList. */
- LoggerList getCurrentLoggers() const;
+ <p>The root logger is <em>not</em> included in the returned
+ LoggerList. */
+ LoggerList getCurrentLoggers() const;
- /**
- Get the root of this hierarchy.
- */
- LoggerPtr getRootLogger() const;
+ /**
+ Get the root of this hierarchy.
+ */
+ LoggerPtr getRootLogger() const;
- /**
- This method will return <code>true</code> if this repository is
- disabled for <code>level</code> object passed as parameter and
- <code>false</code> otherwise. See also the
- {@link #setThreshold(const LevelPtr&) setThreshold} method. */
- bool isDisabled(int level) const;
+ /**
+ This method will return <code>true</code> if this repository is
+ disabled for <code>level</code> object passed as parameter and
+ <code>false</code> otherwise. See also the
+ {@link #setThreshold(const LevelPtr&) setThreshold} method. */
+ bool isDisabled(int level) const;
- /**
- Reset all values contained in this hierarchy instance to their
- default. This removes all appenders from all categories, sets
- the level of all non-root categories to <code>null</code>,
- sets their additivity flag to <code>true</code> and sets the level
- of the root logger to DEBUG. Moreover,
- message disabling is set its default "off" value.
+ /**
+ Reset all values contained in this hierarchy instance to their
+ default. This removes all appenders from all categories, sets
+ the level of all non-root categories to <code>null</code>,
+ sets their additivity flag to <code>true</code> and sets the level
+ of the root logger to DEBUG. Moreover,
+ message disabling is set its default "off" value.
- <p>Existing categories are not removed. They are just reset.
+ <p>Existing categories are not removed. They are just reset.
- <p>This method should be used sparingly and with care as it will
- block all logging until it is completed.</p>
- */
- void resetConfiguration();
+ <p>This method should be used sparingly and with care as it will
+ block all logging until it is completed.</p>
+ */
+ void resetConfiguration();
- /**
- Used by subclasses to add a renderer to the hierarchy passed as parameter.
- */
- /**
- Shutting down a hierarchy will <em>safely</em> close and remove
- all appenders in all categories including the root logger.
+ /**
+ Used by subclasses to add a renderer to the hierarchy passed as parameter.
+ */
+ /**
+ Shutting down a hierarchy will <em>safely</em> close and remove
+ all appenders in all categories including the root logger.
- <p>Some appenders such as {@link net::SocketAppender SocketAppender}
- and AsyncAppender need to be closed before the
- application exists. Otherwise, pending logging events might be
- lost.
+ <p>Some appenders such as {@link net::SocketAppender SocketAppender}
+ and AsyncAppender need to be closed before the
+ application exists. Otherwise, pending logging events might be
+ lost.
- <p>The <code>shutdown</code> method is careful to close nested
- appenders before closing regular appenders. This is allows
- configurations where a regular appender is attached to a logger
- and again to a nested appender.
- */
- void shutdown();
+ <p>The <code>shutdown</code> method is careful to close nested
+ appenders before closing regular appenders. This is allows
+ configurations where a regular appender is attached to a logger
+ and again to a nested appender.
+ */
+ void shutdown();
- virtual bool isConfigured();
- virtual void setConfigured(bool configured);
+ virtual bool isConfigured();
+ virtual void setConfigured(bool configured);
- private:
+ private:
- /**
- This method loops through all the *potential* parents of
- 'cat'. There 3 possible cases:
+ /**
+ This method loops through all the *potential* parents of
+ 'cat'. There 3 possible cases:
- 1) No entry for the potential parent of 'cat' exists
+ 1) No entry for the potential parent of 'cat' exists
- We create a ProvisionNode for this potential parent and insert
- 'cat' in that provision node.
+ We create a ProvisionNode for this potential parent and insert
+ 'cat' in that provision node.
- 2) There entry is of type Logger for the potential parent.
+ 2) There entry is of type Logger for the potential parent.
- The entry is 'cat's nearest existing parent. We update cat's
- parent field with this entry. We also break from the loop
- because updating our parent's parent is our parent's
- responsibility.
+ The entry is 'cat's nearest existing parent. We update cat's
+ parent field with this entry. We also break from the loop
+ because updating our parent's parent is our parent's
+ responsibility.
- 3) There entry is of type ProvisionNode for this potential parent.
+ 3) There entry is of type ProvisionNode for this potential parent.
- We add 'cat' to the list of children for this potential parent.
- */
- void updateParents(LoggerPtr logger);
+ We add 'cat' to the list of children for this potential parent.
+ */
+ void updateParents(LoggerPtr logger);
- /**
- We update the links for all the children that placed themselves
- in the provision node 'pn'. The second argument 'cat' is a
- reference for the newly created Logger, parent of all the
- children in 'pn'
+ /**
+ We update the links for all the children that placed themselves
+ in the provision node 'pn'. The second argument 'cat' is a
+ reference for the newly created Logger, parent of all the
+ children in 'pn'
- We loop on all the children 'c' in 'pn':
+ We loop on all the children 'c' in 'pn':
- If the child 'c' has been already linked to a child of
- 'cat' then there is no need to update 'c'.
+ If the child 'c' has been already linked to a child of
+ 'cat' then there is no need to update 'c'.
- Otherwise, we set cat's parent field to c's parent and set
- c's parent field to cat.
- */
- Hierarchy(const Hierarchy&);
- Hierarchy& operator=(const Hierarchy&);
+ Otherwise, we set cat's parent field to c's parent and set
+ c's parent field to cat.
+ */
+ Hierarchy(const Hierarchy&);
+ Hierarchy& operator=(const Hierarchy&);
- void updateChildren(ProvisionNode& pn, LoggerPtr logger);
+ void updateChildren(ProvisionNode& pn, LoggerPtr logger);
};
} //namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif //_LOG4CXX_HIERARCHY_H
diff --git a/src/main/include/log4cxx/htmllayout.h b/src/main/include/log4cxx/htmllayout.h
index 27d62a7..cc0e225 100644
--- a/src/main/include/log4cxx/htmllayout.h
+++ b/src/main/include/log4cxx/htmllayout.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_HTML_LAYOUT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -36,110 +36,110 @@
*/
class LOG4CXX_EXPORT HTMLLayout : public Layout
{
- private:
- // Print no location info by default
- bool locationInfo; //= false
+ private:
+ // Print no location info by default
+ bool locationInfo; //= false
- LogString title;
+ LogString title;
- helpers::ISO8601DateFormat dateFormat;
+ helpers::ISO8601DateFormat dateFormat;
- public:
- DECLARE_LOG4CXX_OBJECT(HTMLLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(HTMLLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(HTMLLayout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(HTMLLayout)
+ LOG4CXX_CAST_ENTRY_CHAIN(Layout)
+ END_LOG4CXX_CAST_MAP()
- HTMLLayout();
+ HTMLLayout();
- /**
- The <b>LocationInfo</b> option takes a boolean value. By
- default, it is set to false which means there will be no location
- information output by this layout. If the the option is set to
- true, then the file name and line number of the statement
- at the origin of the log statement will be output.
+ /**
+ The <b>LocationInfo</b> option takes a boolean value. By
+ default, it is set to false which means there will be no location
+ information output by this layout. If the the option is set to
+ true, then the file name and line number of the statement
+ at the origin of the log statement will be output.
- <p>If you are embedding this layout within an
- {@link net::SMTPAppender SMTPAppender} then make sure
- to set the <b>LocationInfo</b> option of that appender as well.
- */
- inline void setLocationInfo(bool locationInfoFlag)
- {
- this->locationInfo = locationInfoFlag;
- }
+ <p>If you are embedding this layout within an
+ {@link net::SMTPAppender SMTPAppender} then make sure
+ to set the <b>LocationInfo</b> option of that appender as well.
+ */
+ inline void setLocationInfo(bool locationInfoFlag)
+ {
+ this->locationInfo = locationInfoFlag;
+ }
- /**
- Returns the current value of the <b>LocationInfo</b> option.
- */
- inline bool getLocationInfo() const
- {
- return locationInfo;
- }
+ /**
+ Returns the current value of the <b>LocationInfo</b> option.
+ */
+ inline bool getLocationInfo() const
+ {
+ return locationInfo;
+ }
- /**
- The <b>Title</b> option takes a String value. This option sets the
- document title of the generated HTML document.
- <p>Defaults to 'Log4cxx Log Messages'.
- */
- inline void setTitle(const LogString& title1)
- {
- this->title.assign(title1);
- }
+ /**
+ The <b>Title</b> option takes a String value. This option sets the
+ document title of the generated HTML document.
+ <p>Defaults to 'Log4cxx Log Messages'.
+ */
+ inline void setTitle(const LogString& title1)
+ {
+ this->title.assign(title1);
+ }
- /**
- Returns the current value of the <b>Title</b> option.
- */
- inline const LogString& getTitle() const
- {
- return title;
- }
+ /**
+ Returns the current value of the <b>Title</b> option.
+ */
+ inline const LogString& getTitle() const
+ {
+ return title;
+ }
- /**
- Returns the content type output by this layout, i.e "text/html".
- */
- virtual LogString getContentType() const
- {
- return LOG4CXX_STR("text/html");
- }
+ /**
+ Returns the content type output by this layout, i.e "text/html".
+ */
+ virtual LogString getContentType() const
+ {
+ return LOG4CXX_STR("text/html");
+ }
- /**
- No options to activate.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}
+ /**
+ No options to activate.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}
- /**
- Set options
- */
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option, const LogString& value);
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;
+ virtual void format(LogString& output,
+ const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;
- /**
- Append appropriate HTML headers.
- */
- virtual void appendHeader(LogString& output, log4cxx::helpers::Pool& pool);
+ /**
+ Append appropriate HTML headers.
+ */
+ virtual void appendHeader(LogString& output, log4cxx::helpers::Pool& pool);
- /**
- Append the appropriate HTML footers.
- */
- virtual void appendFooter(LogString& output, log4cxx::helpers::Pool& pool);
+ /**
+ Append the appropriate HTML footers.
+ */
+ virtual void appendFooter(LogString& output, log4cxx::helpers::Pool& pool);
- /**
- The HTML layout handles the throwable contained in logging
- events. Hence, this method return <code>false</code>. */
- virtual bool ignoresThrowable() const
- {
- return false;
- }
+ /**
+ The HTML layout handles the throwable contained in logging
+ events. Hence, this method return <code>false</code>. */
+ virtual bool ignoresThrowable() const
+ {
+ return false;
+ }
}; // class HtmlLayout
LOG4CXX_PTR_DEF(HTMLLayout);
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/layout.h b/src/main/include/log4cxx/layout.h
index 0942b77..0bf623c 100644
--- a/src/main/include/log4cxx/layout.h
+++ b/src/main/include/log4cxx/layout.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_LAYOUT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -36,62 +36,62 @@
Extend this abstract class to create your own log layout format.
*/
class LOG4CXX_EXPORT Layout :
- public virtual spi::OptionHandler,
- public virtual helpers::ObjectImpl
+ public virtual spi::OptionHandler,
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Layout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Layout)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Layout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Layout)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ END_LOG4CXX_CAST_MAP()
- virtual ~Layout();
- void addRef() const;
- void releaseRef() const;
+ virtual ~Layout();
+ void addRef() const;
+ void releaseRef() const;
- /**
- Implement this method to create your own layout format.
- */
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const = 0;
+ /**
+ Implement this method to create your own layout format.
+ */
+ virtual void format(LogString& output,
+ const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const = 0;
- /**
- Returns the content type output by this layout. The base class
- returns "text/plain".
- */
- virtual LogString getContentType() const;
+ /**
+ Returns the content type output by this layout. The base class
+ returns "text/plain".
+ */
+ virtual LogString getContentType() const;
- /**
- Append the header for the layout format. The base class does
- nothing.
- */
- virtual void appendHeader(LogString& output, log4cxx::helpers::Pool& p);
+ /**
+ Append the header for the layout format. The base class does
+ nothing.
+ */
+ virtual void appendHeader(LogString& output, log4cxx::helpers::Pool& p);
- /**
- Append the footer for the layout format. The base class does
- nothing.
- */
- virtual void appendFooter(LogString& output, log4cxx::helpers::Pool& p);
+ /**
+ Append the footer for the layout format. The base class does
+ nothing.
+ */
+ virtual void appendFooter(LogString& output, log4cxx::helpers::Pool& p);
- /**
- If the layout handles the throwable object contained within
- {@link spi::LoggingEvent LoggingEvent}, then the layout should return
- <code>false</code>. Otherwise, if the layout ignores throwable
- object, then the layout should return <code>true</code>.
+ /**
+ If the layout handles the throwable object contained within
+ {@link spi::LoggingEvent LoggingEvent}, then the layout should return
+ <code>false</code>. Otherwise, if the layout ignores throwable
+ object, then the layout should return <code>true</code>.
- <p>The SimpleLayout, TTCCLayout,
- PatternLayout all return <code>true</code>. The {@link
- xml::XMLLayout XMLLayout} returns <code>false</code>.
- */
- virtual bool ignoresThrowable() const = 0;
+ <p>The SimpleLayout, TTCCLayout,
+ PatternLayout all return <code>true</code>. The {@link
+ xml::XMLLayout XMLLayout} returns <code>false</code>.
+ */
+ virtual bool ignoresThrowable() const = 0;
};
LOG4CXX_PTR_DEF(Layout);
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_LAYOUT_H
diff --git a/src/main/include/log4cxx/level.h b/src/main/include/log4cxx/level.h
index e59b904..034fb89 100644
--- a/src/main/include/log4cxx/level.h
+++ b/src/main/include/log4cxx/level.h
@@ -48,238 +48,238 @@
*/
class LOG4CXX_EXPORT Level : public helpers::ObjectImpl
{
- public:
- class LOG4CXX_EXPORT LevelClass : public helpers::Class
- {
- public:
- LevelClass() : helpers::Class() {}
+ public:
+ class LOG4CXX_EXPORT LevelClass : public helpers::Class
+ {
+ public:
+ LevelClass() : helpers::Class() {}
- virtual LogString getName() const
- {
- return LOG4CXX_STR("Level");
- }
+ virtual LogString getName() const
+ {
+ return LOG4CXX_STR("Level");
+ }
- virtual LevelPtr toLevel(const LogString& sArg) const
- {
- return Level::toLevelLS(sArg);
- }
+ virtual LevelPtr toLevel(const LogString& sArg) const
+ {
+ return Level::toLevelLS(sArg);
+ }
- virtual LevelPtr toLevel(int val) const
- {
- return Level::toLevel(val);
- }
- };
+ virtual LevelPtr toLevel(int val) const
+ {
+ return Level::toLevel(val);
+ }
+ };
- DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(Level, LevelClass)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Level)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(Level, LevelClass)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Level)
+ END_LOG4CXX_CAST_MAP()
- /**
- Instantiate a Level object.
- */
- Level(int level,
- const LogString& name,
- int syslogEquivalent);
+ /**
+ Instantiate a Level object.
+ */
+ Level(int level,
+ const LogString& name,
+ int syslogEquivalent);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- * @param sArg level name.
- */
- static LevelPtr toLevel(const std::string& sArg);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- * @param sArg level name.
- * @param defaultLevel level to return if no match.
- * @return
- */
- static LevelPtr toLevel(const std::string& sArg,
- const LevelPtr& defaultLevel);
- /**
- * Get the name of the level in the current encoding.
- * @param name buffer to which name is appended.
- */
- void toString(std::string& name) const;
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ * @param sArg level name.
+ */
+ static LevelPtr toLevel(const std::string& sArg);
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ <code>defaultLevel</code>.
+ * @param sArg level name.
+ * @param defaultLevel level to return if no match.
+ * @return
+ */
+ static LevelPtr toLevel(const std::string& sArg,
+ const LevelPtr& defaultLevel);
+ /**
+ * Get the name of the level in the current encoding.
+ * @param name buffer to which name is appended.
+ */
+ void toString(std::string& name) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- * @param sArg level name.
- */
- static LevelPtr toLevel(const std::wstring& sArg);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- * @param sArg level name.
- * @param defaultLevel level to return if no match.
- * @return
- */
- static LevelPtr toLevel(const std::wstring& sArg,
- const LevelPtr& defaultLevel);
- /**
- * Get the name of the level.
- * @param name buffer to which name is appended.
- */
- void toString(std::wstring& name) const;
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ * @param sArg level name.
+ */
+ static LevelPtr toLevel(const std::wstring& sArg);
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ <code>defaultLevel</code>.
+ * @param sArg level name.
+ * @param defaultLevel level to return if no match.
+ * @return
+ */
+ static LevelPtr toLevel(const std::wstring& sArg,
+ const LevelPtr& defaultLevel);
+ /**
+ * Get the name of the level.
+ * @param name buffer to which name is appended.
+ */
+ void toString(std::wstring& name) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- * @param sArg level name.
- */
- static LevelPtr toLevel(const std::basic_string<UniChar>& sArg);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- * @param sArg level name.
- * @param defaultLevel level to return if no match.
- * @return
- */
- static LevelPtr toLevel(const std::basic_string<UniChar>& sArg,
- const LevelPtr& defaultLevel);
- /**
- * Get the name of the level.
- * @param name buffer to which name is appended.
- */
- void toString(std::basic_string<UniChar>& name) const;
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ * @param sArg level name.
+ */
+ static LevelPtr toLevel(const std::basic_string<UniChar>& sArg);
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ <code>defaultLevel</code>.
+ * @param sArg level name.
+ * @param defaultLevel level to return if no match.
+ * @return
+ */
+ static LevelPtr toLevel(const std::basic_string<UniChar>& sArg,
+ const LevelPtr& defaultLevel);
+ /**
+ * Get the name of the level.
+ * @param name buffer to which name is appended.
+ */
+ void toString(std::basic_string<UniChar>& name) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- * @param sArg level name.
- */
- static LevelPtr toLevel(const CFStringRef& sArg);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- * @param sArg level name.
- * @param defaultLevel level to return if no match.
- * @return
- */
- static LevelPtr toLevel(const CFStringRef& sArg,
- const LevelPtr& defaultLevel);
- /**
- * Get the name of the level.
- * @param name buffer to which name is appended.
- */
- void toString(CFStringRef& name) const;
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ * @param sArg level name.
+ */
+ static LevelPtr toLevel(const CFStringRef& sArg);
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ <code>defaultLevel</code>.
+ * @param sArg level name.
+ * @param defaultLevel level to return if no match.
+ * @return
+ */
+ static LevelPtr toLevel(const CFStringRef& sArg,
+ const LevelPtr& defaultLevel);
+ /**
+ * Get the name of the level.
+ * @param name buffer to which name is appended.
+ */
+ void toString(CFStringRef& name) const;
#endif
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- * @param sArg level name.
- */
- static LevelPtr toLevelLS(const LogString& sArg);
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- * @param sArg level name.
- * @param defaultLevel level to return if no match.
- * @return
- */
- static LevelPtr toLevelLS(const LogString& sArg,
- const LevelPtr& defaultLevel);
- /**
- Returns the string representation of this level.
- * @return level name.
- */
- LogString toString() const;
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ * @param sArg level name.
+ */
+ static LevelPtr toLevelLS(const LogString& sArg);
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ <code>defaultLevel</code>.
+ * @param sArg level name.
+ * @param defaultLevel level to return if no match.
+ * @return
+ */
+ static LevelPtr toLevelLS(const LogString& sArg,
+ const LevelPtr& defaultLevel);
+ /**
+ Returns the string representation of this level.
+ * @return level name.
+ */
+ LogString toString() const;
- /**
- Convert an integer passed as argument to a level. If the
- conversion fails, then this method returns DEBUG.
- */
- static LevelPtr toLevel(int val);
+ /**
+ Convert an integer passed as argument to a level. If the
+ conversion fails, then this method returns DEBUG.
+ */
+ static LevelPtr toLevel(int val);
- /**
- Convert an integer passed as argument to a level. If the
- conversion fails, then this method returns the specified default.
- */
- static LevelPtr toLevel(int val, const LevelPtr& defaultLevel);
+ /**
+ Convert an integer passed as argument to a level. If the
+ conversion fails, then this method returns the specified default.
+ */
+ static LevelPtr toLevel(int val, const LevelPtr& defaultLevel);
- enum
- {
- OFF_INT = INT_MAX,
- FATAL_INT = 50000,
- ERROR_INT = 40000,
- WARN_INT = 30000,
- INFO_INT = 20000,
- DEBUG_INT = 10000,
- TRACE_INT = 5000,
- ALL_INT = INT_MIN
- };
+ enum
+ {
+ OFF_INT = INT_MAX,
+ FATAL_INT = 50000,
+ ERROR_INT = 40000,
+ WARN_INT = 30000,
+ INFO_INT = 20000,
+ DEBUG_INT = 10000,
+ TRACE_INT = 5000,
+ ALL_INT = INT_MIN
+ };
- static LevelPtr getAll();
- static LevelPtr getFatal();
- static LevelPtr getError();
- static LevelPtr getWarn();
- static LevelPtr getInfo();
- static LevelPtr getDebug();
- static LevelPtr getTrace();
- static LevelPtr getOff();
+ static LevelPtr getAll();
+ static LevelPtr getFatal();
+ static LevelPtr getError();
+ static LevelPtr getWarn();
+ static LevelPtr getInfo();
+ static LevelPtr getDebug();
+ static LevelPtr getTrace();
+ static LevelPtr getOff();
- /**
- Two levels are equal if their level fields are equal.
- */
- virtual bool equals(const LevelPtr& level) const;
+ /**
+ Two levels are equal if their level fields are equal.
+ */
+ virtual bool equals(const LevelPtr& level) const;
- inline bool operator==(const Level& level1) const
- {
- return (this->level == level1.level);
- }
+ inline bool operator==(const Level& level1) const
+ {
+ return (this->level == level1.level);
+ }
- inline bool operator!=(const Level& level1) const
- {
- return (this->level != level1.level);
- }
+ inline bool operator!=(const Level& level1) const
+ {
+ return (this->level != level1.level);
+ }
- /**
- Return the syslog equivalent of this level as an integer.
- */
- inline int getSyslogEquivalent() const
- {
- return syslogEquivalent;
- }
+ /**
+ Return the syslog equivalent of this level as an integer.
+ */
+ inline int getSyslogEquivalent() const
+ {
+ return syslogEquivalent;
+ }
- /**
- Returns <code>true</code> if this level has a higher or equal
- level than the level passed as argument, <code>false</code>
- otherwise.
+ /**
+ Returns <code>true</code> if this level has a higher or equal
+ level than the level passed as argument, <code>false</code>
+ otherwise.
- <p>You should think twice before overriding the default
- implementation of <code>isGreaterOrEqual</code> method.
+ <p>You should think twice before overriding the default
+ implementation of <code>isGreaterOrEqual</code> method.
- */
- virtual bool isGreaterOrEqual(const LevelPtr& level) const;
+ */
+ virtual bool isGreaterOrEqual(const LevelPtr& level) const;
- /**
- Returns the integer representation of this level.
- */
- inline int toInt() const
- {
- return level;
- }
+ /**
+ Returns the integer representation of this level.
+ */
+ inline int toInt() const
+ {
+ return level;
+ }
- private:
- int level;
- LogString name;
- int syslogEquivalent;
- Level(const Level&);
- Level& operator=(const Level&);
+ private:
+ int level;
+ LogString name;
+ int syslogEquivalent;
+ Level(const Level&);
+ Level& operator=(const Level&);
};
/**
@@ -294,19 +294,19 @@
/** @class log4cxx::helpers::ObjectPtr */
template<> inline bool LevelPtr::operator==(const LevelPtr& rhs) const
{
- return (*this)->equals(rhs);
+ return (*this)->equals(rhs);
}
template<> inline bool LevelPtr::operator!=(const LevelPtr& rhs) const
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
#if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)
- template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<Level>;
+ template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<Level>;
#elif defined(_MSC_VER) && !defined(LOG4CXX_STATIC)
- #pragma warning(push)
- #pragma warning(disable: 4231)
- extern template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<Level>;
- #pragma warning(pop)
+ #pragma warning(push)
+ #pragma warning(disable: 4231)
+ extern template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<Level>;
+ #pragma warning(pop)
#endif
}
@@ -314,21 +314,21 @@
}
#define DECLARE_LOG4CXX_LEVEL(level)\
- public:\
- class Class##level : public Level::LevelClass\
- {\
- public:\
- Class##level() : Level::LevelClass() {}\
- virtual LogString getName() const { return LOG4CXX_STR(#level); } \
- virtual LevelPtr toLevel(const LogString& sArg) const\
- { return level::toLevelLS(sArg); }\
- virtual LevelPtr toLevel(int val) const\
- { return level::toLevel(val); }\
- };\
- DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level)
+ public:\
+ class Class##level : public Level::LevelClass\
+ {\
+ public:\
+ Class##level() : Level::LevelClass() {}\
+ virtual LogString getName() const { return LOG4CXX_STR(#level); } \
+ virtual LevelPtr toLevel(const LogString& sArg) const\
+ { return level::toLevelLS(sArg); }\
+ virtual LevelPtr toLevel(int val) const\
+ { return level::toLevel(val); }\
+ };\
+ DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level)
#define IMPLEMENT_LOG4CXX_LEVEL(level) \
- IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level)
+ IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level)
#endif //_LOG4CXX_LEVEL_H
diff --git a/src/main/include/log4cxx/logger.h b/src/main/include/log4cxx/logger.h
index 62b6ed9..2db5d9e 100644
--- a/src/main/include/log4cxx/logger.h
+++ b/src/main/include/log4cxx/logger.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_LOGGER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/helpers/appenderattachableimpl.h>
@@ -59,1673 +59,1673 @@
operations, except configuration, are done through this class.
*/
class LOG4CXX_EXPORT Logger :
- public virtual log4cxx::spi::AppenderAttachable,
- public virtual helpers::ObjectImpl
+ public virtual log4cxx::spi::AppenderAttachable,
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Logger)
- LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Logger)
+ LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
+ END_LOG4CXX_CAST_MAP()
- private:
- /**
- * Reference to memory pool.
- */
- helpers::Pool* pool;
+ private:
+ /**
+ * Reference to memory pool.
+ */
+ helpers::Pool* pool;
- protected:
- /**
- The name of this logger.
- */
- LogString name;
+ protected:
+ /**
+ The name of this logger.
+ */
+ LogString name;
- /**
- The assigned level of this logger. The
- <code>level</code> variable need not be assigned a value in
- which case it is inherited form the hierarchy. */
- LevelPtr level;
+ /**
+ The assigned level of this logger. The
+ <code>level</code> variable need not be assigned a value in
+ which case it is inherited form the hierarchy. */
+ LevelPtr level;
- /**
- The parent of this logger. All loggers have at least one
- ancestor which is the root logger. */
- LoggerPtr parent;
+ /**
+ The parent of this logger. All loggers have at least one
+ ancestor which is the root logger. */
+ LoggerPtr parent;
- /** The resourceBundle for localized messages.
+ /** The resourceBundle for localized messages.
- @see setResourceBundle, getResourceBundle
- */
- helpers::ResourceBundlePtr resourceBundle;
+ @see setResourceBundle, getResourceBundle
+ */
+ helpers::ResourceBundlePtr resourceBundle;
- // Loggers need to know what Hierarchy they are in
- log4cxx::spi::LoggerRepository* repository;
+ // Loggers need to know what Hierarchy they are in
+ log4cxx::spi::LoggerRepository* repository;
- helpers::AppenderAttachableImplPtr aai;
+ helpers::AppenderAttachableImplPtr aai;
- /** Additivity is set to true by default, that is children inherit
- the appenders of their ancestors by default. If this variable is
- set to <code>false</code> then the appenders found in the
- ancestors of this logger are not used. However, the children
- of this logger will inherit its appenders, unless the children
- have their additivity flag set to <code>false</code> too. See
- the user manual for more details. */
- bool additive;
+ /** Additivity is set to true by default, that is children inherit
+ the appenders of their ancestors by default. If this variable is
+ set to <code>false</code> then the appenders found in the
+ ancestors of this logger are not used. However, the children
+ of this logger will inherit its appenders, unless the children
+ have their additivity flag set to <code>false</code> too. See
+ the user manual for more details. */
+ bool additive;
- protected:
- friend class DefaultLoggerFactory;
+ protected:
+ friend class DefaultLoggerFactory;
- /**
- This constructor created a new <code>logger</code> instance and
- sets its name.
+ /**
+ This constructor created a new <code>logger</code> instance and
+ sets its name.
- <p>It is intended to be used by sub-classes only. You should not
- create categories directly.
+ <p>It is intended to be used by sub-classes only. You should not
+ create categories directly.
- @param pool lifetime of pool must be longer than logger.
- @param name The name of the logger.
- */
- Logger(log4cxx::helpers::Pool& pool, const LogString& name);
+ @param pool lifetime of pool must be longer than logger.
+ @param name The name of the logger.
+ */
+ Logger(log4cxx::helpers::Pool& pool, const LogString& name);
- public:
- ~Logger();
+ public:
+ ~Logger();
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- /**
- Add <code>newAppender</code> to the list of appenders of this
- Logger instance.
+ /**
+ Add <code>newAppender</code> to the list of appenders of this
+ Logger instance.
- <p>If <code>newAppender</code> is already in the list of
- appenders, then it won't be added again.
- */
- virtual void addAppender(const AppenderPtr& newAppender);
+ <p>If <code>newAppender</code> is already in the list of
+ appenders, then it won't be added again.
+ */
+ virtual void addAppender(const AppenderPtr& newAppender);
- /**
- Call the appenders in the hierrachy starting at
- <code>this</code>. If no appenders could be found, emit a
- warning.
+ /**
+ Call the appenders in the hierrachy starting at
+ <code>this</code>. If no appenders could be found, emit a
+ warning.
- <p>This method calls all the appenders inherited from the
- hierarchy circumventing any evaluation of whether to log or not
- to log the particular log request.
+ <p>This method calls all the appenders inherited from the
+ hierarchy circumventing any evaluation of whether to log or not
+ to log the particular log request.
- @param event the event to log.
- @param p memory pool for any allocations needed to process request.
- */
- void callAppenders(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const;
+ @param event the event to log.
+ @param p memory pool for any allocations needed to process request.
+ */
+ void callAppenders(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const;
- /**
- Close all attached appenders implementing the AppenderAttachable
- interface.
- */
- void closeNestedAppenders();
+ /**
+ Close all attached appenders implementing the AppenderAttachable
+ interface.
+ */
+ void closeNestedAppenders();
- /**
- Log a message string with the DEBUG level.
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the DEBUG level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void debug(const std::string& msg) const;
+ @param msg the message string to log.
+ */
+ void debug(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the DEBUG level.
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the DEBUG level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void debug(const std::wstring& msg) const;
+ @param msg the message string to log.
+ */
+ void debug(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the DEBUG level.
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the DEBUG level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void debug(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void debug(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the DEBUG level.
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the DEBUG level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the DEBUG level.
- <p>This method first checks if this logger is <code>DEBUG</code>
- enabled by comparing the level of this logger with the
- DEBUG level. If this logger is
- <code>DEBUG</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>DEBUG</code>
+ enabled by comparing the level of this logger with the
+ DEBUG level. If this logger is
+ <code>DEBUG</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void debug(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void debug(const CFStringRef& msg) const;
#endif
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void error(const std::string& msg) const;
+ @param msg the message string to log.
+ */
+ void error(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void error(const std::wstring& msg) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ */
+ void error(const std::wstring& msg) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void error(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void error(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void error(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void error(const CFStringRef& msg) const;
#endif
- /**
- Log a message string with the FATAL level.
+ /**
+ Log a message string with the FATAL level.
- <p>This method first checks if this logger is <code>FATAL</code>
- enabled by comparing the level of this logger with the
- FATAL level. If this logger is
- <code>FATAL</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>FATAL</code>
+ enabled by comparing the level of this logger with the
+ FATAL level. If this logger is
+ <code>FATAL</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void fatal(const std::string& msg) const;
+ @param msg the message string to log.
+ */
+ void fatal(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void fatal(const std::wstring& msg) const;
+ @param msg the message string to log.
+ */
+ void fatal(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void fatal(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void fatal(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the ERROR level.
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the ERROR level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the ERROR level.
- <p>This method first checks if this logger is <code>ERROR</code>
- enabled by comparing the level of this logger with the
- ERROR level. If this logger is
- <code>ERROR</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>ERROR</code>
+ enabled by comparing the level of this logger with the
+ ERROR level. If this logger is
+ <code>ERROR</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void fatal(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void fatal(const CFStringRef& msg) const;
#endif
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- @param location location of source of logging request.
- */
- void forcedLog(const LevelPtr& level, const std::string& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- */
- void forcedLog(const LevelPtr& level, const std::string& message) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ @param location location of source of logging request.
+ */
+ void forcedLog(const LevelPtr& level, const std::string& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ */
+ void forcedLog(const LevelPtr& level, const std::string& message) const;
#if LOG4CXX_WCHAR_T_API
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- @param location location of source of logging request.
- */
- void forcedLog(const LevelPtr& level, const std::wstring& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- */
- void forcedLog(const LevelPtr& level, const std::wstring& message) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ @param location location of source of logging request.
+ */
+ void forcedLog(const LevelPtr& level, const std::wstring& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ */
+ void forcedLog(const LevelPtr& level, const std::wstring& message) const;
#endif
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- @param location location of source of logging request.
- */
- void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- */
- void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ @param location location of source of logging request.
+ */
+ void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ */
+ void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- @param location location of source of logging request.
- */
- void forcedLog(const LevelPtr& level, const CFStringRef& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message message.
- */
- void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ @param location location of source of logging request.
+ */
+ void forcedLog(const LevelPtr& level, const CFStringRef& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message message.
+ */
+ void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
#endif
- /**
- This method creates a new logging event and logs the event
- without further checks.
- @param level the level to log.
- @param message the message string to log.
- @param location location of the logging statement.
- */
- void forcedLogLS(const LevelPtr& level, const LogString& message,
- const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This method creates a new logging event and logs the event
+ without further checks.
+ @param level the level to log.
+ @param message the message string to log.
+ @param location location of the logging statement.
+ */
+ void forcedLogLS(const LevelPtr& level, const LogString& message,
+ const log4cxx::spi::LocationInfo& location) const;
- /**
- Get the additivity flag for this Logger instance.
- */
- bool getAdditivity() const;
+ /**
+ Get the additivity flag for this Logger instance.
+ */
+ bool getAdditivity() const;
- /**
- Get the appenders contained in this logger as an AppenderList.
- If no appenders can be found, then an empty AppenderList
- is returned.
- @return AppenderList An collection of the appenders in this logger.*/
- AppenderList getAllAppenders() const;
+ /**
+ Get the appenders contained in this logger as an AppenderList.
+ If no appenders can be found, then an empty AppenderList
+ is returned.
+ @return AppenderList An collection of the appenders in this logger.*/
+ AppenderList getAllAppenders() const;
- /**
- Look for the appender named as <code>name</code>.
- <p>Return the appender with that name if in the list. Return
- <code>NULL</code> otherwise. */
- AppenderPtr getAppender(const LogString& name) const;
+ /**
+ Look for the appender named as <code>name</code>.
+ <p>Return the appender with that name if in the list. Return
+ <code>NULL</code> otherwise. */
+ AppenderPtr getAppender(const LogString& name) const;
- /**
- Starting from this logger, search the logger hierarchy for a
- non-null level and return it.
+ /**
+ Starting from this logger, search the logger hierarchy for a
+ non-null level and return it.
- <p>The Logger class is designed so that this method executes as
- quickly as possible.
+ <p>The Logger class is designed so that this method executes as
+ quickly as possible.
- @throws RuntimeException if all levels are null in the hierarchy
- */
- virtual const LevelPtr& getEffectiveLevel() const;
+ @throws RuntimeException if all levels are null in the hierarchy
+ */
+ virtual const LevelPtr& getEffectiveLevel() const;
- /**
- Return the the LoggerRepository where this
- <code>Logger</code> is attached.
- */
- log4cxx::spi::LoggerRepositoryPtr getLoggerRepository() const;
+ /**
+ Return the the LoggerRepository where this
+ <code>Logger</code> is attached.
+ */
+ log4cxx::spi::LoggerRepositoryPtr getLoggerRepository() const;
- /**
- * Get the logger name.
- * @return logger name as LogString.
- */
- const LogString& getName() const
- {
- return name;
- }
- /**
- * Get logger name in current encoding.
- * @param name buffer to which name is appended.
- */
- void getName(std::string& name) const;
+ /**
+ * Get the logger name.
+ * @return logger name as LogString.
+ */
+ const LogString& getName() const
+ {
+ return name;
+ }
+ /**
+ * Get logger name in current encoding.
+ * @param name buffer to which name is appended.
+ */
+ void getName(std::string& name) const;
#if LOG4CXX_WCHAR_T_API
- /**
- * Get logger name.
- * @param name buffer to which name is appended.
- */
- void getName(std::wstring& name) const;
+ /**
+ * Get logger name.
+ * @param name buffer to which name is appended.
+ */
+ void getName(std::wstring& name) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- * Get logger name.
- * @param name buffer to which name is appended.
- */
- void getName(std::basic_string<UniChar>& name) const;
+ /**
+ * Get logger name.
+ * @param name buffer to which name is appended.
+ */
+ void getName(std::basic_string<UniChar>& name) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- * Get logger name.
- * @param name buffer to which name is appended.
- */
- void getName(CFStringRef& name) const;
+ /**
+ * Get logger name.
+ * @param name buffer to which name is appended.
+ */
+ void getName(CFStringRef& name) const;
#endif
- /**
- Returns the parent of this logger. Note that the parent of a
- given logger may change during the lifetime of the logger.
+ /**
+ Returns the parent of this logger. Note that the parent of a
+ given logger may change during the lifetime of the logger.
- <p>The root logger will return <code>0</code>.
- */
- LoggerPtr getParent() const;
+ <p>The root logger will return <code>0</code>.
+ */
+ LoggerPtr getParent() const;
- /**
- Returns the assigned Level, if any, for this Logger.
+ /**
+ Returns the assigned Level, if any, for this Logger.
- @return Level - the assigned Level, can be null.
- */
- LevelPtr getLevel() const;
+ @return Level - the assigned Level, can be null.
+ */
+ LevelPtr getLevel() const;
- /**
- * Retrieve a logger by name in current encoding.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const std::string& name);
- /**
- * Retrieve a logger by name in current encoding.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const char* const name);
+ /**
+ * Retrieve a logger by name in current encoding.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const std::string& name);
+ /**
+ * Retrieve a logger by name in current encoding.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const char* const name);
#if LOG4CXX_WCHAR_T_API
- /**
- * Retrieve a logger by name.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const std::wstring& name);
- /**
- * Retrieve a logger by name.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const wchar_t* const name);
+ /**
+ * Retrieve a logger by name.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const std::wstring& name);
+ /**
+ * Retrieve a logger by name.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const wchar_t* const name);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- * Retrieve a logger by name.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
+ /**
+ * Retrieve a logger by name.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- * Retrieve a logger by name.
- * @param name logger name.
- */
- static LoggerPtr getLogger(const CFStringRef& name);
+ /**
+ * Retrieve a logger by name.
+ * @param name logger name.
+ */
+ static LoggerPtr getLogger(const CFStringRef& name);
#endif
- /**
- * Retrieve a logger by name in Unicode.
- * @param name logger name.
- */
- static LoggerPtr getLoggerLS(const LogString& name);
+ /**
+ * Retrieve a logger by name in Unicode.
+ * @param name logger name.
+ */
+ static LoggerPtr getLoggerLS(const LogString& name);
- /**
- Retrieve the root logger.
- */
- static LoggerPtr getRootLogger();
+ /**
+ Retrieve the root logger.
+ */
+ static LoggerPtr getRootLogger();
- /**
- Like #getLogger except that the type of logger
- instantiated depends on the type returned by the
- LoggerFactory#makeNewLoggerInstance method of the
- <code>factory</code> parameter.
+ /**
+ Like #getLogger except that the type of logger
+ instantiated depends on the type returned by the
+ LoggerFactory#makeNewLoggerInstance method of the
+ <code>factory</code> parameter.
- <p>This method is intended to be used by sub-classes.
+ <p>This method is intended to be used by sub-classes.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- @param factory A LoggerFactory implementation that will
- actually create a new Instance.
- */
- static LoggerPtr getLoggerLS(const LogString& name,
- const log4cxx::spi::LoggerFactoryPtr& factory);
- /**
- Like #getLogger except that the type of logger
- instantiated depends on the type returned by the
- LoggerFactory#makeNewLoggerInstance method of the
- <code>factory</code> parameter.
+ @param factory A LoggerFactory implementation that will
+ actually create a new Instance.
+ */
+ static LoggerPtr getLoggerLS(const LogString& name,
+ const log4cxx::spi::LoggerFactoryPtr& factory);
+ /**
+ Like #getLogger except that the type of logger
+ instantiated depends on the type returned by the
+ LoggerFactory#makeNewLoggerInstance method of the
+ <code>factory</code> parameter.
- <p>This method is intended to be used by sub-classes.
+ <p>This method is intended to be used by sub-classes.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- @param factory A LoggerFactory implementation that will
- actually create a new Instance.
- */
- static LoggerPtr getLogger(const std::string& name,
- const log4cxx::spi::LoggerFactoryPtr& factory);
+ @param factory A LoggerFactory implementation that will
+ actually create a new Instance.
+ */
+ static LoggerPtr getLogger(const std::string& name,
+ const log4cxx::spi::LoggerFactoryPtr& factory);
#if LOG4CXX_WCHAR_T_API
- /**
- Like #getLogger except that the type of logger
- instantiated depends on the type returned by the
- LoggerFactory#makeNewLoggerInstance method of the
- <code>factory</code> parameter.
+ /**
+ Like #getLogger except that the type of logger
+ instantiated depends on the type returned by the
+ LoggerFactory#makeNewLoggerInstance method of the
+ <code>factory</code> parameter.
- <p>This method is intended to be used by sub-classes.
+ <p>This method is intended to be used by sub-classes.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- @param factory A LoggerFactory implementation that will
- actually create a new Instance.
- */
- static LoggerPtr getLogger(const std::wstring& name,
- const log4cxx::spi::LoggerFactoryPtr& factory);
+ @param factory A LoggerFactory implementation that will
+ actually create a new Instance.
+ */
+ static LoggerPtr getLogger(const std::wstring& name,
+ const log4cxx::spi::LoggerFactoryPtr& factory);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Like #getLogger except that the type of logger
- instantiated depends on the type returned by the
- LoggerFactory#makeNewLoggerInstance method of the
- <code>factory</code> parameter.
+ /**
+ Like #getLogger except that the type of logger
+ instantiated depends on the type returned by the
+ LoggerFactory#makeNewLoggerInstance method of the
+ <code>factory</code> parameter.
- <p>This method is intended to be used by sub-classes.
+ <p>This method is intended to be used by sub-classes.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- @param factory A LoggerFactory implementation that will
- actually create a new Instance.
- */
- static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
- const log4cxx::spi::LoggerFactoryPtr& factory);
+ @param factory A LoggerFactory implementation that will
+ actually create a new Instance.
+ */
+ static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
+ const log4cxx::spi::LoggerFactoryPtr& factory);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Like #getLogger except that the type of logger
- instantiated depends on the type returned by the
- LoggerFactory#makeNewLoggerInstance method of the
- <code>factory</code> parameter.
+ /**
+ Like #getLogger except that the type of logger
+ instantiated depends on the type returned by the
+ LoggerFactory#makeNewLoggerInstance method of the
+ <code>factory</code> parameter.
- <p>This method is intended to be used by sub-classes.
+ <p>This method is intended to be used by sub-classes.
- @param name The name of the logger to retrieve.
+ @param name The name of the logger to retrieve.
- @param factory A LoggerFactory implementation that will
- actually create a new Instance.
- */
- static LoggerPtr getLogger(const CFStringRef& name,
- const log4cxx::spi::LoggerFactoryPtr& factory);
+ @param factory A LoggerFactory implementation that will
+ actually create a new Instance.
+ */
+ static LoggerPtr getLogger(const CFStringRef& name,
+ const log4cxx::spi::LoggerFactoryPtr& factory);
#endif
- /**
- Return the <em>inherited</em> ResourceBundle for this logger.
+ /**
+ Return the <em>inherited</em> ResourceBundle for this logger.
- This method walks the hierarchy to find the appropriate resource bundle.
- It will return the resource bundle attached to the closest ancestor of
- this logger, much like the way priorities are searched. In case there
- is no bundle in the hierarchy then <code>NULL</code> is returned.
- */
- helpers::ResourceBundlePtr getResourceBundle() const;
+ This method walks the hierarchy to find the appropriate resource bundle.
+ It will return the resource bundle attached to the closest ancestor of
+ this logger, much like the way priorities are searched. In case there
+ is no bundle in the hierarchy then <code>NULL</code> is returned.
+ */
+ helpers::ResourceBundlePtr getResourceBundle() const;
- protected:
- /**
- Returns the string resource coresponding to <code>key</code> in this
- logger's inherited resource bundle.
+ protected:
+ /**
+ Returns the string resource coresponding to <code>key</code> in this
+ logger's inherited resource bundle.
- If the resource cannot be found, then an {@link #error error} message
- will be logged complaining about the missing resource.
+ If the resource cannot be found, then an {@link #error error} message
+ will be logged complaining about the missing resource.
- @see #getResourceBundle.
- */
- LogString getResourceBundleString(const LogString& key) const;
+ @see #getResourceBundle.
+ */
+ LogString getResourceBundleString(const LogString& key) const;
- public:
- /**
- Log a message string with the INFO level.
+ public:
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- void info(const std::string& msg) const;
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ void info(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the INFO level.
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the INFO level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void info(const std::wstring& msg) const;
+ @param msg the message string to log.
+ */
+ void info(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the INFO level.
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the INFO level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void info(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void info(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the INFO level.
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the INFO level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the INFO level.
- <p>This method first checks if this logger is <code>INFO</code>
- enabled by comparing the level of this logger with the
- INFO level. If this logger is
- <code>INFO</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>INFO</code>
+ enabled by comparing the level of this logger with the
+ INFO level. If this logger is
+ <code>INFO</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void info(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void info(const CFStringRef& msg) const;
#endif
- /**
- Is the appender passed as parameter attached to this logger?
- */
- bool isAttached(const AppenderPtr& appender) const;
+ /**
+ Is the appender passed as parameter attached to this logger?
+ */
+ bool isAttached(const AppenderPtr& appender) const;
- /**
- * Check whether this logger is enabled for the <code>DEBUG</code>
- * Level.
- *
- * <p> This function is intended to lessen the computational cost of
- * disabled log debug statements.
- *
- * <p> For some <code>logger</code> Logger object, when you write,
- * <pre>
- * logger->debug("debug message");
- * </pre>
- *
- * <p>You incur the cost constructing the message, concatenation in
- * this case, regardless of whether the message is logged or not.
- *
- * <p>If you are worried about speed, then you should write
- * <pre>
- * if(logger->isDebugEnabled()) {
- * logger->debug("debug message");
- * }
- * </pre>
- *
- * <p>This way you will not incur the cost of parameter
- * construction if debugging is disabled for <code>logger</code>. On
- * the other hand, if the <code>logger</code> is debug enabled, you
- * will incur the cost of evaluating whether the logger is debug
- * enabled twice. Once in <code>isDebugEnabled</code> and once in
- * the <code>debug</code>. This is an insignificant overhead
- * since evaluating a logger takes about 1%% of the time it
- * takes to actually log.
- *
- * @return bool - <code>true</code> if this logger is debug
- * enabled, <code>false</code> otherwise.
- * */
- bool isDebugEnabled() const;
+ /**
+ * Check whether this logger is enabled for the <code>DEBUG</code>
+ * Level.
+ *
+ * <p> This function is intended to lessen the computational cost of
+ * disabled log debug statements.
+ *
+ * <p> For some <code>logger</code> Logger object, when you write,
+ * <pre>
+ * logger->debug("debug message");
+ * </pre>
+ *
+ * <p>You incur the cost constructing the message, concatenation in
+ * this case, regardless of whether the message is logged or not.
+ *
+ * <p>If you are worried about speed, then you should write
+ * <pre>
+ * if(logger->isDebugEnabled()) {
+ * logger->debug("debug message");
+ * }
+ * </pre>
+ *
+ * <p>This way you will not incur the cost of parameter
+ * construction if debugging is disabled for <code>logger</code>. On
+ * the other hand, if the <code>logger</code> is debug enabled, you
+ * will incur the cost of evaluating whether the logger is debug
+ * enabled twice. Once in <code>isDebugEnabled</code> and once in
+ * the <code>debug</code>. This is an insignificant overhead
+ * since evaluating a logger takes about 1%% of the time it
+ * takes to actually log.
+ *
+ * @return bool - <code>true</code> if this logger is debug
+ * enabled, <code>false</code> otherwise.
+ * */
+ bool isDebugEnabled() const;
- /**
- Check whether this logger is enabled for a given
- Level passed as parameter.
+ /**
+ Check whether this logger is enabled for a given
+ Level passed as parameter.
- See also #isDebugEnabled.
+ See also #isDebugEnabled.
- @return bool True if this logger is enabled for <code>level</code>.
- */
- bool isEnabledFor(const LevelPtr& level) const;
+ @return bool True if this logger is enabled for <code>level</code>.
+ */
+ bool isEnabledFor(const LevelPtr& level) const;
- /**
- Check whether this logger is enabled for the info Level.
- See also #isDebugEnabled.
+ /**
+ Check whether this logger is enabled for the info Level.
+ See also #isDebugEnabled.
- @return bool - <code>true</code> if this logger is enabled
- for level info, <code>false</code> otherwise.
- */
- bool isInfoEnabled() const;
+ @return bool - <code>true</code> if this logger is enabled
+ for level info, <code>false</code> otherwise.
+ */
+ bool isInfoEnabled() const;
- /**
- Check whether this logger is enabled for the warn Level.
- See also #isDebugEnabled.
+ /**
+ Check whether this logger is enabled for the warn Level.
+ See also #isDebugEnabled.
- @return bool - <code>true</code> if this logger is enabled
- for level warn, <code>false</code> otherwise.
- */
- bool isWarnEnabled() const;
+ @return bool - <code>true</code> if this logger is enabled
+ for level warn, <code>false</code> otherwise.
+ */
+ bool isWarnEnabled() const;
- /**
- Check whether this logger is enabled for the error Level.
- See also #isDebugEnabled.
+ /**
+ Check whether this logger is enabled for the error Level.
+ See also #isDebugEnabled.
- @return bool - <code>true</code> if this logger is enabled
- for level error, <code>false</code> otherwise.
- */
- bool isErrorEnabled() const;
+ @return bool - <code>true</code> if this logger is enabled
+ for level error, <code>false</code> otherwise.
+ */
+ bool isErrorEnabled() const;
- /**
- Check whether this logger is enabled for the fatal Level.
- See also #isDebugEnabled.
+ /**
+ Check whether this logger is enabled for the fatal Level.
+ See also #isDebugEnabled.
- @return bool - <code>true</code> if this logger is enabled
- for level fatal, <code>false</code> otherwise.
- */
- bool isFatalEnabled() const;
+ @return bool - <code>true</code> if this logger is enabled
+ for level fatal, <code>false</code> otherwise.
+ */
+ bool isFatalEnabled() const;
- /**
- Check whether this logger is enabled for the trace level.
- See also #isDebugEnabled.
+ /**
+ Check whether this logger is enabled for the trace level.
+ See also #isDebugEnabled.
- @return bool - <code>true</code> if this logger is enabled
- for level trace, <code>false</code> otherwise.
- */
- bool isTraceEnabled() const;
+ @return bool - <code>true</code> if this logger is enabled
+ for level trace, <code>false</code> otherwise.
+ */
+ bool isTraceEnabled() const;
- /**
- Log a localized and parameterized message.
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param values The values for the placeholders <code>{0}</code>,
- <code>{1}</code> etc. within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param values The values for the placeholders <code>{0}</code>,
+ <code>{1}</code> etc. within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const LogString& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::vector<LogString>& values) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const LogString& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::vector<LogString>& values) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::string& key,
- const log4cxx::spi::LocationInfo& locationInfo) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::string& key,
+ const log4cxx::spi::LocationInfo& locationInfo) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The first value for the placeholders within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The first value for the placeholders within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::string& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::string& val1) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::string& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::string& val1) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The first value for the placeholders within the pattern.
- @param val2 The second value for the placeholders within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The first value for the placeholders within the pattern.
+ @param val2 The second value for the placeholders within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::string& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::string& val1, const std::string& val2) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::string& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::string& val1, const std::string& val2) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
- @param val3 The value for the third placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
+ @param val3 The value for the third placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::string& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::string& val1, const std::string& val2, const std::string& val3) const;
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::string& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::string& val1, const std::string& val2, const std::string& val3) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a localized and parameterized message.
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::wstring& key,
- const log4cxx::spi::LocationInfo& locationInfo) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::wstring& key,
+ const log4cxx::spi::LocationInfo& locationInfo) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::wstring& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::wstring& val1) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::wstring& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::wstring& val1) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::wstring& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::wstring& val1, const std::wstring& val2) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::wstring& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::wstring& val1, const std::wstring& val2) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
- @param val3 The value for the third placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
+ @param val3 The value for the third placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::wstring& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::wstring& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a localized and parameterized message.
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
- const log4cxx::spi::LocationInfo& locationInfo) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
+ const log4cxx::spi::LocationInfo& locationInfo) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::basic_string<UniChar>& val1) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::basic_string<UniChar>& val1) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
- @param val3 The value for the third placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
+ @param val3 The value for the third placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
- const std::basic_string<UniChar>& val3) const;
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
+ const std::basic_string<UniChar>& val3) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a localized and parameterized message.
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const CFStringRef& key,
- const log4cxx::spi::LocationInfo& locationInfo) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const CFStringRef& key,
+ const log4cxx::spi::LocationInfo& locationInfo) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const CFStringRef& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const CFStringRef& val1) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const CFStringRef& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const CFStringRef& val1) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const CFStringRef& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const CFStringRef& val1, const CFStringRef& val2) const;
- /**
- Log a localized and parameterized message.
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const CFStringRef& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const CFStringRef& val1, const CFStringRef& val2) const;
+ /**
+ Log a localized and parameterized message.
- First, the user supplied
- <code>key</code> is searched in the resource bundle. Next, the resulting
- pattern is formatted using helpers::StringHelper::format method with the user
- supplied string array <code>params</code>.
+ First, the user supplied
+ <code>key</code> is searched in the resource bundle. Next, the resulting
+ pattern is formatted using helpers::StringHelper::format method with the user
+ supplied string array <code>params</code>.
- @param level The level of the logging request.
- @param key The key to be searched in the ResourceBundle.
- @param locationInfo The location info of the logging request.
- @param val1 The value for the first placeholder within the pattern.
- @param val2 The value for the second placeholder within the pattern.
- @param val3 The value for the third placeholder within the pattern.
+ @param level The level of the logging request.
+ @param key The key to be searched in the ResourceBundle.
+ @param locationInfo The location info of the logging request.
+ @param val1 The value for the first placeholder within the pattern.
+ @param val2 The value for the second placeholder within the pattern.
+ @param val3 The value for the third placeholder within the pattern.
- @see #setResourceBundle
- */
- void l7dlog(const LevelPtr& level, const CFStringRef& key,
- const log4cxx::spi::LocationInfo& locationInfo,
- const CFStringRef& val1, const CFStringRef& val2,
- const CFStringRef& val3) const;
+ @see #setResourceBundle
+ */
+ void l7dlog(const LevelPtr& level, const CFStringRef& key,
+ const log4cxx::spi::LocationInfo& locationInfo,
+ const CFStringRef& val1, const CFStringRef& val2,
+ const CFStringRef& val3) const;
#endif
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- @param location The source file of the logging request, may be null. */
- void log(const LevelPtr& level, const std::string& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ @param location The source file of the logging request, may be null. */
+ void log(const LevelPtr& level, const std::string& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- */
- void log(const LevelPtr& level, const std::string& message) const;
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ */
+ void log(const LevelPtr& level, const std::string& message) const;
#if LOG4CXX_WCHAR_T_API
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- @param location The source file of the logging request, may be null. */
- void log(const LevelPtr& level, const std::wstring& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ @param location The source file of the logging request, may be null. */
+ void log(const LevelPtr& level, const std::wstring& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- */
- void log(const LevelPtr& level, const std::wstring& message) const;
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ */
+ void log(const LevelPtr& level, const std::wstring& message) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- @param location The source file of the logging request, may be null. */
- void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ @param location The source file of the logging request, may be null. */
+ void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- */
- void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ */
+ void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- @param location The source file of the logging request, may be null. */
- void log(const LevelPtr& level, const CFStringRef& message,
- const log4cxx::spi::LocationInfo& location) const;
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ @param location The source file of the logging request, may be null. */
+ void log(const LevelPtr& level, const CFStringRef& message,
+ const log4cxx::spi::LocationInfo& location) const;
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- */
- void log(const LevelPtr& level, const CFStringRef& message) const;
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ */
+ void log(const LevelPtr& level, const CFStringRef& message) const;
#endif
- /**
- This is the most generic printing method. It is intended to be
- invoked by <b>wrapper</b> classes.
+ /**
+ This is the most generic printing method. It is intended to be
+ invoked by <b>wrapper</b> classes.
- @param level The level of the logging request.
- @param message The message of the logging request.
- @param location The source file of the logging request, may be null. */
- void logLS(const LevelPtr& level, const LogString& message,
- const log4cxx::spi::LocationInfo& location) const;
+ @param level The level of the logging request.
+ @param message The message of the logging request.
+ @param location The source file of the logging request, may be null. */
+ void logLS(const LevelPtr& level, const LogString& message,
+ const log4cxx::spi::LocationInfo& location) const;
- /**
- Remove all previously added appenders from this logger
- instance.
- <p>This is useful when re-reading configuration information.
- */
- void removeAllAppenders();
+ /**
+ Remove all previously added appenders from this logger
+ instance.
+ <p>This is useful when re-reading configuration information.
+ */
+ void removeAllAppenders();
- /**
- Remove the appender passed as parameter form the list of appenders.
- */
- void removeAppender(const AppenderPtr& appender);
+ /**
+ Remove the appender passed as parameter form the list of appenders.
+ */
+ void removeAppender(const AppenderPtr& appender);
- /**
- Remove the appender with the name passed as parameter form the
- list of appenders.
- */
- void removeAppender(const LogString& name);
+ /**
+ Remove the appender with the name passed as parameter form the
+ list of appenders.
+ */
+ void removeAppender(const LogString& name);
- /**
- Set the additivity flag for this Logger instance.
- */
- void setAdditivity(bool additive);
+ /**
+ Set the additivity flag for this Logger instance.
+ */
+ void setAdditivity(bool additive);
- protected:
- friend class Hierarchy;
- /**
- Only the Hierarchy class can set the hierarchy of a logger.*/
- void setHierarchy(spi::LoggerRepository* repository);
+ protected:
+ friend class Hierarchy;
+ /**
+ Only the Hierarchy class can set the hierarchy of a logger.*/
+ void setHierarchy(spi::LoggerRepository* repository);
- public:
- /**
- Set the level of this Logger.
+ public:
+ /**
+ Set the level of this Logger.
- <p>As in <pre> logger->setLevel(Level::getDebug()); </pre>
+ <p>As in <pre> logger->setLevel(Level::getDebug()); </pre>
- <p>Null values are admitted. */
- virtual void setLevel(const LevelPtr& level);
+ <p>Null values are admitted. */
+ virtual void setLevel(const LevelPtr& level);
- /**
- Set the resource bundle to be used with localized logging methods.
- */
- inline void setResourceBundle(const helpers::ResourceBundlePtr& bundle)
- {
- resourceBundle = bundle;
- }
+ /**
+ Set the resource bundle to be used with localized logging methods.
+ */
+ inline void setResourceBundle(const helpers::ResourceBundlePtr& bundle)
+ {
+ resourceBundle = bundle;
+ }
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the WARN level.
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the WARN level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void warn(const std::wstring& msg) const;
+ @param msg the message string to log.
+ */
+ void warn(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the WARN level.
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the WARN level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void warn(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void warn(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the WARN level.
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the WARN level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void warn(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void warn(const CFStringRef& msg) const;
#endif
- /**
- Log a message string with the WARN level.
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the WARN level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the WARN level.
- <p>This method first checks if this logger is <code>WARN</code>
- enabled by comparing the level of this logger with the
- WARN level. If this logger is
- <code>WARN</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>WARN</code>
+ enabled by comparing the level of this logger with the
+ WARN level. If this logger is
+ <code>WARN</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void warn(const std::string& msg) const;
+ @param msg the message string to log.
+ */
+ void warn(const std::string& msg) const;
#if LOG4CXX_WCHAR_T_API
- /**
- Log a message string with the TRACE level.
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the TRACE level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void trace(const std::wstring& msg) const;
+ @param msg the message string to log.
+ */
+ void trace(const std::wstring& msg) const;
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Log a message string with the TRACE level.
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the TRACE level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void trace(const std::basic_string<UniChar>& msg) const;
+ @param msg the message string to log.
+ */
+ void trace(const std::basic_string<UniChar>& msg) const;
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Log a message string with the TRACE level.
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the TRACE level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void trace(const CFStringRef& msg) const;
+ @param msg the message string to log.
+ */
+ void trace(const CFStringRef& msg) const;
#endif
- /**
- Log a message string with the TRACE level.
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- @param location location of source of logging request.
- */
- void trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
- /**
- Log a message string with the TRACE level.
+ @param msg the message string to log.
+ @param location location of source of logging request.
+ */
+ void trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
+ /**
+ Log a message string with the TRACE level.
- <p>This method first checks if this logger is <code>TRACE</code>
- enabled by comparing the level of this logger with the
- TRACE level. If this logger is
- <code>TRACE</code> enabled, it proceeds to call all the
- registered appenders in this logger and also higher in the
- hierarchy depending on the value of the additivity flag.
+ <p>This method first checks if this logger is <code>TRACE</code>
+ enabled by comparing the level of this logger with the
+ TRACE level. If this logger is
+ <code>TRACE</code> enabled, it proceeds to call all the
+ registered appenders in this logger and also higher in the
+ hierarchy depending on the value of the additivity flag.
- @param msg the message string to log.
- */
- void trace(const std::string& msg) const;
+ @param msg the message string to log.
+ */
+ void trace(const std::string& msg) const;
- inline SHARED_MUTEX& getMutex()
- {
- return mutex;
- }
+ inline SHARED_MUTEX& getMutex()
+ {
+ return mutex;
+ }
- private:
- //
- // prevent copy and assignment
- Logger(const Logger&);
- Logger& operator=(const Logger&);
- mutable SHARED_MUTEX mutex;
- friend class log4cxx::helpers::synchronized;
+ private:
+ //
+ // prevent copy and assignment
+ Logger(const Logger&);
+ Logger& operator=(const Logger&);
+ mutable SHARED_MUTEX mutex;
+ friend class log4cxx::helpers::synchronized;
};
LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
@@ -1736,23 +1736,23 @@
*/
#if !defined(LOG4CXX_UNLIKELY)
- #if __GNUC__ >= 3
- /**
- Provides optimization hint to the compiler
- to optimize for the expression being false.
- @param expr boolean expression.
- @returns value of expression.
- */
- #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
- #else
- /**
- Provides optimization hint to the compiler
- to optimize for the expression being false.
- @param expr boolean expression.
- @returns value of expression.
- **/
- #define LOG4CXX_UNLIKELY(expr) expr
- #endif
+ #if __GNUC__ >= 3
+ /**
+ Provides optimization hint to the compiler
+ to optimize for the expression being false.
+ @param expr boolean expression.
+ @returns value of expression.
+ */
+ #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
+ #else
+ /**
+ Provides optimization hint to the compiler
+ to optimize for the expression being false.
+ @param expr boolean expression.
+ @returns value of expression.
+ **/
+ #define LOG4CXX_UNLIKELY(expr) expr
+ #endif
#endif
@@ -1764,9 +1764,9 @@
@param message the message string to log.
*/
#define LOG4CXX_LOG(logger, level, message) do { \
- if (logger->isEnabledFor(level)) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
/**
Logs a message to a specified logger with a specified level.
@@ -1776,9 +1776,9 @@
@param message the message string to log in the internal encoding.
*/
#define LOG4CXX_LOGLS(logger, level, message) do { \
- if (logger->isEnabledFor(level)) {\
- ::log4cxx::helpers::LogCharMessageBuffer oss_; \
- logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ ::log4cxx::helpers::LogCharMessageBuffer oss_; \
+ logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
/**
@@ -1788,9 +1788,9 @@
@param message the message string to log.
*/
#define LOG4CXX_DEBUG(logger, message) do { \
- if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_DEBUG(logger, message)
#endif
@@ -1803,9 +1803,9 @@
@param message the message string to log.
*/
#define LOG4CXX_TRACE(logger, message) do { \
- if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_TRACE(logger, message)
#endif
@@ -1818,9 +1818,9 @@
@param message the message string to log.
*/
#define LOG4CXX_INFO(logger, message) do { \
- if (logger->isInfoEnabled()) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isInfoEnabled()) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_INFO(logger, message)
#endif
@@ -1833,9 +1833,9 @@
@param message the message string to log.
*/
#define LOG4CXX_WARN(logger, message) do { \
- if (logger->isWarnEnabled()) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isWarnEnabled()) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_WARN(logger, message)
#endif
@@ -1848,9 +1848,9 @@
@param message the message string to log.
*/
#define LOG4CXX_ERROR(logger, message) do { \
- if (logger->isErrorEnabled()) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isErrorEnabled()) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
/**
Logs a error if the condition is not true.
@@ -1860,9 +1860,9 @@
@param message the message string to log.
*/
#define LOG4CXX_ASSERT(logger, condition, message) do { \
- if (!(condition) && logger->isErrorEnabled()) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (!(condition) && logger->isErrorEnabled()) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_ERROR(logger, message)
@@ -1877,9 +1877,9 @@
@param message the message string to log.
*/
#define LOG4CXX_FATAL(logger, message) do { \
- if (logger->isFatalEnabled()) {\
- ::log4cxx::helpers::MessageBuffer oss_; \
- logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
+ if (logger->isFatalEnabled()) {\
+ ::log4cxx::helpers::MessageBuffer oss_; \
+ logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
#else
#define LOG4CXX_FATAL(logger, message)
#endif
@@ -1892,8 +1892,8 @@
@param key the key to be searched in the resourceBundle of the logger.
*/
#define LOG4CXX_L7DLOG(logger, level, key) do { \
- if (logger->isEnabledFor(level)) {\
- logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
/**
Logs a localized message with one parameter.
@@ -1904,8 +1904,8 @@
@param p1 the unique parameter.
*/
#define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
- if (logger->isEnabledFor(level)) {\
- logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
/**
Logs a localized message with two parameters.
@@ -1917,8 +1917,8 @@
@param p2 the second parameter.
*/
#define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
- if (logger->isEnabledFor(level)) {\
- logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
/**
Logs a localized message with three parameters.
@@ -1931,13 +1931,13 @@
@param p3 the third parameter.
*/
#define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
- if (logger->isEnabledFor(level)) {\
- logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
+ if (logger->isEnabledFor(level)) {\
+ logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
/**@}*/
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#include <log4cxx/spi/loggerrepository.h>
diff --git a/src/main/include/log4cxx/logmanager.h b/src/main/include/log4cxx/logmanager.h
index 6201b44..eac2074 100644
--- a/src/main/include/log4cxx/logmanager.h
+++ b/src/main/include/log4cxx/logmanager.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_LOG_MANAGER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -48,165 +48,165 @@
*/
class LOG4CXX_EXPORT LogManager
{
- private:
- static void* guard;
- static spi::RepositorySelectorPtr& getRepositorySelector();
+ private:
+ static void* guard;
+ static spi::RepositorySelectorPtr& getRepositorySelector();
- public:
- /**
- Sets <code>LoggerFactory</code> but only if the correct
- <em>guard</em> is passed as parameter.
+ public:
+ /**
+ Sets <code>LoggerFactory</code> but only if the correct
+ <em>guard</em> is passed as parameter.
- <p>Initally the guard is null. If the guard is
- <code>null</code>, then invoking this method sets the logger
- factory and the guard. Following invocations will throw a {@link
- helpers::IllegalArgumentException IllegalArgumentException},
- unless the previously set <code>guard</code> is passed as the second
- parameter.
+ <p>Initally the guard is null. If the guard is
+ <code>null</code>, then invoking this method sets the logger
+ factory and the guard. Following invocations will throw a {@link
+ helpers::IllegalArgumentException IllegalArgumentException},
+ unless the previously set <code>guard</code> is passed as the second
+ parameter.
- <p>This allows a high-level component to set the {@link
- spi::RepositorySelector RepositorySelector} used by the
- <code>LogManager</code>.
- */
+ <p>This allows a high-level component to set the {@link
+ spi::RepositorySelector RepositorySelector} used by the
+ <code>LogManager</code>.
+ */
- static void setRepositorySelector(spi::RepositorySelectorPtr selector,
- void* guard);
+ static void setRepositorySelector(spi::RepositorySelectorPtr selector,
+ void* guard);
- static spi::LoggerRepositoryPtr& getLoggerRepository();
+ static spi::LoggerRepositoryPtr& getLoggerRepository();
- /**
- Retrieve the appropriate root logger.
- */
- static LoggerPtr getRootLogger();
+ /**
+ Retrieve the appropriate root logger.
+ */
+ static LoggerPtr getRootLogger();
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name in current encoding.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::string& name);
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name in current encoding.
- * @param factory logger factory.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::string& name,
- const spi::LoggerFactoryPtr& factory);
- /**
- * Determines if logger name exists in the hierarchy.
- * @param name logger name.
- * @return true if logger exists.
- */
- static LoggerPtr exists(const std::string& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name in current encoding.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::string& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name in current encoding.
+ * @param factory logger factory.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::string& name,
+ const spi::LoggerFactoryPtr& factory);
+ /**
+ * Determines if logger name exists in the hierarchy.
+ * @param name logger name.
+ * @return true if logger exists.
+ */
+ static LoggerPtr exists(const std::string& name);
#if LOG4CXX_WCHAR_T_API
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::wstring& name);
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @param factory logger factory.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::wstring& name,
- const spi::LoggerFactoryPtr& factory);
- /**
- * Determines if logger name exists in the hierarchy.
- * @param name logger name.
- * @return true if logger exists.
- */
- static LoggerPtr exists(const std::wstring& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::wstring& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @param factory logger factory.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::wstring& name,
+ const spi::LoggerFactoryPtr& factory);
+ /**
+ * Determines if logger name exists in the hierarchy.
+ * @param name logger name.
+ * @return true if logger exists.
+ */
+ static LoggerPtr exists(const std::wstring& name);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @param factory logger factory.
- * @return logger.
- */
- static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
- const spi::LoggerFactoryPtr& factory);
- /**
- * Determines if logger name exists in the hierarchy.
- * @param name logger name.
- * @return true if logger exists.
- */
- static LoggerPtr exists(const std::basic_string<UniChar>& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @param factory logger factory.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
+ const spi::LoggerFactoryPtr& factory);
+ /**
+ * Determines if logger name exists in the hierarchy.
+ * @param name logger name.
+ * @return true if logger exists.
+ */
+ static LoggerPtr exists(const std::basic_string<UniChar>& name);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @return logger.
- */
- static LoggerPtr getLogger(const CFStringRef& name);
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @param factory logger factory.
- * @return logger.
- */
- static LoggerPtr getLogger(const CFStringRef& name,
- const spi::LoggerFactoryPtr& factory);
- /**
- * Determines if logger name exists in the hierarchy.
- * @param name logger name.
- * @return true if logger exists.
- */
- static LoggerPtr exists(const CFStringRef& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const CFStringRef& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @param factory logger factory.
+ * @return logger.
+ */
+ static LoggerPtr getLogger(const CFStringRef& name,
+ const spi::LoggerFactoryPtr& factory);
+ /**
+ * Determines if logger name exists in the hierarchy.
+ * @param name logger name.
+ * @return true if logger exists.
+ */
+ static LoggerPtr exists(const CFStringRef& name);
#endif
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @return logger.
- */
- static LoggerPtr getLoggerLS(const LogString& name);
- /**
- Retrieve the appropriate Logger instance.
- * @param name logger name.
- * @param factory logger factory.
- * @return logger.
- */
- static LoggerPtr getLoggerLS(const LogString& name,
- const spi::LoggerFactoryPtr& factory);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @return logger.
+ */
+ static LoggerPtr getLoggerLS(const LogString& name);
+ /**
+ Retrieve the appropriate Logger instance.
+ * @param name logger name.
+ * @param factory logger factory.
+ * @return logger.
+ */
+ static LoggerPtr getLoggerLS(const LogString& name,
+ const spi::LoggerFactoryPtr& factory);
- /**
- * Determines if logger name exists in the hierarchy.
- * @param name logger name.
- * @return true if logger exists.
- */
- static LoggerPtr existsLS(const LogString& name);
+ /**
+ * Determines if logger name exists in the hierarchy.
+ * @param name logger name.
+ * @return true if logger exists.
+ */
+ static LoggerPtr existsLS(const LogString& name);
- static LoggerList getCurrentLoggers();
+ static LoggerList getCurrentLoggers();
- /**
- Safely close and remove all appenders in all loggers including
- the root logger.
- */
- static void shutdown();
+ /**
+ Safely close and remove all appenders in all loggers including
+ the root logger.
+ */
+ static void shutdown();
- /**
- Reset all values contained in this current {@link
- spi::LoggerRepository LoggerRepository} to their default.
- */
- static void resetConfiguration();
+ /**
+ Reset all values contained in this current {@link
+ spi::LoggerRepository LoggerRepository} to their default.
+ */
+ static void resetConfiguration();
}; // class LogManager
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/logstring.h b/src/main/include/log4cxx/logstring.h
index 661ccaa..37b201b 100644
--- a/src/main/include/log4cxx/logstring.h
+++ b/src/main/include/log4cxx/logstring.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_STRING_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -28,12 +28,12 @@
#include <log4cxx/log4cxx.h>
#if (LOG4CXX_LOGCHAR_IS_WCHAR + LOG4CXX_LOGCHAR_IS_UTF8 + LOG4CXX_LOGCHAR_IS_UNICHAR)>1
- #error only one of LOG4CXX_LOGCHAR_IS_WCHAR, LOG4CXX_LOGCHAR_IS_UTF8 or LOG4CXX_LOGCHAR_IS_UNICHAR may be true
+ #error only one of LOG4CXX_LOGCHAR_IS_WCHAR, LOG4CXX_LOGCHAR_IS_UTF8 or LOG4CXX_LOGCHAR_IS_UNICHAR may be true
#endif
#if LOG4CXX_CFSTRING_API
extern "C" {
- typedef const struct __CFString* CFStringRef;
+ typedef const struct __CFString* CFStringRef;
}
#endif
@@ -43,26 +43,26 @@
{
#if LOG4CXX_LOGCHAR_IS_UNICHAR || LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
- typedef unsigned short UniChar;
+ typedef unsigned short UniChar;
#endif
#if LOG4CXX_LOGCHAR_IS_WCHAR
- typedef wchar_t logchar;
- #define LOG4CXX_STR(str) L ## str
+ typedef wchar_t logchar;
+ #define LOG4CXX_STR(str) L ## str
#endif
#if LOG4CXX_LOGCHAR_IS_UTF8
- typedef char logchar;
- #if LOG4CXX_CHARSET_EBCDIC
- #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
- #else
- #define LOG4CXX_STR(str) str
- #endif
+ typedef char logchar;
+ #if LOG4CXX_CHARSET_EBCDIC
+ #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
+ #else
+ #define LOG4CXX_STR(str) str
+ #endif
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR
- typedef UniChar logchar;
- #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
+ typedef UniChar logchar;
+ #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
#endif
typedef std::basic_string<logchar> LogString;
@@ -72,20 +72,20 @@
#if !defined(LOG4CXX_EOL)
- #if defined(_WIN32)
- #define LOG4CXX_EOL LOG4CXX_STR("\x0D\x0A")
- #else
- #define LOG4CXX_EOL LOG4CXX_STR("\x0A")
- #endif
+ #if defined(_WIN32)
+ #define LOG4CXX_EOL LOG4CXX_STR("\x0D\x0A")
+ #else
+ #define LOG4CXX_EOL LOG4CXX_STR("\x0A")
+ #endif
#endif
#if LOG4CXX_LOGCHAR_IS_UNICHAR || (LOG4CXX_LOGCHAR_IS_UTF8 || LOG4CXX_CHARSET_EBCDIC)
- #include <log4cxx/helpers/transcoder.h>
+ #include <log4cxx/helpers/transcoder.h>
#endif
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif //_LOG4CXX_STRING_H
diff --git a/src/main/include/log4cxx/mdc.h b/src/main/include/log4cxx/mdc.h
index dbd8793..6088099 100644
--- a/src/main/include/log4cxx/mdc.h
+++ b/src/main/include/log4cxx/mdc.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_MDC_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/log4cxx.h>
@@ -39,196 +39,196 @@
*/
class LOG4CXX_EXPORT MDC
{
- public:
- /** String to string stl map.
- */
- typedef std::map<LogString, LogString> Map;
+ public:
+ /** String to string stl map.
+ */
+ typedef std::map<LogString, LogString> Map;
- /**
- * Places a key/value pair in the MDC for the current thread
- * which will be removed during the corresponding destructor. Both
- * construction and destruction are expected to be on the same thread.
- * @param key key
- * @param value value.
- */
- MDC(const std::string& key, const std::string& value);
- ~MDC();
+ /**
+ * Places a key/value pair in the MDC for the current thread
+ * which will be removed during the corresponding destructor. Both
+ * construction and destruction are expected to be on the same thread.
+ * @param key key
+ * @param value value.
+ */
+ MDC(const std::string& key, const std::string& value);
+ ~MDC();
- /**
- * Put a context value (the <code>o</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
- *
- * <p>If the current thread does not have a context map it is
- * created as a side effect.
- * @param key key
- * @param value value.
- */
- static void put(const std::string& key, const std::string& value);
- /**
- * Put a context value (the <code>o</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
- *
- * <p>If the current thread does not have a context map it is
- * created as a side effect.
- * */
- static void putLS(const LogString& key, const LogString& value);
+ /**
+ * Put a context value (the <code>o</code> parameter) as identified
+ * with the <code>key</code> parameter into the current thread's
+ * context map.
+ *
+ * <p>If the current thread does not have a context map it is
+ * created as a side effect.
+ * @param key key
+ * @param value value.
+ */
+ static void put(const std::string& key, const std::string& value);
+ /**
+ * Put a context value (the <code>o</code> parameter) as identified
+ * with the <code>key</code> parameter into the current thread's
+ * context map.
+ *
+ * <p>If the current thread does not have a context map it is
+ * created as a side effect.
+ * */
+ static void putLS(const LogString& key, const LogString& value);
- /**
- * Get the context identified by the <code>key</code> parameter.
- *
- * <p>This method has no side effects.
- * @param key key.
- * @return value for key, empty if not set.
- * */
- static std::string get(const std::string& key);
- /**
- * Gets the context identified by the <code>key</code> parameter.
- * @param key context key.
- * @param dest destination to which value is appended.
- * @return true if key has associated value.
- */
- static bool get(const LogString& key, LogString& dest);
+ /**
+ * Get the context identified by the <code>key</code> parameter.
+ *
+ * <p>This method has no side effects.
+ * @param key key.
+ * @return value for key, empty if not set.
+ * */
+ static std::string get(const std::string& key);
+ /**
+ * Gets the context identified by the <code>key</code> parameter.
+ * @param key context key.
+ * @param dest destination to which value is appended.
+ * @return true if key has associated value.
+ */
+ static bool get(const LogString& key, LogString& dest);
- /**
- * Remove the the context identified by the <code>key</code>
- * parameter.
- * @param key key.
- * @return value if key had been set, empty if not.
- */
- static std::string remove(const std::string& key);
+ /**
+ * Remove the the context identified by the <code>key</code>
+ * parameter.
+ * @param key key.
+ * @return value if key had been set, empty if not.
+ */
+ static std::string remove(const std::string& key);
#if LOG4CXX_WCHAR_T_API
- /**
- * Places a key/value pair in the MDC for the current thread
- * which will be removed during the corresponding destructor. Both
- * construction and destruction are expected to be on the same thread.
- * @param key key
- * @param value value.
- */
- MDC(const std::wstring& key, const std::wstring& value);
- /**
- * Put a context value (the <code>o</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
- *
- * <p>If the current thread does not have a context map it is
- * created as a side effect.
- * @param key key
- * @param value value.
- */
- static void put(const std::wstring& key, const std::wstring& value);
- /**
- * Get the context identified by the <code>key</code> parameter.
- *
- * <p>This method has no side effects.
- * @param key key.
- * @return value for key, empty if not set.
- * */
- static std::wstring get(const std::wstring& key);
- /**
- * Remove the the context identified by the <code>key</code>
- * parameter.
- * @param key key.
- * @return value if key had been set, empty if not.
- */
- static std::wstring remove(const std::wstring& key);
+ /**
+ * Places a key/value pair in the MDC for the current thread
+ * which will be removed during the corresponding destructor. Both
+ * construction and destruction are expected to be on the same thread.
+ * @param key key
+ * @param value value.
+ */
+ MDC(const std::wstring& key, const std::wstring& value);
+ /**
+ * Put a context value (the <code>o</code> parameter) as identified
+ * with the <code>key</code> parameter into the current thread's
+ * context map.
+ *
+ * <p>If the current thread does not have a context map it is
+ * created as a side effect.
+ * @param key key
+ * @param value value.
+ */
+ static void put(const std::wstring& key, const std::wstring& value);
+ /**
+ * Get the context identified by the <code>key</code> parameter.
+ *
+ * <p>This method has no side effects.
+ * @param key key.
+ * @return value for key, empty if not set.
+ * */
+ static std::wstring get(const std::wstring& key);
+ /**
+ * Remove the the context identified by the <code>key</code>
+ * parameter.
+ * @param key key.
+ * @return value if key had been set, empty if not.
+ */
+ static std::wstring remove(const std::wstring& key);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- * Places a key/value pair in the MDC for the current thread
- * which will be removed during the corresponding destructor. Both
- * construction and destruction are expected to be on the same thread.
- * @param key key
- * @param value value.
- */
- MDC(const std::basic_string<UniChar>& key, const std::basic_string<UniChar>& value);
- /**
- * Put a context value (the <code>o</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
- *
- * <p>If the current thread does not have a context map it is
- * created as a side effect.
- * @param key key
- * @param value value.
- */
- static void put(const std::basic_string<UniChar>& key, const std::basic_string<UniChar>& value);
- /**
- * Get the context identified by the <code>key</code> parameter.
- *
- * <p>This method has no side effects.
- * @param key key.
- * @return value for key, empty if not set.
- * */
- static std::basic_string<UniChar> get(const std::basic_string<UniChar>& key);
- /**
- * Remove the the context identified by the <code>key</code>
- * parameter.
- * @param key key.
- * @return value if key had been set, empty if not.
- */
- static std::basic_string<UniChar> remove(const std::basic_string<UniChar>& key);
+ /**
+ * Places a key/value pair in the MDC for the current thread
+ * which will be removed during the corresponding destructor. Both
+ * construction and destruction are expected to be on the same thread.
+ * @param key key
+ * @param value value.
+ */
+ MDC(const std::basic_string<UniChar>& key, const std::basic_string<UniChar>& value);
+ /**
+ * Put a context value (the <code>o</code> parameter) as identified
+ * with the <code>key</code> parameter into the current thread's
+ * context map.
+ *
+ * <p>If the current thread does not have a context map it is
+ * created as a side effect.
+ * @param key key
+ * @param value value.
+ */
+ static void put(const std::basic_string<UniChar>& key, const std::basic_string<UniChar>& value);
+ /**
+ * Get the context identified by the <code>key</code> parameter.
+ *
+ * <p>This method has no side effects.
+ * @param key key.
+ * @return value for key, empty if not set.
+ * */
+ static std::basic_string<UniChar> get(const std::basic_string<UniChar>& key);
+ /**
+ * Remove the the context identified by the <code>key</code>
+ * parameter.
+ * @param key key.
+ * @return value if key had been set, empty if not.
+ */
+ static std::basic_string<UniChar> remove(const std::basic_string<UniChar>& key);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- * Places a key/value pair in the MDC for the current thread
- * which will be removed during the corresponding destructor. Both
- * construction and destruction are expected to be on the same thread.
- * @param key key
- * @param value value.
- */
- MDC(const CFStringRef& key, const CFStringRef& value);
- /**
- * Put a context value (the <code>o</code> parameter) as identified
- * with the <code>key</code> parameter into the current thread's
- * context map.
- *
- * <p>If the current thread does not have a context map it is
- * created as a side effect.
- * @param key key
- * @param value value.
- */
- static void put(const CFStringRef& key, const CFStringRef& value);
- /**
- * Get the context identified by the <code>key</code> parameter.
- *
- * <p>This method has no side effects.
- * @param key key.
- * @return value for key, empty if not set.
- * */
- static CFStringRef get(const CFStringRef& key);
- /**
- * Remove the the context identified by the <code>key</code>
- * parameter.
- * @param key key.
- * @return value if key had been set, empty if not.
- */
- static CFStringRef remove(const CFStringRef& key);
+ /**
+ * Places a key/value pair in the MDC for the current thread
+ * which will be removed during the corresponding destructor. Both
+ * construction and destruction are expected to be on the same thread.
+ * @param key key
+ * @param value value.
+ */
+ MDC(const CFStringRef& key, const CFStringRef& value);
+ /**
+ * Put a context value (the <code>o</code> parameter) as identified
+ * with the <code>key</code> parameter into the current thread's
+ * context map.
+ *
+ * <p>If the current thread does not have a context map it is
+ * created as a side effect.
+ * @param key key
+ * @param value value.
+ */
+ static void put(const CFStringRef& key, const CFStringRef& value);
+ /**
+ * Get the context identified by the <code>key</code> parameter.
+ *
+ * <p>This method has no side effects.
+ * @param key key.
+ * @return value for key, empty if not set.
+ * */
+ static CFStringRef get(const CFStringRef& key);
+ /**
+ * Remove the the context identified by the <code>key</code>
+ * parameter.
+ * @param key key.
+ * @return value if key had been set, empty if not.
+ */
+ static CFStringRef remove(const CFStringRef& key);
#endif
- /**
- * Remove the the context identified by the <code>key</code>
- * parameter.
- * @param key key.
- * @param prevValue buffer to which previous value is appended.
- * @return true if key existed in MDC.
- */
- static bool remove(const LogString& key, LogString& prevValue);
+ /**
+ * Remove the the context identified by the <code>key</code>
+ * parameter.
+ * @param key key.
+ * @param prevValue buffer to which previous value is appended.
+ * @return true if key existed in MDC.
+ */
+ static bool remove(const LogString& key, LogString& prevValue);
- /**
- * Clear all entries in the MDC.
- */
- static void clear();
+ /**
+ * Clear all entries in the MDC.
+ */
+ static void clear();
- private:
- MDC(const MDC&);
- MDC& operator=(const MDC&);
- LogString key;
+ private:
+ MDC(const MDC&);
+ MDC& operator=(const MDC&);
+ LogString key;
}; // class MDC;
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/ndc.h b/src/main/include/log4cxx/ndc.h
index 8cd12ae..ec3c65a 100644
--- a/src/main/include/log4cxx/ndc.h
+++ b/src/main/include/log4cxx/ndc.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_NDC_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/log4cxx.h>
@@ -93,260 +93,260 @@
*/
class LOG4CXX_EXPORT NDC
{
- public:
- /**
- * Pair of Message and FullMessage.
- */
- typedef std::pair<LogString, LogString> DiagnosticContext;
- typedef std::stack<DiagnosticContext> Stack;
+ public:
+ /**
+ * Pair of Message and FullMessage.
+ */
+ typedef std::pair<LogString, LogString> DiagnosticContext;
+ typedef std::stack<DiagnosticContext> Stack;
- /**
- Creates a nested diagnostic context.
- Since java performs no automatic cleanup of objects when a
- scope is left, in log4j push() and pop() must be used
- to manage the NDC. For convenience, log4cxx provides
- an NDC constructor and destructor which simply call the push() and
- pop() methods, allowing for automatic cleanup when the current
- scope ends.
+ /**
+ Creates a nested diagnostic context.
+ Since java performs no automatic cleanup of objects when a
+ scope is left, in log4j push() and pop() must be used
+ to manage the NDC. For convenience, log4cxx provides
+ an NDC constructor and destructor which simply call the push() and
+ pop() methods, allowing for automatic cleanup when the current
+ scope ends.
- @param message The new diagnostic context information.
- @see The #push method.
- */
- NDC(const std::string& message);
+ @param message The new diagnostic context information.
+ @see The #push method.
+ */
+ NDC(const std::string& message);
- /**
- Removes the topmost element from the NDC stack.
+ /**
+ Removes the topmost element from the NDC stack.
- @see The #pop method.
- */
- ~NDC();
+ @see The #pop method.
+ */
+ ~NDC();
- /**
- Clear any nested diagnostic information if any. This method is
- useful in cases where the same thread can be potentially used
- over and over in different unrelated contexts.
- */
- static void clear();
+ /**
+ Clear any nested diagnostic information if any. This method is
+ useful in cases where the same thread can be potentially used
+ over and over in different unrelated contexts.
+ */
+ static void clear();
- /**
- Clone the diagnostic context for the current thread.
- <p>Internally a diagnostic context is represented as a stack. A
- given thread can supply the stack (i.e. diagnostic context) to a
- child thread so that the child can inherit the parent thread's
- diagnostic context.
- <p>The child thread uses the #inherit method to
- inherit the parent's diagnostic context.
- <p>If not passed to #inherit, returned stack should be deleted by caller.
- @return Stack A clone of the current thread's diagnostic context, will not be null.
- */
- static Stack* cloneStack();
+ /**
+ Clone the diagnostic context for the current thread.
+ <p>Internally a diagnostic context is represented as a stack. A
+ given thread can supply the stack (i.e. diagnostic context) to a
+ child thread so that the child can inherit the parent thread's
+ diagnostic context.
+ <p>The child thread uses the #inherit method to
+ inherit the parent's diagnostic context.
+ <p>If not passed to #inherit, returned stack should be deleted by caller.
+ @return Stack A clone of the current thread's diagnostic context, will not be null.
+ */
+ static Stack* cloneStack();
- /**
- Inherit the diagnostic context of another thread.
- <p>The parent thread can obtain a reference to its diagnostic
- context using the #cloneStack method. It should
- communicate this information to its child so that it may inherit
- the parent's diagnostic context.
- <p>The parent's diagnostic context is cloned before being
- inherited. In other words, once inherited, the two diagnostic
- contexts can be managed independently.
- @param stack The diagnostic context of the parent thread,
- will be deleted during call. If NULL, NDC will not be modified.
- */
- static void inherit(Stack* stack);
+ /**
+ Inherit the diagnostic context of another thread.
+ <p>The parent thread can obtain a reference to its diagnostic
+ context using the #cloneStack method. It should
+ communicate this information to its child so that it may inherit
+ the parent's diagnostic context.
+ <p>The parent's diagnostic context is cloned before being
+ inherited. In other words, once inherited, the two diagnostic
+ contexts can be managed independently.
+ @param stack The diagnostic context of the parent thread,
+ will be deleted during call. If NULL, NDC will not be modified.
+ */
+ static void inherit(Stack* stack);
- /**
- * Get the current value of the NDC of the
- * currrent thread.
- * @param dest destination to which to append content of NDC.
- * @return true if NDC is set.
- */
- static bool get(LogString& dest);
+ /**
+ * Get the current value of the NDC of the
+ * currrent thread.
+ * @param dest destination to which to append content of NDC.
+ * @return true if NDC is set.
+ */
+ static bool get(LogString& dest);
- /**
- Get the current nesting depth of this diagnostic context.
- */
- static int getDepth();
+ /**
+ Get the current nesting depth of this diagnostic context.
+ */
+ static int getDepth();
- /**
- * Tests if the NDC is empty.
- */
- static bool empty();
+ /**
+ * Tests if the NDC is empty.
+ */
+ static bool empty();
- /**
- Pop top value off stack.
- @return top value.
- */
- static LogString pop();
- /**
- Pop top value off stack.
- @param buf to which top value is appended.
- @return true if NDC contained at least one value.
- */
- static bool pop(std::string& buf);
+ /**
+ Pop top value off stack.
+ @return top value.
+ */
+ static LogString pop();
+ /**
+ Pop top value off stack.
+ @param buf to which top value is appended.
+ @return true if NDC contained at least one value.
+ */
+ static bool pop(std::string& buf);
- /**
- Looks at the last diagnostic context at the top of this NDC
- without removing it.
- <p>The returned value is the value that was pushed last. If no
- context is available, then the empty string "" is returned.
- @return String The innermost diagnostic context.
- */
- static LogString peek();
- /**
- Get top value without removing value.
- @param buf to which top value is appended.
- @return true if NDC contained at least one value.
- */
- static bool peek(std::string& buf);
+ /**
+ Looks at the last diagnostic context at the top of this NDC
+ without removing it.
+ <p>The returned value is the value that was pushed last. If no
+ context is available, then the empty string "" is returned.
+ @return String The innermost diagnostic context.
+ */
+ static LogString peek();
+ /**
+ Get top value without removing value.
+ @param buf to which top value is appended.
+ @return true if NDC contained at least one value.
+ */
+ static bool peek(std::string& buf);
- /**
- Push new diagnostic context information for the current thread.
- <p>The contents of the <code>message</code> parameter is
- determined solely by the client.
- @param message The new diagnostic context information.
- */
- static void push(const std::string& message);
- /**
- Push new diagnostic context information for the current thread.
- <p>The contents of the <code>message</code> parameter is
- determined solely by the client.
- @param message The new diagnostic context information.
- */
- static void pushLS(const LogString& message);
+ /**
+ Push new diagnostic context information for the current thread.
+ <p>The contents of the <code>message</code> parameter is
+ determined solely by the client.
+ @param message The new diagnostic context information.
+ */
+ static void push(const std::string& message);
+ /**
+ Push new diagnostic context information for the current thread.
+ <p>The contents of the <code>message</code> parameter is
+ determined solely by the client.
+ @param message The new diagnostic context information.
+ */
+ static void pushLS(const LogString& message);
- /**
- Remove the diagnostic context for this thread.
- <p>Each thread that created a diagnostic context by calling
- #push should call this method before exiting. Otherwise,
- the memory used by the <b>thread</b> cannot be reclaimed by the
- VM.
- <p>As this is such an important problem in heavy duty systems and
- because it is difficult to always guarantee that the remove
- method is called before exiting a thread, this method has been
- augmented to lazily remove references to dead threads. In
- practice, this means that you can be a little sloppy and
- occasionally forget to call #remove before exiting a
- thread. However, you must call <code>remove</code> sometime. If
- you never call it, then your application is sure to run out of
- memory.
- */
- static void remove();
+ /**
+ Remove the diagnostic context for this thread.
+ <p>Each thread that created a diagnostic context by calling
+ #push should call this method before exiting. Otherwise,
+ the memory used by the <b>thread</b> cannot be reclaimed by the
+ VM.
+ <p>As this is such an important problem in heavy duty systems and
+ because it is difficult to always guarantee that the remove
+ method is called before exiting a thread, this method has been
+ augmented to lazily remove references to dead threads. In
+ practice, this means that you can be a little sloppy and
+ occasionally forget to call #remove before exiting a
+ thread. However, you must call <code>remove</code> sometime. If
+ you never call it, then your application is sure to run out of
+ memory.
+ */
+ static void remove();
#if LOG4CXX_WCHAR_T_API
- /**
- Creates a nested diagnostic context.
- Since java performs no automatic cleanup of objects when a
- scope is left, in log4j push() and pop() must be used
- to manage the NDC. For convenience, log4cxx provides
- an NDC constructor and destructor which simply call the push() and
- pop() methods, allowing for automatic cleanup when the current
- scope ends.
+ /**
+ Creates a nested diagnostic context.
+ Since java performs no automatic cleanup of objects when a
+ scope is left, in log4j push() and pop() must be used
+ to manage the NDC. For convenience, log4cxx provides
+ an NDC constructor and destructor which simply call the push() and
+ pop() methods, allowing for automatic cleanup when the current
+ scope ends.
- @param message The new diagnostic context information.
- @see The #push method.
- */
- NDC(const std::wstring& message);
- /**
- Push new diagnostic context information for the current thread.
- <p>The contents of the <code>message</code> parameter is
- determined solely by the client.
- @param message The new diagnostic context information.
- */
- static void push(const std::wstring& message);
- /**
- * Appends the current NDC content to the provided string.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool peek(std::wstring& dst);
- /**
- * Appends the current NDC content to the provided string and removes the value from the NDC.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool pop(std::wstring& dst);
+ @param message The new diagnostic context information.
+ @see The #push method.
+ */
+ NDC(const std::wstring& message);
+ /**
+ Push new diagnostic context information for the current thread.
+ <p>The contents of the <code>message</code> parameter is
+ determined solely by the client.
+ @param message The new diagnostic context information.
+ */
+ static void push(const std::wstring& message);
+ /**
+ * Appends the current NDC content to the provided string.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool peek(std::wstring& dst);
+ /**
+ * Appends the current NDC content to the provided string and removes the value from the NDC.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool pop(std::wstring& dst);
#endif
#if LOG4CXX_UNICHAR_API
- /**
- Creates a nested diagnostic context.
- Since java performs no automatic cleanup of objects when a
- scope is left, in log4j push() and pop() must be used
- to manage the NDC. For convenience, log4cxx provides
- an NDC constructor and destructor which simply call the push() and
- pop() methods, allowing for automatic cleanup when the current
- scope ends.
+ /**
+ Creates a nested diagnostic context.
+ Since java performs no automatic cleanup of objects when a
+ scope is left, in log4j push() and pop() must be used
+ to manage the NDC. For convenience, log4cxx provides
+ an NDC constructor and destructor which simply call the push() and
+ pop() methods, allowing for automatic cleanup when the current
+ scope ends.
- @param message The new diagnostic context information.
- @see The #push method.
- */
- NDC(const std::basic_string<UniChar>& message);
- /**
- Push new diagnostic context information for the current thread.
- <p>The contents of the <code>message</code> parameter is
- determined solely by the client.
- @param message The new diagnostic context information.
- */
- static void push(const std::basic_string<UniChar>& message);
- /**
- * Appends the current NDC content to the provided string.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool peek(std::basic_string<UniChar>& dst);
- /**
- * Appends the current NDC content to the provided string and removes the value from the NDC.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool pop(std::basic_string<UniChar>& dst);
+ @param message The new diagnostic context information.
+ @see The #push method.
+ */
+ NDC(const std::basic_string<UniChar>& message);
+ /**
+ Push new diagnostic context information for the current thread.
+ <p>The contents of the <code>message</code> parameter is
+ determined solely by the client.
+ @param message The new diagnostic context information.
+ */
+ static void push(const std::basic_string<UniChar>& message);
+ /**
+ * Appends the current NDC content to the provided string.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool peek(std::basic_string<UniChar>& dst);
+ /**
+ * Appends the current NDC content to the provided string and removes the value from the NDC.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool pop(std::basic_string<UniChar>& dst);
#endif
#if LOG4CXX_CFSTRING_API
- /**
- Creates a nested diagnostic context.
- Since java performs no automatic cleanup of objects when a
- scope is left, in log4j push() and pop() must be used
- to manage the NDC. For convenience, log4cxx provides
- an NDC constructor and destructor which simply call the push() and
- pop() methods, allowing for automatic cleanup when the current
- scope ends.
+ /**
+ Creates a nested diagnostic context.
+ Since java performs no automatic cleanup of objects when a
+ scope is left, in log4j push() and pop() must be used
+ to manage the NDC. For convenience, log4cxx provides
+ an NDC constructor and destructor which simply call the push() and
+ pop() methods, allowing for automatic cleanup when the current
+ scope ends.
- @param message The new diagnostic context information.
- @see The #push method.
- */
- NDC(const CFStringRef& message);
- /**
- Push new diagnostic context information for the current thread.
- <p>The contents of the <code>message</code> parameter is
- determined solely by the client.
- @param message The new diagnostic context information.
- */
- static void push(const CFStringRef& message);
- /**
- * Gets the current NDC value.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool peek(CFStringRef& dst);
- /**
- * Gets and removes the current NDC value.
- * @param dst destination.
- * @return true if NDC value set.
- */
- static bool pop(CFStringRef& dst);
+ @param message The new diagnostic context information.
+ @see The #push method.
+ */
+ NDC(const CFStringRef& message);
+ /**
+ Push new diagnostic context information for the current thread.
+ <p>The contents of the <code>message</code> parameter is
+ determined solely by the client.
+ @param message The new diagnostic context information.
+ */
+ static void push(const CFStringRef& message);
+ /**
+ * Gets the current NDC value.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool peek(CFStringRef& dst);
+ /**
+ * Gets and removes the current NDC value.
+ * @param dst destination.
+ * @return true if NDC value set.
+ */
+ static bool pop(CFStringRef& dst);
#endif
- private:
- NDC(const NDC&);
- NDC& operator=(const NDC&);
- static LogString& getMessage(DiagnosticContext& ctx);
- static LogString& getFullMessage(DiagnosticContext& ctx);
+ private:
+ NDC(const NDC&);
+ NDC& operator=(const NDC&);
+ static LogString& getMessage(DiagnosticContext& ctx);
+ static LogString& getFullMessage(DiagnosticContext& ctx);
}; // class NDC;
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/net/smtpappender.h b/src/main/include/log4cxx/net/smtpappender.h
index a2fceff..35e1d59 100644
--- a/src/main/include/log4cxx/net/smtpappender.h
+++ b/src/main/include/log4cxx/net/smtpappender.h
@@ -39,242 +39,242 @@
*/
class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
{
- private:
+ private:
- private:
- SMTPAppender(const SMTPAppender&);
- SMTPAppender& operator=(const SMTPAppender&);
- static bool asciiCheck(const LogString& value, const LogString& label);
- /**
- This method determines if there is a sense in attempting to append.
- <p>It checks whether there is a set output target and also if
- there is a set layout. If these checks fail, then the boolean
- value <code>false</code> is returned. */
- bool checkEntryConditions();
+ private:
+ SMTPAppender(const SMTPAppender&);
+ SMTPAppender& operator=(const SMTPAppender&);
+ static bool asciiCheck(const LogString& value, const LogString& label);
+ /**
+ This method determines if there is a sense in attempting to append.
+ <p>It checks whether there is a set output target and also if
+ there is a set layout. If these checks fail, then the boolean
+ value <code>false</code> is returned. */
+ bool checkEntryConditions();
- LogString to;
- LogString cc;
- LogString bcc;
- LogString from;
- LogString subject;
- LogString smtpHost;
- LogString smtpUsername;
- LogString smtpPassword;
- int smtpPort;
- int bufferSize; // 512
- bool locationInfo;
- helpers::CyclicBuffer cb;
- spi::TriggeringEventEvaluatorPtr evaluator;
+ LogString to;
+ LogString cc;
+ LogString bcc;
+ LogString from;
+ LogString subject;
+ LogString smtpHost;
+ LogString smtpUsername;
+ LogString smtpPassword;
+ int smtpPort;
+ int bufferSize; // 512
+ bool locationInfo;
+ helpers::CyclicBuffer cb;
+ spi::TriggeringEventEvaluatorPtr evaluator;
- public:
- DECLARE_LOG4CXX_OBJECT(SMTPAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SMTPAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SMTPAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SMTPAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- SMTPAppender();
- /**
- The default constructor will instantiate the appender with a
- spi::TriggeringEventEvaluator that will trigger on events with
- level ERROR or higher.*/
- SMTPAppender(log4cxx::helpers::Pool& p);
+ SMTPAppender();
+ /**
+ The default constructor will instantiate the appender with a
+ spi::TriggeringEventEvaluator that will trigger on events with
+ level ERROR or higher.*/
+ SMTPAppender(log4cxx::helpers::Pool& p);
- /**
- Use <code>evaluator</code> passed as parameter as the
- spi::TriggeringEventEvaluator for this net::SMTPAppender.
- */
- SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
+ /**
+ Use <code>evaluator</code> passed as parameter as the
+ spi::TriggeringEventEvaluator for this net::SMTPAppender.
+ */
+ SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
- ~SMTPAppender();
+ ~SMTPAppender();
- /**
- Set options
- */
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- Activate the specified options, such as the smtp host, the
- recipient, from, etc.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& p);
+ /**
+ Activate the specified options, such as the smtp host, the
+ recipient, from, etc.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
- /**
- Perform SMTPAppender specific appending actions, mainly adding
- the event to a cyclic buffer and checking if the event triggers
- an e-mail to be sent. */
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ /**
+ Perform SMTPAppender specific appending actions, mainly adding
+ the event to a cyclic buffer and checking if the event triggers
+ an e-mail to be sent. */
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- virtual void close();
+ virtual void close();
- /**
- Returns value of the <b>To</b> option.
- */
- LogString getTo() const;
+ /**
+ Returns value of the <b>To</b> option.
+ */
+ LogString getTo() const;
- /**
- Returns value of the <b>cc</b> option.
- */
- LogString getCc() const;
+ /**
+ Returns value of the <b>cc</b> option.
+ */
+ LogString getCc() const;
- /**
- Returns value of the <b>bcc</b> option.
- */
- LogString getBcc() const;
+ /**
+ Returns value of the <b>bcc</b> option.
+ */
+ LogString getBcc() const;
- /**
- The <code>SMTPAppender</code> requires a {@link
- Layout layout}. */
- virtual bool requiresLayout() const;
+ /**
+ The <code>SMTPAppender</code> requires a {@link
+ Layout layout}. */
+ virtual bool requiresLayout() const;
- /**
- Send the contents of the cyclic buffer as an e-mail message.
- */
- void sendBuffer(log4cxx::helpers::Pool& p);
+ /**
+ Send the contents of the cyclic buffer as an e-mail message.
+ */
+ void sendBuffer(log4cxx::helpers::Pool& p);
- /**
- Returns value of the <b>EvaluatorClass</b> option.
- */
- LogString getEvaluatorClass();
+ /**
+ Returns value of the <b>EvaluatorClass</b> option.
+ */
+ LogString getEvaluatorClass();
- /**
- Returns value of the <b>From</b> option.
- */
- LogString getFrom() const;
+ /**
+ Returns value of the <b>From</b> option.
+ */
+ LogString getFrom() const;
- /**
- Returns value of the <b>Subject</b> option.
- */
- LogString getSubject() const;
+ /**
+ Returns value of the <b>Subject</b> option.
+ */
+ LogString getSubject() const;
- /**
- The <b>From</b> option takes a string value which should be a
- e-mail address of the sender.
- */
- void setFrom(const LogString& from);
+ /**
+ The <b>From</b> option takes a string value which should be a
+ e-mail address of the sender.
+ */
+ void setFrom(const LogString& from);
- /**
- The <b>Subject</b> option takes a string value which should be a
- the subject of the e-mail message.
- */
- void setSubject(const LogString& subject);
+ /**
+ The <b>Subject</b> option takes a string value which should be a
+ the subject of the e-mail message.
+ */
+ void setSubject(const LogString& subject);
- /**
- The <b>BufferSize</b> option takes a positive integer
- representing the maximum number of logging events to collect in a
- cyclic buffer. When the <code>BufferSize</code> is reached,
- oldest events are deleted as new events are added to the
- buffer. By default the size of the cyclic buffer is 512 events.
- */
- void setBufferSize(int bufferSize);
+ /**
+ The <b>BufferSize</b> option takes a positive integer
+ representing the maximum number of logging events to collect in a
+ cyclic buffer. When the <code>BufferSize</code> is reached,
+ oldest events are deleted as new events are added to the
+ buffer. By default the size of the cyclic buffer is 512 events.
+ */
+ void setBufferSize(int bufferSize);
- /**
- The <b>SMTPHost</b> option takes a string value which should be a
- the host name of the SMTP server that will send the e-mail message.
- */
- void setSMTPHost(const LogString& smtpHost);
+ /**
+ The <b>SMTPHost</b> option takes a string value which should be a
+ the host name of the SMTP server that will send the e-mail message.
+ */
+ void setSMTPHost(const LogString& smtpHost);
- /**
- Returns value of the <b>SMTPHost</b> option.
- */
- LogString getSMTPHost() const;
+ /**
+ Returns value of the <b>SMTPHost</b> option.
+ */
+ LogString getSMTPHost() const;
- /**
- The <b>SMTPPort</b> option takes a string value which should be a
- the port of the SMTP server that will send the e-mail message.
- */
- void setSMTPPort(int port);
+ /**
+ The <b>SMTPPort</b> option takes a string value which should be a
+ the port of the SMTP server that will send the e-mail message.
+ */
+ void setSMTPPort(int port);
- /**
- Returns value of the <b>SMTPHost</b> option.
- */
- int getSMTPPort() const;
+ /**
+ Returns value of the <b>SMTPHost</b> option.
+ */
+ int getSMTPPort() const;
- /**
- The <b>To</b> option takes a string value which should be a
- comma separated list of e-mail address of the recipients.
- */
- void setTo(const LogString& to);
+ /**
+ The <b>To</b> option takes a string value which should be a
+ comma separated list of e-mail address of the recipients.
+ */
+ void setTo(const LogString& to);
- /**
- The <b>Cc</b> option takes a string value which should be a
- comma separated list of e-mail address of the cc'd recipients.
- */
- void setCc(const LogString& to);
+ /**
+ The <b>Cc</b> option takes a string value which should be a
+ comma separated list of e-mail address of the cc'd recipients.
+ */
+ void setCc(const LogString& to);
- /**
- The <b>Bcc</b> option takes a string value which should be a
- comma separated list of e-mail address of the bcc'd recipients.
- */
- void setBcc(const LogString& to);
+ /**
+ The <b>Bcc</b> option takes a string value which should be a
+ comma separated list of e-mail address of the bcc'd recipients.
+ */
+ void setBcc(const LogString& to);
- /**
- The <b>SMTPUsername</b> option takes a string value which should be a
- the user name for the SMTP server.
- */
- void setSMTPUsername(const LogString& newVal);
+ /**
+ The <b>SMTPUsername</b> option takes a string value which should be a
+ the user name for the SMTP server.
+ */
+ void setSMTPUsername(const LogString& newVal);
- /**
- Returns value of the <b>SMTPUsername</b> option.
- */
- LogString getSMTPUsername() const;
+ /**
+ Returns value of the <b>SMTPUsername</b> option.
+ */
+ LogString getSMTPUsername() const;
- /**
- The <b>SMTPPassword</b> option takes a string value which should be a
- the password for the SMTP server.
- */
- void setSMTPPassword(const LogString& newVal);
+ /**
+ The <b>SMTPPassword</b> option takes a string value which should be a
+ the password for the SMTP server.
+ */
+ void setSMTPPassword(const LogString& newVal);
- /**
- Returns value of the <b>SMTPPassword</b> option.
- */
- LogString getSMTPPassword() const;
+ /**
+ Returns value of the <b>SMTPPassword</b> option.
+ */
+ LogString getSMTPPassword() const;
- /**
- Returns value of the <b>BufferSize</b> option.
- */
- inline int getBufferSize() const
- {
- return bufferSize;
- }
+ /**
+ Returns value of the <b>BufferSize</b> option.
+ */
+ inline int getBufferSize() const
+ {
+ return bufferSize;
+ }
- /**
- * Gets the current triggering evaluator.
- * @return triggering evaluator.
- */
- log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
+ /**
+ * Gets the current triggering evaluator.
+ * @return triggering evaluator.
+ */
+ log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
- /**
- * Sets the triggering evaluator.
- * @param trigger triggering evaluator.
- */
- void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger);
+ /**
+ * Sets the triggering evaluator.
+ * @param trigger triggering evaluator.
+ */
+ void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger);
- /**
- The <b>EvaluatorClass</b> option takes a string value
- representing the name of the class implementing the
- spi::TriggeringEventEvaluator interface. A corresponding object will
- be instantiated and assigned as the triggering event evaluator
- for the SMTPAppender.
- */
- void setEvaluatorClass(const LogString& value);
+ /**
+ The <b>EvaluatorClass</b> option takes a string value
+ representing the name of the class implementing the
+ spi::TriggeringEventEvaluator interface. A corresponding object will
+ be instantiated and assigned as the triggering event evaluator
+ for the SMTPAppender.
+ */
+ void setEvaluatorClass(const LogString& value);
- /**
- The <b>LocationInfo</b> option is provided for compatibility with log4j
- and has no effect in log4cxx.
- */
- void setLocationInfo(bool locationInfo);
+ /**
+ The <b>LocationInfo</b> option is provided for compatibility with log4j
+ and has no effect in log4cxx.
+ */
+ void setLocationInfo(bool locationInfo);
- /**
- Returns value of the <b>LocationInfo</b> option.
- */
- bool getLocationInfo() const;
+ /**
+ Returns value of the <b>LocationInfo</b> option.
+ */
+ bool getLocationInfo() const;
}; // class SMTPAppender
LOG4CXX_PTR_DEF(SMTPAppender);
diff --git a/src/main/include/log4cxx/net/socketappender.h b/src/main/include/log4cxx/net/socketappender.h
index 7f46907..df4d23e 100644
--- a/src/main/include/log4cxx/net/socketappender.h
+++ b/src/main/include/log4cxx/net/socketappender.h
@@ -85,45 +85,45 @@
*/
class LOG4CXX_EXPORT SocketAppender : public SocketAppenderSkeleton
{
- public:
- /**
- The default port number of remote logging server (4560).
- */
- static int DEFAULT_PORT;
+ public:
+ /**
+ The default port number of remote logging server (4560).
+ */
+ static int DEFAULT_PORT;
- /**
- The default reconnection delay (30000 milliseconds or 30 seconds).
- */
- static int DEFAULT_RECONNECTION_DELAY;
+ /**
+ The default reconnection delay (30000 milliseconds or 30 seconds).
+ */
+ static int DEFAULT_RECONNECTION_DELAY;
- DECLARE_LOG4CXX_OBJECT(SocketAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SocketAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(SocketAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SocketAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- SocketAppender();
- ~SocketAppender();
+ SocketAppender();
+ ~SocketAppender();
- /**
- Connects to remote server at <code>address</code> and <code>port</code>.
- */
- SocketAppender(helpers::InetAddressPtr& address, int port);
+ /**
+ Connects to remote server at <code>address</code> and <code>port</code>.
+ */
+ SocketAppender(helpers::InetAddressPtr& address, int port);
- /**
- Connects to remote server at <code>host</code> and <code>port</code>.
- */
- SocketAppender(const LogString& host, int port);
+ /**
+ Connects to remote server at <code>host</code> and <code>port</code>.
+ */
+ SocketAppender(const LogString& host, int port);
- protected:
- virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p);
- virtual void cleanUp(log4cxx::helpers::Pool& p);
- virtual int getDefaultDelay() const;
- virtual int getDefaultPort() const;
- void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
+ protected:
+ virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p);
+ virtual void cleanUp(log4cxx::helpers::Pool& p);
+ virtual int getDefaultDelay() const;
+ virtual int getDefaultPort() const;
+ void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
- private:
- log4cxx::helpers::ObjectOutputStreamPtr oos;
+ private:
+ log4cxx::helpers::ObjectOutputStreamPtr oos;
}; // class SocketAppender
diff --git a/src/main/include/log4cxx/net/socketappenderskeleton.h b/src/main/include/log4cxx/net/socketappenderskeleton.h
index 36c535d..5f2b162 100644
--- a/src/main/include/log4cxx/net/socketappenderskeleton.h
+++ b/src/main/include/log4cxx/net/socketappenderskeleton.h
@@ -34,160 +34,160 @@
*/
class LOG4CXX_EXPORT SocketAppenderSkeleton : public AppenderSkeleton
{
- private:
- /**
- host name
- */
- LogString remoteHost;
+ private:
+ /**
+ host name
+ */
+ LogString remoteHost;
- /**
- IP address
- */
- helpers::InetAddressPtr address;
+ /**
+ IP address
+ */
+ helpers::InetAddressPtr address;
- int port;
- int reconnectionDelay;
- bool locationInfo;
+ int port;
+ int reconnectionDelay;
+ bool locationInfo;
- public:
- SocketAppenderSkeleton(int defaultPort, int reconnectionDelay);
- ~SocketAppenderSkeleton();
+ public:
+ SocketAppenderSkeleton(int defaultPort, int reconnectionDelay);
+ ~SocketAppenderSkeleton();
- /**
- Connects to remote server at <code>address</code> and <code>port</code>.
- */
- SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay);
+ /**
+ Connects to remote server at <code>address</code> and <code>port</code>.
+ */
+ SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay);
- /**
- Connects to remote server at <code>host</code> and <code>port</code>.
- */
- SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay);
+ /**
+ Connects to remote server at <code>host</code> and <code>port</code>.
+ */
+ SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay);
- /**
- Connect to the specified <b>RemoteHost</b> and <b>Port</b>.
- */
- void activateOptions(log4cxx::helpers::Pool& p);
+ /**
+ Connect to the specified <b>RemoteHost</b> and <b>Port</b>.
+ */
+ void activateOptions(log4cxx::helpers::Pool& p);
- void close();
+ void close();
- /**
- * This appender does not use a layout. Hence, this method
- * returns <code>false</code>.
- *
- */
- bool requiresLayout() const
- {
- return false;
- }
+ /**
+ * This appender does not use a layout. Hence, this method
+ * returns <code>false</code>.
+ *
+ */
+ bool requiresLayout() const
+ {
+ return false;
+ }
- /**
- * The <b>RemoteHost</b> option takes a string value which should be
- * the host name of the server where a
- * Apache Chainsaw or compatible is running.
- * */
- inline void setRemoteHost(const LogString& host)
- {
- address = helpers::InetAddress::getByName(host);
- remoteHost.assign(host);
- }
+ /**
+ * The <b>RemoteHost</b> option takes a string value which should be
+ * the host name of the server where a
+ * Apache Chainsaw or compatible is running.
+ * */
+ inline void setRemoteHost(const LogString& host)
+ {
+ address = helpers::InetAddress::getByName(host);
+ remoteHost.assign(host);
+ }
- /**
- Returns value of the <b>RemoteHost</b> option.
- */
- inline const LogString& getRemoteHost() const
- {
- return remoteHost;
- }
+ /**
+ Returns value of the <b>RemoteHost</b> option.
+ */
+ inline const LogString& getRemoteHost() const
+ {
+ return remoteHost;
+ }
- /**
- The <b>Port</b> option takes a positive integer representing
- the port where the server is waiting for connections.
- */
- void setPort(int port1)
- {
- this->port = port1;
- }
+ /**
+ The <b>Port</b> option takes a positive integer representing
+ the port where the server is waiting for connections.
+ */
+ void setPort(int port1)
+ {
+ this->port = port1;
+ }
- /**
- Returns value of the <b>Port</b> option.
- */
- int getPort() const
- {
- return port;
- }
+ /**
+ Returns value of the <b>Port</b> option.
+ */
+ int getPort() const
+ {
+ return port;
+ }
- /**
- The <b>LocationInfo</b> option takes a boolean value. If true,
- the information sent to the remote host will include location
- information. By default no location information is sent to the server.
- */
- void setLocationInfo(bool locationInfo1)
- {
- this->locationInfo = locationInfo1;
- }
+ /**
+ The <b>LocationInfo</b> option takes a boolean value. If true,
+ the information sent to the remote host will include location
+ information. By default no location information is sent to the server.
+ */
+ void setLocationInfo(bool locationInfo1)
+ {
+ this->locationInfo = locationInfo1;
+ }
- /**
- Returns value of the <b>LocationInfo</b> option.
- */
- bool getLocationInfo() const
- {
- return locationInfo;
- }
+ /**
+ Returns value of the <b>LocationInfo</b> option.
+ */
+ bool getLocationInfo() const
+ {
+ return locationInfo;
+ }
- /**
- The <b>ReconnectionDelay</b> option takes a positive integer
- representing the number of milliseconds to wait between each
- failed connection attempt to the server. The default value of
- this option is 30000 which corresponds to 30 seconds.
+ /**
+ The <b>ReconnectionDelay</b> option takes a positive integer
+ representing the number of milliseconds to wait between each
+ failed connection attempt to the server. The default value of
+ this option is 30000 which corresponds to 30 seconds.
- <p>Setting this option to zero turns off reconnection
- capability.
- */
- void setReconnectionDelay(int reconnectionDelay1)
- {
- this->reconnectionDelay = reconnectionDelay1;
- }
+ <p>Setting this option to zero turns off reconnection
+ capability.
+ */
+ void setReconnectionDelay(int reconnectionDelay1)
+ {
+ this->reconnectionDelay = reconnectionDelay1;
+ }
- /**
- Returns value of the <b>ReconnectionDelay</b> option.
- */
- int getReconnectionDelay() const
- {
- return reconnectionDelay;
- }
+ /**
+ Returns value of the <b>ReconnectionDelay</b> option.
+ */
+ int getReconnectionDelay() const
+ {
+ return reconnectionDelay;
+ }
- void fireConnector();
+ void fireConnector();
- void setOption(const LogString& option,
- const LogString& value);
+ void setOption(const LogString& option,
+ const LogString& value);
- protected:
+ protected:
- virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p) = 0;
+ virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p) = 0;
- virtual void cleanUp(log4cxx::helpers::Pool& p) = 0;
+ virtual void cleanUp(log4cxx::helpers::Pool& p) = 0;
- virtual int getDefaultDelay() const = 0;
+ virtual int getDefaultDelay() const = 0;
- virtual int getDefaultPort() const = 0;
+ virtual int getDefaultPort() const = 0;
- private:
- void connect(log4cxx::helpers::Pool& p);
- /**
- The Connector will reconnect when the server becomes available
- again. It does this by attempting to open a new connection every
- <code>reconnectionDelay</code> milliseconds.
+ private:
+ void connect(log4cxx::helpers::Pool& p);
+ /**
+ The Connector will reconnect when the server becomes available
+ again. It does this by attempting to open a new connection every
+ <code>reconnectionDelay</code> milliseconds.
- <p>It stops trying whenever a connection is established. It will
- restart to try reconnect to the server when previously open
- connection is droppped.
- */
+ <p>It stops trying whenever a connection is established. It will
+ restart to try reconnect to the server when previously open
+ connection is droppped.
+ */
- helpers::Thread thread;
- static void* LOG4CXX_THREAD_FUNC monitor(apr_thread_t* thread, void* data);
- SocketAppenderSkeleton(const SocketAppenderSkeleton&);
- SocketAppenderSkeleton& operator=(const SocketAppenderSkeleton&);
+ helpers::Thread thread;
+ static void* LOG4CXX_THREAD_FUNC monitor(apr_thread_t* thread, void* data);
+ SocketAppenderSkeleton(const SocketAppenderSkeleton&);
+ SocketAppenderSkeleton& operator=(const SocketAppenderSkeleton&);
}; // class SocketAppenderSkeleton
} // namespace net
diff --git a/src/main/include/log4cxx/net/sockethubappender.h b/src/main/include/log4cxx/net/sockethubappender.h
index 47a64bd..69bc10c 100644
--- a/src/main/include/log4cxx/net/sockethubappender.h
+++ b/src/main/include/log4cxx/net/sockethubappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_NET_SOCKET_HUB_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -108,93 +108,93 @@
class LOG4CXX_EXPORT SocketHubAppender : public AppenderSkeleton
{
- private:
- /**
- The default port number of the ServerSocket will be created on.
- */
- static int DEFAULT_PORT;
+ private:
+ /**
+ The default port number of the ServerSocket will be created on.
+ */
+ static int DEFAULT_PORT;
- int port;
- ObjectOutputStreamList streams;
- bool locationInfo;
+ int port;
+ ObjectOutputStreamList streams;
+ bool locationInfo;
- public:
- DECLARE_LOG4CXX_OBJECT(SocketHubAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SocketHubAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SocketHubAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SocketHubAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- SocketHubAppender();
- ~SocketHubAppender();
+ SocketHubAppender();
+ ~SocketHubAppender();
- /**
- Connects to remote server at <code>address</code> and <code>port</code>.
- */
- SocketHubAppender(int port) ;
+ /**
+ Connects to remote server at <code>address</code> and <code>port</code>.
+ */
+ SocketHubAppender(int port) ;
- /**
- Set up the socket server on the specified port.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& p);
+ /**
+ Set up the socket server on the specified port.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
- /**
- Set options
- */
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option, const LogString& value);
- virtual void close();
+ virtual void close();
- /**
- Append an event to all of current connections. */
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ /**
+ Append an event to all of current connections. */
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- /**
- The SocketHubAppender does not use a layout. Hence, this method returns
- <code>false</code>. */
- virtual bool requiresLayout() const
- {
- return false;
- }
+ /**
+ The SocketHubAppender does not use a layout. Hence, this method returns
+ <code>false</code>. */
+ virtual bool requiresLayout() const
+ {
+ return false;
+ }
- /**
- The <b>Port</b> option takes a positive integer representing
- the port where the server is waiting for connections. */
- inline void setPort(int port1)
- {
- this->port = port1;
- }
+ /**
+ The <b>Port</b> option takes a positive integer representing
+ the port where the server is waiting for connections. */
+ inline void setPort(int port1)
+ {
+ this->port = port1;
+ }
- /**
- Returns value of the <b>Port</b> option. */
- inline int getPort() const
- {
- return port;
- }
+ /**
+ Returns value of the <b>Port</b> option. */
+ inline int getPort() const
+ {
+ return port;
+ }
- /**
- The <b>LocationInfo</b> option takes a boolean value. If true,
- the information sent to the remote host will include location
- information. By default no location information is sent to the server. */
- inline void setLocationInfo(bool locationInfo1)
- {
- this->locationInfo = locationInfo1;
- }
+ /**
+ The <b>LocationInfo</b> option takes a boolean value. If true,
+ the information sent to the remote host will include location
+ information. By default no location information is sent to the server. */
+ inline void setLocationInfo(bool locationInfo1)
+ {
+ this->locationInfo = locationInfo1;
+ }
- /**
- Returns value of the <b>LocationInfo</b> option. */
- inline bool getLocationInfo() const
- {
- return locationInfo;
- }
+ /**
+ Returns value of the <b>LocationInfo</b> option. */
+ inline bool getLocationInfo() const
+ {
+ return locationInfo;
+ }
- /**
- Start the ServerMonitor thread. */
- private:
- void startServer();
+ /**
+ Start the ServerMonitor thread. */
+ private:
+ void startServer();
- helpers::Thread thread;
- static void* LOG4CXX_THREAD_FUNC monitor(apr_thread_t* thread, void* data);
+ helpers::Thread thread;
+ static void* LOG4CXX_THREAD_FUNC monitor(apr_thread_t* thread, void* data);
}; // class SocketHubAppender
LOG4CXX_PTR_DEF(SocketHubAppender);
@@ -203,7 +203,7 @@
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_NET_SOCKET_HUB_APPENDER_H
diff --git a/src/main/include/log4cxx/net/syslogappender.h b/src/main/include/log4cxx/net/syslogappender.h
index e2a49e0..94df945 100644
--- a/src/main/include/log4cxx/net/syslogappender.h
+++ b/src/main/include/log4cxx/net/syslogappender.h
@@ -28,121 +28,121 @@
/** Use SyslogAppender to send log messages to a remote syslog daemon.*/
class LOG4CXX_EXPORT SyslogAppender : public AppenderSkeleton
{
- public:
- DECLARE_LOG4CXX_OBJECT(SyslogAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SyslogAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SyslogAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SyslogAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- SyslogAppender();
- SyslogAppender(const LayoutPtr& layout, int syslogFacility);
- SyslogAppender(const LayoutPtr& layout,
- const LogString& syslogHost, int syslogFacility);
- ~SyslogAppender();
- /** Release any resources held by this SyslogAppender.*/
- void close();
+ SyslogAppender();
+ SyslogAppender(const LayoutPtr& layout, int syslogFacility);
+ SyslogAppender(const LayoutPtr& layout,
+ const LogString& syslogHost, int syslogFacility);
+ ~SyslogAppender();
+ /** Release any resources held by this SyslogAppender.*/
+ void close();
- /**
- Returns the specified syslog facility as a lower-case String,
- e.g. "kern", "user", etc.
- */
- static LogString getFacilityString(int syslogFacility);
+ /**
+ Returns the specified syslog facility as a lower-case String,
+ e.g. "kern", "user", etc.
+ */
+ static LogString getFacilityString(int syslogFacility);
- /**
- Returns the integer value corresponding to the named syslog
- facility, or -1 if it couldn't be recognized.
- @param facilityName one of the strings KERN, USER, MAIL, DAEMON,
- AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0,
- LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
- The matching is case-insensitive.
- */
- static int getFacility(const LogString& facilityName);
+ /**
+ Returns the integer value corresponding to the named syslog
+ facility, or -1 if it couldn't be recognized.
+ @param facilityName one of the strings KERN, USER, MAIL, DAEMON,
+ AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0,
+ LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
+ The matching is case-insensitive.
+ */
+ static int getFacility(const LogString& facilityName);
- void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- /**
- This method returns immediately as options are activated when they
- are set.
- */
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option, const LogString& value);
+ /**
+ This method returns immediately as options are activated when they
+ are set.
+ */
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option, const LogString& value);
- /**
- The SyslogAppender requires a layout. Hence, this method returns
- <code>true</code>.
- */
- virtual bool requiresLayout() const
- {
- return true;
- }
+ /**
+ The SyslogAppender requires a layout. Hence, this method returns
+ <code>true</code>.
+ */
+ virtual bool requiresLayout() const
+ {
+ return true;
+ }
- /**
- The <b>SyslogHost</b> option is the name of the the syslog host
- where log output should go.
- <b>WARNING</b> If the SyslogHost is not set, then this appender
- will fail.
- */
- void setSyslogHost(const LogString& syslogHost);
+ /**
+ The <b>SyslogHost</b> option is the name of the the syslog host
+ where log output should go.
+ <b>WARNING</b> If the SyslogHost is not set, then this appender
+ will fail.
+ */
+ void setSyslogHost(const LogString& syslogHost);
- /**
- Returns the value of the <b>SyslogHost</b> option.
- */
- inline const LogString& getSyslogHost() const
- {
- return syslogHost;
- }
+ /**
+ Returns the value of the <b>SyslogHost</b> option.
+ */
+ inline const LogString& getSyslogHost() const
+ {
+ return syslogHost;
+ }
- /**
- Set the syslog facility. This is the <b>Facility</b> option.
+ /**
+ Set the syslog facility. This is the <b>Facility</b> option.
- <p>The <code>facilityName</code> parameter must be one of the
- strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP,
- CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
- LOCAL5, LOCAL6, LOCAL7. Case is unimportant.
- */
- void setFacility(const LogString& facilityName);
+ <p>The <code>facilityName</code> parameter must be one of the
+ strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP,
+ CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
+ LOCAL5, LOCAL6, LOCAL7. Case is unimportant.
+ */
+ void setFacility(const LogString& facilityName);
- /**
- Returns the value of the <b>Facility</b> option.
- */
- inline LogString getFacility() const
- {
- return getFacilityString(syslogFacility);
- }
+ /**
+ Returns the value of the <b>Facility</b> option.
+ */
+ inline LogString getFacility() const
+ {
+ return getFacilityString(syslogFacility);
+ }
- /**
- If the <b>FacilityPrinting</b> option is set to true, the printed
- message will include the facility name of the application. It is
- <em>false</em> by default.
- */
- inline void setFacilityPrinting(bool facilityPrinting1)
- {
- this->facilityPrinting = facilityPrinting1;
- }
+ /**
+ If the <b>FacilityPrinting</b> option is set to true, the printed
+ message will include the facility name of the application. It is
+ <em>false</em> by default.
+ */
+ inline void setFacilityPrinting(bool facilityPrinting1)
+ {
+ this->facilityPrinting = facilityPrinting1;
+ }
- /**
- Returns the value of the <b>FacilityPrinting</b> option.
- */
- inline bool getFacilityPrinting() const
- {
- return facilityPrinting;
- }
+ /**
+ Returns the value of the <b>FacilityPrinting</b> option.
+ */
+ inline bool getFacilityPrinting() const
+ {
+ return facilityPrinting;
+ }
- protected:
- void initSyslogFacilityStr();
+ protected:
+ void initSyslogFacilityStr();
- int syslogFacility; // Have LOG_USER as default
- LogString facilityStr;
- bool facilityPrinting;
- helpers::SyslogWriter* sw;
- LogString syslogHost;
- int syslogHostPort;
- private:
- SyslogAppender(const SyslogAppender&);
- SyslogAppender& operator=(const SyslogAppender&);
+ int syslogFacility; // Have LOG_USER as default
+ LogString facilityStr;
+ bool facilityPrinting;
+ helpers::SyslogWriter* sw;
+ LogString syslogHost;
+ int syslogHostPort;
+ private:
+ SyslogAppender(const SyslogAppender&);
+ SyslogAppender& operator=(const SyslogAppender&);
}; // class SyslogAppender
LOG4CXX_PTR_DEF(SyslogAppender);
} // namespace net
diff --git a/src/main/include/log4cxx/net/telnetappender.h b/src/main/include/log4cxx/net/telnetappender.h
index e531555..8f91ee9 100644
--- a/src/main/include/log4cxx/net/telnetappender.h
+++ b/src/main/include/log4cxx/net/telnetappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_NET_TELNET_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -70,86 +70,86 @@
*/
class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
{
- class SocketHandler;
- friend class SocketHandler;
- private:
- static const int DEFAULT_PORT;
- static const int MAX_CONNECTIONS;
- int port;
+ class SocketHandler;
+ friend class SocketHandler;
+ private:
+ static const int DEFAULT_PORT;
+ static const int MAX_CONNECTIONS;
+ int port;
- public:
- DECLARE_LOG4CXX_OBJECT(TelnetAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TelnetAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(TelnetAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TelnetAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- TelnetAppender();
- ~TelnetAppender();
+ TelnetAppender();
+ ~TelnetAppender();
- /**
- This appender requires a layout to format the text to the
- attached client(s). */
- virtual bool requiresLayout() const
- {
- return true;
- }
+ /**
+ This appender requires a layout to format the text to the
+ attached client(s). */
+ virtual bool requiresLayout() const
+ {
+ return true;
+ }
- LogString getEncoding() const;
- void setEncoding(const LogString& value);
+ LogString getEncoding() const;
+ void setEncoding(const LogString& value);
- /** all of the options have been set, create the socket handler and
- wait for connections. */
- void activateOptions(log4cxx::helpers::Pool& p);
+ /** all of the options have been set, create the socket handler and
+ wait for connections. */
+ void activateOptions(log4cxx::helpers::Pool& p);
- /**
- Set options
- */
- virtual void setOption(const LogString& option, const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- Returns value of the <b>Port</b> option.
- */
- int getPort() const
- {
- return port;
- }
+ /**
+ Returns value of the <b>Port</b> option.
+ */
+ int getPort() const
+ {
+ return port;
+ }
- /**
- The <b>Port</b> option takes a positive integer representing
- the port where the server is waiting for connections.
- */
- void setPort(int port1)
- {
- this->port = port1;
- }
+ /**
+ The <b>Port</b> option takes a positive integer representing
+ the port where the server is waiting for connections.
+ */
+ void setPort(int port1)
+ {
+ this->port = port1;
+ }
- /** shuts down the appender. */
- void close();
+ /** shuts down the appender. */
+ void close();
- protected:
- /** Handles a log event. For this appender, that means writing the
- message to each connected client. */
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) ;
+ protected:
+ /** Handles a log event. For this appender, that means writing the
+ message to each connected client. */
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) ;
- //---------------------------------------------------------- SocketHandler:
+ //---------------------------------------------------------- SocketHandler:
- private:
- // prevent copy and assignment statements
- TelnetAppender(const TelnetAppender&);
- TelnetAppender& operator=(const TelnetAppender&);
+ private:
+ // prevent copy and assignment statements
+ TelnetAppender(const TelnetAppender&);
+ TelnetAppender& operator=(const TelnetAppender&);
- void write(log4cxx::helpers::ByteBuffer&);
- void writeStatus(const log4cxx::helpers::SocketPtr& socket, const LogString& msg, log4cxx::helpers::Pool& p);
- ConnectionList connections;
- LogString encoding;
- log4cxx::helpers::CharsetEncoderPtr encoder;
- helpers::ServerSocket* serverSocket;
- helpers::Thread sh;
- size_t activeConnections;
- static void* LOG4CXX_THREAD_FUNC acceptConnections(apr_thread_t* thread, void* data);
+ void write(log4cxx::helpers::ByteBuffer&);
+ void writeStatus(const log4cxx::helpers::SocketPtr& socket, const LogString& msg, log4cxx::helpers::Pool& p);
+ ConnectionList connections;
+ LogString encoding;
+ log4cxx::helpers::CharsetEncoderPtr encoder;
+ helpers::ServerSocket* serverSocket;
+ helpers::Thread sh;
+ size_t activeConnections;
+ static void* LOG4CXX_THREAD_FUNC acceptConnections(apr_thread_t* thread, void* data);
}; // class TelnetAppender
LOG4CXX_PTR_DEF(TelnetAppender);
@@ -158,7 +158,7 @@
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif // _LOG4CXX_NET_TELNET_APPENDER_H
diff --git a/src/main/include/log4cxx/net/xmlsocketappender.h b/src/main/include/log4cxx/net/xmlsocketappender.h
index a65356b..62d5872 100644
--- a/src/main/include/log4cxx/net/xmlsocketappender.h
+++ b/src/main/include/log4cxx/net/xmlsocketappender.h
@@ -87,58 +87,58 @@
class LOG4CXX_EXPORT XMLSocketAppender : public SocketAppenderSkeleton
{
- public:
- /**
- The default port number of remote logging server (4560).
- */
- static int DEFAULT_PORT;
+ public:
+ /**
+ The default port number of remote logging server (4560).
+ */
+ static int DEFAULT_PORT;
- /**
- The default reconnection delay (30000 milliseconds or 30 seconds).
- */
- static int DEFAULT_RECONNECTION_DELAY;
+ /**
+ The default reconnection delay (30000 milliseconds or 30 seconds).
+ */
+ static int DEFAULT_RECONNECTION_DELAY;
- /**
- An event XML stream cannot exceed 1024 bytes.
- */
- static const int MAX_EVENT_LEN;
+ /**
+ An event XML stream cannot exceed 1024 bytes.
+ */
+ static const int MAX_EVENT_LEN;
- DECLARE_LOG4CXX_OBJECT(XMLSocketAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(XMLSocketAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(XMLSocketAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(XMLSocketAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- XMLSocketAppender();
- ~XMLSocketAppender();
+ XMLSocketAppender();
+ ~XMLSocketAppender();
- /**
- Connects to remote server at <code>address</code> and <code>port</code>.
- */
- XMLSocketAppender(helpers::InetAddressPtr address, int port);
+ /**
+ Connects to remote server at <code>address</code> and <code>port</code>.
+ */
+ XMLSocketAppender(helpers::InetAddressPtr address, int port);
- /**
- Connects to remote server at <code>host</code> and <code>port</code>.
- */
- XMLSocketAppender(const LogString& host, int port);
+ /**
+ Connects to remote server at <code>host</code> and <code>port</code>.
+ */
+ XMLSocketAppender(const LogString& host, int port);
- protected:
- virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p);
+ protected:
+ virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p);
- virtual void cleanUp(log4cxx::helpers::Pool& p);
+ virtual void cleanUp(log4cxx::helpers::Pool& p);
- virtual int getDefaultDelay() const;
+ virtual int getDefaultDelay() const;
- virtual int getDefaultPort() const;
+ virtual int getDefaultPort() const;
- void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
+ void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool);
- private:
- log4cxx::helpers::WriterPtr writer;
- // prevent copy and assignment statements
- XMLSocketAppender(const XMLSocketAppender&);
- XMLSocketAppender& operator=(const XMLSocketAppender&);
+ private:
+ log4cxx::helpers::WriterPtr writer;
+ // prevent copy and assignment statements
+ XMLSocketAppender(const XMLSocketAppender&);
+ XMLSocketAppender& operator=(const XMLSocketAppender&);
}; // class XMLSocketAppender
LOG4CXX_PTR_DEF(XMLSocketAppender);
diff --git a/src/main/include/log4cxx/nt/nteventlogappender.h b/src/main/include/log4cxx/nt/nteventlogappender.h
index 8d4d05f..a0ca67b 100644
--- a/src/main/include/log4cxx/nt/nteventlogappender.h
+++ b/src/main/include/log4cxx/nt/nteventlogappender.h
@@ -30,91 +30,91 @@
*/
class LOG4CXX_EXPORT NTEventLogAppender : public AppenderSkeleton
{
- public:
- DECLARE_LOG4CXX_OBJECT(NTEventLogAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(NTEventLogAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(NTEventLogAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(NTEventLogAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- NTEventLogAppender();
- NTEventLogAppender(const LogString& server, const LogString& log,
- const LogString& source, const LayoutPtr& layout);
+ NTEventLogAppender();
+ NTEventLogAppender(const LogString& server, const LogString& log,
+ const LogString& source, const LayoutPtr& layout);
- virtual ~NTEventLogAppender();
+ virtual ~NTEventLogAppender();
- virtual void activateOptions(log4cxx::helpers::Pool& p);
- virtual void close();
- virtual void setOption(const LogString& option, const LogString& value);
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
+ virtual void close();
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- * The SocketAppender does not use a layout. Hence, this method
- * returns <code>false</code>.
- *
- */
- bool requiresLayout() const
- {
- return true;
- }
+ /**
+ * The SocketAppender does not use a layout. Hence, this method
+ * returns <code>false</code>.
+ *
+ */
+ bool requiresLayout() const
+ {
+ return true;
+ }
- void setSource(const LogString& source)
- {
- this->source.assign(source);
- }
+ void setSource(const LogString& source)
+ {
+ this->source.assign(source);
+ }
- const LogString& getSource() const
- {
- return source;
- }
+ const LogString& getSource() const
+ {
+ return source;
+ }
- void setLog(const LogString& log)
- {
- this->log.assign(log);
- }
+ void setLog(const LogString& log)
+ {
+ this->log.assign(log);
+ }
- const LogString& getLog() const
- {
- return log;
- }
+ const LogString& getLog() const
+ {
+ return log;
+ }
- void setServer(const LogString& server)
- {
- this->server.assign(server);
- }
+ void setServer(const LogString& server)
+ {
+ this->server.assign(server);
+ }
- const LogString& getServer() const
- {
- return server;
- }
+ const LogString& getServer() const
+ {
+ return server;
+ }
- protected:
- //
- // these typedef are proxies for the real Win32 definitions
- // and need to be cast to the global definitions before
- // use with a Win32 API call
- typedef void SID;
- typedef void* HANDLE;
+ protected:
+ //
+ // these typedef are proxies for the real Win32 definitions
+ // and need to be cast to the global definitions before
+ // use with a Win32 API call
+ typedef void SID;
+ typedef void* HANDLE;
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- static unsigned short getEventType(const spi::LoggingEventPtr& event);
- static unsigned short getEventCategory(const spi::LoggingEventPtr& event);
- /*
- * Add this source with appropriate configuration keys to the registry.
- */
- void addRegistryInfo();
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ static unsigned short getEventType(const spi::LoggingEventPtr& event);
+ static unsigned short getEventCategory(const spi::LoggingEventPtr& event);
+ /*
+ * Add this source with appropriate configuration keys to the registry.
+ */
+ void addRegistryInfo();
- // Data
- LogString server;
- LogString log;
- LogString source;
- HANDLE hEventLog;
- SID* pCurrentUserSID;
- static LogString getErrorString(const LogString& function);
+ // Data
+ LogString server;
+ LogString log;
+ LogString source;
+ HANDLE hEventLog;
+ SID* pCurrentUserSID;
+ static LogString getErrorString(const LogString& function);
- private:
- NTEventLogAppender(const NTEventLogAppender&);
- NTEventLogAppender& operator=(const NTEventLogAppender&);
+ private:
+ NTEventLogAppender(const NTEventLogAppender&);
+ NTEventLogAppender& operator=(const NTEventLogAppender&);
}; // class NTEventLogAppender
LOG4CXX_PTR_DEF(NTEventLogAppender);
diff --git a/src/main/include/log4cxx/nt/outputdebugstringappender.h b/src/main/include/log4cxx/nt/outputdebugstringappender.h
index f4082c3..47aacce 100644
--- a/src/main/include/log4cxx/nt/outputdebugstringappender.h
+++ b/src/main/include/log4cxx/nt/outputdebugstringappender.h
@@ -26,23 +26,23 @@
{
class LOG4CXX_EXPORT OutputDebugStringAppender : public AppenderSkeleton
{
- public:
- DECLARE_LOG4CXX_OBJECT(OutputDebugStringAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(OutputDebugStringAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(OutputDebugStringAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(OutputDebugStringAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- OutputDebugStringAppender();
+ OutputDebugStringAppender();
- bool requiresLayout() const
- {
- return true;
- }
+ bool requiresLayout() const
+ {
+ return true;
+ }
- virtual void close() {}
+ virtual void close() {}
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
};
}
}
diff --git a/src/main/include/log4cxx/pattern/classnamepatternconverter.h b/src/main/include/log4cxx/pattern/classnamepatternconverter.h
index 918c3d1..8cf7c94 100644
--- a/src/main/include/log4cxx/pattern/classnamepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/classnamepatternconverter.h
@@ -35,34 +35,34 @@
*/
class LOG4CXX_EXPORT ClassNamePatternConverter : public NamePatternConverter
{
- /**
- * Private constructor.
- * @param options options, may be null.
- * @param logger logger for diagnostic messages, may be null.
- */
- ClassNamePatternConverter(
- const std::vector<LogString>& options);
+ /**
+ * Private constructor.
+ * @param options options, may be null.
+ * @param logger logger for diagnostic messages, may be null.
+ */
+ ClassNamePatternConverter(
+ const std::vector<LogString>& options);
- public:
- DECLARE_LOG4CXX_PATTERN(ClassNamePatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ClassNamePatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(NamePatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(ClassNamePatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ClassNamePatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(NamePatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Gets an instance of ClassNamePatternConverter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Gets an instance of ClassNamePatternConverter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using NamePatternConverter::format;
+ using NamePatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/datepatternconverter.h b/src/main/include/log4cxx/pattern/datepatternconverter.h
index 737599a..cffc698 100644
--- a/src/main/include/log4cxx/pattern/datepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/datepatternconverter.h
@@ -37,49 +37,49 @@
*/
class LOG4CXX_EXPORT DatePatternConverter : public LoggingEventPatternConverter
{
- /**
- * Date format.
- */
- log4cxx::helpers::DateFormatPtr df;
+ /**
+ * Date format.
+ */
+ log4cxx::helpers::DateFormatPtr df;
- /**
- * Private constructor.
- * @param options options, may be null.
- * @param logger logger for diagnostic messages, may be null.
- */
- DatePatternConverter(const OptionsList& options);
+ /**
+ * Private constructor.
+ * @param options options, may be null.
+ * @param logger logger for diagnostic messages, may be null.
+ */
+ DatePatternConverter(const OptionsList& options);
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static log4cxx::helpers::DateFormatPtr getDateFormat(const OptionsList& options);
- public:
- DECLARE_LOG4CXX_PATTERN(DatePatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(DatePatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static log4cxx::helpers::DateFormatPtr getDateFormat(const OptionsList& options);
+ public:
+ DECLARE_LOG4CXX_PATTERN(DatePatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(DatePatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& output,
- log4cxx::helpers::Pool& p) const;
- void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& output,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& output,
+ log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& output,
+ log4cxx::helpers::Pool& p) const;
- void format(const log4cxx::helpers::DatePtr& date,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::DatePtr& date,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
LOG4CXX_PTR_DEF(DatePatternConverter);
diff --git a/src/main/include/log4cxx/pattern/filedatepatternconverter.h b/src/main/include/log4cxx/pattern/filedatepatternconverter.h
index 8fef9cb..0495ea9 100644
--- a/src/main/include/log4cxx/pattern/filedatepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/filedatepatternconverter.h
@@ -36,19 +36,19 @@
*/
class LOG4CXX_EXPORT FileDatePatternConverter
{
- /**
- * Private constructor.
- */
- FileDatePatternConverter();
+ /**
+ * Private constructor.
+ */
+ FileDatePatternConverter();
- public:
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ public:
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
};
}
}
diff --git a/src/main/include/log4cxx/pattern/filelocationpatternconverter.h b/src/main/include/log4cxx/pattern/filelocationpatternconverter.h
index 09a67ed..fd59639 100644
--- a/src/main/include/log4cxx/pattern/filelocationpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/filelocationpatternconverter.h
@@ -33,33 +33,33 @@
*
*/
class LOG4CXX_EXPORT FileLocationPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- FileLocationPatternConverter();
+ /**
+ * Private constructor.
+ */
+ FileLocationPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(FileLocationPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FileLocationPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(FileLocationPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FileLocationPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/formattinginfo.h b/src/main/include/log4cxx/pattern/formattinginfo.h
index 9816e96..6de60b5 100644
--- a/src/main/include/log4cxx/pattern/formattinginfo.h
+++ b/src/main/include/log4cxx/pattern/formattinginfo.h
@@ -43,77 +43,77 @@
class LOG4CXX_EXPORT FormattingInfo : public virtual log4cxx::helpers::ObjectImpl
{
- /**
- * Minimum length.
- */
- const int minLength;
+ /**
+ * Minimum length.
+ */
+ const int minLength;
- /**
- * Maximum length.
- */
- const int maxLength;
+ /**
+ * Maximum length.
+ */
+ const int maxLength;
- /**
- * Alignment.
- */
- const bool leftAlign;
+ /**
+ * Alignment.
+ */
+ const bool leftAlign;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(FormattingInfo)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FormattingInfo)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(FormattingInfo)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FormattingInfo)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Creates new instance.
- * @param leftAlign left align if true.
- * @param minLength minimum length.
- * @param maxLength maximum length.
- */
- FormattingInfo(
- const bool leftAlign, const int minLength, const int maxLength);
+ /**
+ * Creates new instance.
+ * @param leftAlign left align if true.
+ * @param minLength minimum length.
+ * @param maxLength maximum length.
+ */
+ FormattingInfo(
+ const bool leftAlign, const int minLength, const int maxLength);
- /**
- * Gets default instance.
- * @return default instance.
- */
- static FormattingInfoPtr getDefault();
+ /**
+ * Gets default instance.
+ * @return default instance.
+ */
+ static FormattingInfoPtr getDefault();
- /**
- * Determine if left aligned.
- * @return true if left aligned.
- */
- inline bool isLeftAligned() const
- {
- return leftAlign;
- }
+ /**
+ * Determine if left aligned.
+ * @return true if left aligned.
+ */
+ inline bool isLeftAligned() const
+ {
+ return leftAlign;
+ }
- /**
- * Get minimum length.
- * @return minimum length.
- */
- inline int getMinLength() const
- {
- return minLength;
- }
+ /**
+ * Get minimum length.
+ * @return minimum length.
+ */
+ inline int getMinLength() const
+ {
+ return minLength;
+ }
- /**
- * Get maximum length.
- * @return maximum length.
- */
- inline int getMaxLength() const
- {
- return maxLength;
- }
+ /**
+ * Get maximum length.
+ * @return maximum length.
+ */
+ inline int getMaxLength() const
+ {
+ return maxLength;
+ }
- /**
- * Adjust the content of the buffer based on the specified lengths and alignment.
- *
- * @param fieldStart start of field in buffer.
- * @param buffer buffer to be modified.
- */
- void format(const int fieldStart, LogString& buffer) const;
+ /**
+ * Adjust the content of the buffer based on the specified lengths and alignment.
+ *
+ * @param fieldStart start of field in buffer.
+ * @param buffer buffer to be modified.
+ */
+ void format(const int fieldStart, LogString& buffer) const;
};
LOG4CXX_PTR_DEF(FormattingInfo);
}
diff --git a/src/main/include/log4cxx/pattern/fulllocationpatternconverter.h b/src/main/include/log4cxx/pattern/fulllocationpatternconverter.h
index d478b6e..122ee4e 100644
--- a/src/main/include/log4cxx/pattern/fulllocationpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/fulllocationpatternconverter.h
@@ -33,33 +33,33 @@
*
*/
class LOG4CXX_EXPORT FullLocationPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- FullLocationPatternConverter();
+ /**
+ * Private constructor.
+ */
+ FullLocationPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(FullLocationPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FullLocationPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(FullLocationPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FullLocationPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/integerpatternconverter.h b/src/main/include/log4cxx/pattern/integerpatternconverter.h
index db5c2f8..e86fcc5 100644
--- a/src/main/include/log4cxx/pattern/integerpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/integerpatternconverter.h
@@ -35,29 +35,29 @@
class LOG4CXX_EXPORT IntegerPatternConverter : public PatternConverter
{
- /**
- * Private constructor.
- */
- IntegerPatternConverter();
+ /**
+ * Private constructor.
+ */
+ IntegerPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(IntegerPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(IntegerPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(PatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(IntegerPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(IntegerPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(PatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
LOG4CXX_PTR_DEF(IntegerPatternConverter);
diff --git a/src/main/include/log4cxx/pattern/levelpatternconverter.h b/src/main/include/log4cxx/pattern/levelpatternconverter.h
index 68fb38a..a6da4da 100644
--- a/src/main/include/log4cxx/pattern/levelpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/levelpatternconverter.h
@@ -34,33 +34,33 @@
*/
class LOG4CXX_EXPORT LevelPatternConverter : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- LevelPatternConverter();
+ /**
+ * Private constructor.
+ */
+ LevelPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(LevelPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LevelPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LevelPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LevelPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
- LogString getStyleClass(const log4cxx::helpers::ObjectPtr& e) const;
+ LogString getStyleClass(const log4cxx::helpers::ObjectPtr& e) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/linelocationpatternconverter.h b/src/main/include/log4cxx/pattern/linelocationpatternconverter.h
index e37e65b..4fce9cd 100644
--- a/src/main/include/log4cxx/pattern/linelocationpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/linelocationpatternconverter.h
@@ -33,33 +33,33 @@
*
*/
class LOG4CXX_EXPORT LineLocationPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- LineLocationPatternConverter();
+ /**
+ * Private constructor.
+ */
+ LineLocationPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(LineLocationPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LineLocationPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LineLocationPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LineLocationPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/lineseparatorpatternconverter.h b/src/main/include/log4cxx/pattern/lineseparatorpatternconverter.h
index de7c47d..4a51368 100644
--- a/src/main/include/log4cxx/pattern/lineseparatorpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/lineseparatorpatternconverter.h
@@ -33,39 +33,39 @@
*
*/
class LOG4CXX_EXPORT LineSeparatorPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- LineSeparatorPatternConverter();
+ /**
+ * Private constructor.
+ */
+ LineSeparatorPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(LineSeparatorPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LineSeparatorPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LineSeparatorPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LineSeparatorPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
- void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/literalpatternconverter.h b/src/main/include/log4cxx/pattern/literalpatternconverter.h
index 2f96aea..283e445 100644
--- a/src/main/include/log4cxx/pattern/literalpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/literalpatternconverter.h
@@ -34,36 +34,36 @@
*/
class LOG4CXX_EXPORT LiteralPatternConverter : public LoggingEventPatternConverter
{
- /**
- * String literal.
- */
- const LogString literal;
+ /**
+ * String literal.
+ */
+ const LogString literal;
- /**
- * Create a new instance.
- * @param literal string literal.
- */
- LiteralPatternConverter(const LogString& literal);
+ /**
+ * Create a new instance.
+ * @param literal string literal.
+ */
+ LiteralPatternConverter(const LogString& literal);
- public:
- DECLARE_LOG4CXX_PATTERN(LiteralPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LiteralPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LiteralPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LiteralPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- static PatternConverterPtr newInstance(const LogString& literal);
+ static PatternConverterPtr newInstance(const LogString& literal);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
- void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/loggerpatternconverter.h b/src/main/include/log4cxx/pattern/loggerpatternconverter.h
index 21c0abc..985f07a 100644
--- a/src/main/include/log4cxx/pattern/loggerpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/loggerpatternconverter.h
@@ -36,33 +36,33 @@
class LOG4CXX_EXPORT LoggerPatternConverter : public NamePatternConverter
{
- /**
- * Private constructor.
- * @param options options, may be null.
- * @param logger logger for diagnostic messages, may be null.
- */
- LoggerPatternConverter(const std::vector<LogString>& options);
+ /**
+ * Private constructor.
+ * @param options options, may be null.
+ * @param logger logger for diagnostic messages, may be null.
+ */
+ LoggerPatternConverter(const std::vector<LogString>& options);
- public:
- DECLARE_LOG4CXX_PATTERN(LoggerPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LoggerPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(NamePatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LoggerPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LoggerPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(NamePatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using NamePatternConverter::format;
+ using NamePatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
diff --git a/src/main/include/log4cxx/pattern/loggingeventpatternconverter.h b/src/main/include/log4cxx/pattern/loggingeventpatternconverter.h
index e546d59..ace6542 100644
--- a/src/main/include/log4cxx/pattern/loggingeventpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/loggingeventpatternconverter.h
@@ -36,47 +36,47 @@
*/
class LOG4CXX_EXPORT LoggingEventPatternConverter : public PatternConverter
{
- protected:
- /**
- * Constructs an instance of LoggingEventPatternConverter.
- * @param name name of converter.
- * @param style CSS style for output.
- */
- LoggingEventPatternConverter(
- const LogString& name, const LogString& style);
+ protected:
+ /**
+ * Constructs an instance of LoggingEventPatternConverter.
+ * @param name name of converter.
+ * @param style CSS style for output.
+ */
+ LoggingEventPatternConverter(
+ const LogString& name, const LogString& style);
- public:
- DECLARE_LOG4CXX_PATTERN(LoggingEventPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LoggingEventPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(PatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(LoggingEventPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LoggingEventPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(PatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Formats an event into a string buffer.
- * @param event event to format, may not be null.
- * @param toAppendTo string buffer to which the formatted event will be appended. May not be null.
- * @param p pool for memory allocations needing during format.
- */
- virtual void format(
- const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const = 0;
+ /**
+ * Formats an event into a string buffer.
+ * @param event event to format, may not be null.
+ * @param toAppendTo string buffer to which the formatted event will be appended. May not be null.
+ * @param p pool for memory allocations needing during format.
+ */
+ virtual void format(
+ const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const = 0;
- void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
- /**
- * Normally pattern converters are not meant to handle Exceptions although
- * few pattern converters might.
- *
- * By examining the return values for this method, the containing layout will
- * determine whether it handles throwables or not.
+ /**
+ * Normally pattern converters are not meant to handle Exceptions although
+ * few pattern converters might.
+ *
+ * By examining the return values for this method, the containing layout will
+ * determine whether it handles throwables or not.
- * @return true if this PatternConverter handles throwables
- */
- virtual bool handlesThrowable() const;
+ * @return true if this PatternConverter handles throwables
+ */
+ virtual bool handlesThrowable() const;
};
LOG4CXX_PTR_DEF(LoggingEventPatternConverter);
diff --git a/src/main/include/log4cxx/pattern/messagepatternconverter.h b/src/main/include/log4cxx/pattern/messagepatternconverter.h
index 8535219..8964a5d 100644
--- a/src/main/include/log4cxx/pattern/messagepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/messagepatternconverter.h
@@ -35,31 +35,31 @@
class LOG4CXX_EXPORT MessagePatternConverter : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- MessagePatternConverter();
+ /**
+ * Private constructor.
+ */
+ MessagePatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(MessagePatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(MessagePatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(MessagePatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(MessagePatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of pattern converter.
- * @param options options, may be null.
- * @return instance of pattern converter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of pattern converter.
+ * @param options options, may be null.
+ * @return instance of pattern converter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/methodlocationpatternconverter.h b/src/main/include/log4cxx/pattern/methodlocationpatternconverter.h
index 8eeb6c0..e356d90 100644
--- a/src/main/include/log4cxx/pattern/methodlocationpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/methodlocationpatternconverter.h
@@ -33,34 +33,34 @@
*
*/
class LOG4CXX_EXPORT MethodLocationPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- MethodLocationPatternConverter();
+ /**
+ * Private constructor.
+ */
+ MethodLocationPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(MethodLocationPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(MethodLocationPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(MethodLocationPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(MethodLocationPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of MethodLocationPatternConverter.
- * @param options options, may be null.
- * @return instance of MethodLocationPatternConverter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of MethodLocationPatternConverter.
+ * @param options options, may be null.
+ * @return instance of MethodLocationPatternConverter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/nameabbreviator.h b/src/main/include/log4cxx/pattern/nameabbreviator.h
index f62c7c1..86e4396 100644
--- a/src/main/include/log4cxx/pattern/nameabbreviator.h
+++ b/src/main/include/log4cxx/pattern/nameabbreviator.h
@@ -38,45 +38,45 @@
*/
class LOG4CXX_EXPORT NameAbbreviator : public log4cxx::helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(NameAbbreviator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(NameAbbreviator)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(NameAbbreviator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(NameAbbreviator)
+ END_LOG4CXX_CAST_MAP()
- protected:
- NameAbbreviator();
+ protected:
+ NameAbbreviator();
- public:
- virtual ~NameAbbreviator();
+ public:
+ virtual ~NameAbbreviator();
- /**
- * Gets an abbreviator.
- *
- * For example, "%logger{2}" will output only 2 elements of the logger name,
- * "%logger{1.}" will output only the first character of the non-final elements in the name,
- * "%logger(1~.2~} will output the first character of the first element, two characters of
- * the second and subsequent elements and will use a tilde to indicate abbreviated characters.
- *
- * @param pattern abbreviation pattern.
- * @return abbreviator, will not be null.
- */
- static NameAbbreviatorPtr getAbbreviator(const LogString& pattern);
+ /**
+ * Gets an abbreviator.
+ *
+ * For example, "%logger{2}" will output only 2 elements of the logger name,
+ * "%logger{1.}" will output only the first character of the non-final elements in the name,
+ * "%logger(1~.2~} will output the first character of the first element, two characters of
+ * the second and subsequent elements and will use a tilde to indicate abbreviated characters.
+ *
+ * @param pattern abbreviation pattern.
+ * @return abbreviator, will not be null.
+ */
+ static NameAbbreviatorPtr getAbbreviator(const LogString& pattern);
- /**
- * Gets default abbreviator.
- *
- * @return default abbreviator.
- */
- static NameAbbreviatorPtr getDefaultAbbreviator();
+ /**
+ * Gets default abbreviator.
+ *
+ * @return default abbreviator.
+ */
+ static NameAbbreviatorPtr getDefaultAbbreviator();
- /**
- * Abbreviates a name in a StringBuffer.
- *
- * @param nameStart starting position of name in buf.
- * @param buf buffer, may not be null.
- */
- virtual void abbreviate(LogString::size_type nameStart, LogString& buf) const = 0;
+ /**
+ * Abbreviates a name in a StringBuffer.
+ *
+ * @param nameStart starting position of name in buf.
+ * @param buf buffer, may not be null.
+ */
+ virtual void abbreviate(LogString::size_type nameStart, LogString& buf) const = 0;
};
}
diff --git a/src/main/include/log4cxx/pattern/namepatternconverter.h b/src/main/include/log4cxx/pattern/namepatternconverter.h
index 35b8b93..fbc49fc 100644
--- a/src/main/include/log4cxx/pattern/namepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/namepatternconverter.h
@@ -35,40 +35,40 @@
*/
class LOG4CXX_EXPORT NamePatternConverter : public LoggingEventPatternConverter
{
- /**
- * Abbreviator.
- */
- const NameAbbreviatorPtr abbreviator;
+ /**
+ * Abbreviator.
+ */
+ const NameAbbreviatorPtr abbreviator;
- public:
- DECLARE_LOG4CXX_PATTERN(NamePatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(NamePatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(NamePatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(NamePatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- protected:
- /**
- * Constructor.
- * @param name name of converter.
- * @param style style name for associated output.
- * @param options options, may be null, first element will be interpreted as an abbreviation pattern.
- */
- NamePatternConverter(
- const LogString& name,
- const LogString& style,
- const std::vector<LogString>& options);
+ protected:
+ /**
+ * Constructor.
+ * @param name name of converter.
+ * @param style style name for associated output.
+ * @param options options, may be null, first element will be interpreted as an abbreviation pattern.
+ */
+ NamePatternConverter(
+ const LogString& name,
+ const LogString& style,
+ const std::vector<LogString>& options);
- /**
- * Abbreviate name in string buffer.
- * @param nameStart starting position of name to abbreviate.
- * @param buf string buffer containing name.
- */
- void abbreviate(int nameStart, LogString& buf) const;
+ /**
+ * Abbreviate name in string buffer.
+ * @param nameStart starting position of name to abbreviate.
+ * @param buf string buffer containing name.
+ */
+ void abbreviate(int nameStart, LogString& buf) const;
- private:
- NameAbbreviatorPtr getAbbreviator(const std::vector<LogString>& options);
+ private:
+ NameAbbreviatorPtr getAbbreviator(const std::vector<LogString>& options);
};
}
diff --git a/src/main/include/log4cxx/pattern/ndcpatternconverter.h b/src/main/include/log4cxx/pattern/ndcpatternconverter.h
index 279b31c..c23eea4 100644
--- a/src/main/include/log4cxx/pattern/ndcpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/ndcpatternconverter.h
@@ -35,31 +35,31 @@
class LOG4CXX_EXPORT NDCPatternConverter : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- NDCPatternConverter();
+ /**
+ * Private constructor.
+ */
+ NDCPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(NDCPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(NDCPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(NDCPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(NDCPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of NDCPatternConverter.
- * @param options options, may be null.
- * @return instance of NDCPatternConverter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of NDCPatternConverter.
+ * @param options options, may be null.
+ * @return instance of NDCPatternConverter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/patternconverter.h b/src/main/include/log4cxx/pattern/patternconverter.h
index d707c12..5e13a00 100644
--- a/src/main/include/log4cxx/pattern/patternconverter.h
+++ b/src/main/include/log4cxx/pattern/patternconverter.h
@@ -24,8 +24,8 @@
#include <vector>
#ifdef _MSC_VER
- // disable identifier too wide for debugging warning
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ // disable identifier too wide for debugging warning
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#define DECLARE_LOG4CXX_PATTERN(cls) DECLARE_ABSTRACT_LOG4CXX_OBJECT(cls)
@@ -50,71 +50,71 @@
class LOG4CXX_EXPORT PatternConverter : public virtual log4cxx::helpers::ObjectImpl
{
- /**
- * Converter name.
- */
- const LogString name;
+ /**
+ * Converter name.
+ */
+ const LogString name;
- /**
- * Converter style name.
- */
- const LogString style;
+ /**
+ * Converter style name.
+ */
+ const LogString style;
- protected:
- /**
- * Create a new pattern converter.
- * @param name name for pattern converter.
- * @param style CSS style for formatted output.
- */
- PatternConverter(const LogString& name,
- const LogString& style);
+ protected:
+ /**
+ * Create a new pattern converter.
+ * @param name name for pattern converter.
+ * @param style CSS style for formatted output.
+ */
+ PatternConverter(const LogString& name,
+ const LogString& style);
- virtual ~PatternConverter();
+ virtual ~PatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(PatternConverter);
- BEGIN_LOG4CXX_CAST_MAP();
- LOG4CXX_CAST_ENTRY(PatternConverter);
- END_LOG4CXX_CAST_MAP();
+ public:
+ DECLARE_LOG4CXX_PATTERN(PatternConverter);
+ BEGIN_LOG4CXX_CAST_MAP();
+ LOG4CXX_CAST_ENTRY(PatternConverter);
+ END_LOG4CXX_CAST_MAP();
- /**
- * Formats an object into a string buffer.
- * @param obj event to format, may not be null.
- * @param toAppendTo string buffer to which the formatted event will be appended. May not be null.
- * @param p pool for any allocations necessary during formatting.
- */
- virtual void format(const log4cxx::helpers::ObjectPtr& obj,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const = 0;
+ /**
+ * Formats an object into a string buffer.
+ * @param obj event to format, may not be null.
+ * @param toAppendTo string buffer to which the formatted event will be appended. May not be null.
+ * @param p pool for any allocations necessary during formatting.
+ */
+ virtual void format(const log4cxx::helpers::ObjectPtr& obj,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const = 0;
- /**
- * This method returns the name of the conversion pattern.
- *
- * The name can be useful to certain Layouts such as HTMLLayout.
- *
- * @return the name of the conversion pattern
- */
- LogString getName() const;
+ /**
+ * This method returns the name of the conversion pattern.
+ *
+ * The name can be useful to certain Layouts such as HTMLLayout.
+ *
+ * @return the name of the conversion pattern
+ */
+ LogString getName() const;
- /**
- * This method returns the CSS style class that should be applied to
- * the LoggingEvent passed as parameter, which can be null.
- *
- * This information is currently used only by HTMLLayout.
- *
- * @param e null values are accepted
- * @return the name of the conversion pattern
- */
- virtual LogString getStyleClass(const log4cxx::helpers::ObjectPtr& e) const;
+ /**
+ * This method returns the CSS style class that should be applied to
+ * the LoggingEvent passed as parameter, which can be null.
+ *
+ * This information is currently used only by HTMLLayout.
+ *
+ * @param e null values are accepted
+ * @return the name of the conversion pattern
+ */
+ virtual LogString getStyleClass(const log4cxx::helpers::ObjectPtr& e) const;
- protected:
- /**
- * Appends content in the locale code page to a LogString.
- * @param toAppendTo string to which content is appended.
- * @param src content.
- */
- static void append(LogString& toAppendTo, const std::string& src);
+ protected:
+ /**
+ * Appends content in the locale code page to a LogString.
+ * @param toAppendTo string to which content is appended.
+ * @param src content.
+ */
+ static void append(LogString& toAppendTo, const std::string& src);
};
diff --git a/src/main/include/log4cxx/pattern/patternparser.h b/src/main/include/log4cxx/pattern/patternparser.h
index a7d043e..7f58470 100644
--- a/src/main/include/log4cxx/pattern/patternparser.h
+++ b/src/main/include/log4cxx/pattern/patternparser.h
@@ -20,8 +20,8 @@
#define _LOG4CXX_HELPER_PATTERN_CONVERTER_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -55,110 +55,110 @@
*/
class LOG4CXX_EXPORT PatternParser
{
- /**
- * Escape character for format specifier.
- */
- static const logchar ESCAPE_CHAR;
+ /**
+ * Escape character for format specifier.
+ */
+ static const logchar ESCAPE_CHAR;
- enum
- {
- LITERAL_STATE = 0,
- CONVERTER_STATE = 1,
- DOT_STATE = 3,
- MIN_STATE = 4,
- MAX_STATE = 5
- };
+ enum
+ {
+ LITERAL_STATE = 0,
+ CONVERTER_STATE = 1,
+ DOT_STATE = 3,
+ MIN_STATE = 4,
+ MAX_STATE = 5
+ };
- /**
- * Private constructor.
- */
- PatternParser();
+ /**
+ * Private constructor.
+ */
+ PatternParser();
- private:
- /** Extract the converter identifier found at position i.
- *
- * After this function returns, the variable i will point to the
- * first char after the end of the converter identifier.
- *
- * If i points to a char which is not a character acceptable at the
- * start of a unicode identifier, the value null is returned.
- *
- * @param lastChar last processed character.
- * @param pattern format string.
- * @param i current index into pattern format.
- * @param convBuf buffer to receive conversion specifier.
- * @param currentLiteral literal to be output in case format specifier in unrecognized.
- * @return position in pattern after converter.
- */
- static int extractConverter(
- logchar lastChar, const LogString& pattern,
- LogString::size_type i, LogString& convBuf,
- LogString& currentLiteral);
+ private:
+ /** Extract the converter identifier found at position i.
+ *
+ * After this function returns, the variable i will point to the
+ * first char after the end of the converter identifier.
+ *
+ * If i points to a char which is not a character acceptable at the
+ * start of a unicode identifier, the value null is returned.
+ *
+ * @param lastChar last processed character.
+ * @param pattern format string.
+ * @param i current index into pattern format.
+ * @param convBuf buffer to receive conversion specifier.
+ * @param currentLiteral literal to be output in case format specifier in unrecognized.
+ * @return position in pattern after converter.
+ */
+ static int extractConverter(
+ logchar lastChar, const LogString& pattern,
+ LogString::size_type i, LogString& convBuf,
+ LogString& currentLiteral);
- /**
- * Extract options.
- * @param pattern conversion pattern.
- * @param i start of options.
- * @param options array to receive extracted options
- * @return position in pattern after options.
- */
- static int extractOptions(const LogString& pattern, LogString::size_type i,
- std::vector<LogString>& options);
+ /**
+ * Extract options.
+ * @param pattern conversion pattern.
+ * @param i start of options.
+ * @param options array to receive extracted options
+ * @return position in pattern after options.
+ */
+ static int extractOptions(const LogString& pattern, LogString::size_type i,
+ std::vector<LogString>& options);
- public:
- /**
- * Parse a format specifier.
- * @param pattern pattern to parse.
- * @param patternConverters list to receive pattern converters.
- * @param formattingInfos list to receive field specifiers corresponding to pattern converters.
- * @param rules map of stock pattern converters keyed by format specifier.
- */
- static void parse(
- const LogString& pattern,
- std::vector<PatternConverterPtr>& patternConverters,
- std::vector<FormattingInfoPtr>& formattingInfos,
- const PatternMap& rules);
+ public:
+ /**
+ * Parse a format specifier.
+ * @param pattern pattern to parse.
+ * @param patternConverters list to receive pattern converters.
+ * @param formattingInfos list to receive field specifiers corresponding to pattern converters.
+ * @param rules map of stock pattern converters keyed by format specifier.
+ */
+ static void parse(
+ const LogString& pattern,
+ std::vector<PatternConverterPtr>& patternConverters,
+ std::vector<FormattingInfoPtr>& formattingInfos,
+ const PatternMap& rules);
- private:
- /**
- * Creates a new PatternConverter.
- *
- *
- * @param converterId converterId.
- * @param currentLiteral literal to be used if converter is unrecognized or following converter
- * if converterId contains extra characters.
- * @param rules map of stock pattern converters keyed by format specifier.
- * @param options converter options.
- * @return converter or null.
- */
- static PatternConverterPtr createConverter(
- const LogString& converterId,
- LogString& currentLiteral,
- const PatternMap& rules,
- std::vector<LogString>& options);
+ private:
+ /**
+ * Creates a new PatternConverter.
+ *
+ *
+ * @param converterId converterId.
+ * @param currentLiteral literal to be used if converter is unrecognized or following converter
+ * if converterId contains extra characters.
+ * @param rules map of stock pattern converters keyed by format specifier.
+ * @param options converter options.
+ * @return converter or null.
+ */
+ static PatternConverterPtr createConverter(
+ const LogString& converterId,
+ LogString& currentLiteral,
+ const PatternMap& rules,
+ std::vector<LogString>& options);
- /**
- * Processes a format specifier sequence.
- *
- * @param c initial character of format specifier.
- * @param pattern conversion pattern
- * @param i current position in conversion pattern.
- * @param currentLiteral current literal.
- * @param formattingInfo current field specifier.
- * @param rules map of stock pattern converters keyed by format specifier.
- * @param patternConverters list to receive parsed pattern converter.
- * @param formattingInfos list to receive corresponding field specifier.
- * @return position after format specifier sequence.
- */
- static int finalizeConverter(
- logchar c, const LogString& pattern, int i,
- LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
- const PatternMap& rules,
- std::vector<PatternConverterPtr>& patternConverters,
- std::vector<FormattingInfoPtr>& formattingInfos);
+ /**
+ * Processes a format specifier sequence.
+ *
+ * @param c initial character of format specifier.
+ * @param pattern conversion pattern
+ * @param i current position in conversion pattern.
+ * @param currentLiteral current literal.
+ * @param formattingInfo current field specifier.
+ * @param rules map of stock pattern converters keyed by format specifier.
+ * @param patternConverters list to receive parsed pattern converter.
+ * @param formattingInfos list to receive corresponding field specifier.
+ * @return position after format specifier sequence.
+ */
+ static int finalizeConverter(
+ logchar c, const LogString& pattern, int i,
+ LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
+ const PatternMap& rules,
+ std::vector<PatternConverterPtr>& patternConverters,
+ std::vector<FormattingInfoPtr>& formattingInfos);
- static bool isUnicodeIdentifierStart(logchar c);
- static bool isUnicodeIdentifierPart(logchar c);
+ static bool isUnicodeIdentifierStart(logchar c);
+ static bool isUnicodeIdentifierPart(logchar c);
};
@@ -168,7 +168,7 @@
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/pattern/propertiespatternconverter.h b/src/main/include/log4cxx/pattern/propertiespatternconverter.h
index e6364da..26bf915 100644
--- a/src/main/include/log4cxx/pattern/propertiespatternconverter.h
+++ b/src/main/include/log4cxx/pattern/propertiespatternconverter.h
@@ -37,40 +37,40 @@
*
*/
class LOG4CXX_EXPORT PropertiesPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * Name of property to output.
- */
- const LogString option;
+ /**
+ * Name of property to output.
+ */
+ const LogString option;
- /**
- * Private constructor.
- * @param options options, may be null.
- * @param logger logger for diagnostic messages, may be null.
- */
- PropertiesPatternConverter(const LogString& name, const LogString& option);
+ /**
+ * Private constructor.
+ * @param options options, may be null.
+ * @param logger logger for diagnostic messages, may be null.
+ */
+ PropertiesPatternConverter(const LogString& name, const LogString& option);
- public:
- DECLARE_LOG4CXX_PATTERN(PropertiesPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(PropertiesPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(PropertiesPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(PropertiesPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of PropertiesPatternConverter.
- * @param options options, may be null or first element contains name of property to format.
- * @return instance of PropertiesPatternConverter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of PropertiesPatternConverter.
+ * @param options options, may be null or first element contains name of property to format.
+ * @return instance of PropertiesPatternConverter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/relativetimepatternconverter.h b/src/main/include/log4cxx/pattern/relativetimepatternconverter.h
index b4313f2..2e02bc7 100644
--- a/src/main/include/log4cxx/pattern/relativetimepatternconverter.h
+++ b/src/main/include/log4cxx/pattern/relativetimepatternconverter.h
@@ -34,32 +34,32 @@
*/
class LOG4CXX_EXPORT RelativeTimePatternConverter : public LoggingEventPatternConverter
{
- public:
- DECLARE_LOG4CXX_PATTERN(RelativeTimePatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RelativeTimePatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(RelativeTimePatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RelativeTimePatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Private constructor.
- */
- RelativeTimePatternConverter();
+ /**
+ * Private constructor.
+ */
+ RelativeTimePatternConverter();
- /**
- * Obtains an instance of RelativeTimePatternConverter.
- * @param options options, currently ignored, may be null.
- * @return instance of RelativeTimePatternConverter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of RelativeTimePatternConverter.
+ * @param options options, currently ignored, may be null.
+ * @return instance of RelativeTimePatternConverter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/threadpatternconverter.h b/src/main/include/log4cxx/pattern/threadpatternconverter.h
index 9e342b2..a9ebf8b 100644
--- a/src/main/include/log4cxx/pattern/threadpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/threadpatternconverter.h
@@ -34,31 +34,31 @@
*/
class LOG4CXX_EXPORT ThreadPatternConverter : public LoggingEventPatternConverter
{
- /**
- * Private constructor.
- */
- ThreadPatternConverter();
+ /**
+ * Private constructor.
+ */
+ ThreadPatternConverter();
- public:
- DECLARE_LOG4CXX_PATTERN(ThreadPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ThreadPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(ThreadPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ThreadPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Obtains an instance of ThreadPatternConverter.
- * @param options options, currently ignored, may be null.
- * @return instance of ThreadPatternConverter.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Obtains an instance of ThreadPatternConverter.
+ * @param options options, currently ignored, may be null.
+ * @return instance of ThreadPatternConverter.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
};
}
}
diff --git a/src/main/include/log4cxx/pattern/throwableinformationpatternconverter.h b/src/main/include/log4cxx/pattern/throwableinformationpatternconverter.h
index 993b046..8599382 100644
--- a/src/main/include/log4cxx/pattern/throwableinformationpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/throwableinformationpatternconverter.h
@@ -35,46 +35,46 @@
*
*/
class LOG4CXX_EXPORT ThrowableInformationPatternConverter
- : public LoggingEventPatternConverter
+ : public LoggingEventPatternConverter
{
- /**
- * If "short", only first line of throwable report will be formatted.
- */
- const bool shortReport;
+ /**
+ * If "short", only first line of throwable report will be formatted.
+ */
+ const bool shortReport;
- /**
- * Private constructor.
- */
- ThrowableInformationPatternConverter(bool shortReport);
+ /**
+ * Private constructor.
+ */
+ ThrowableInformationPatternConverter(bool shortReport);
- public:
- DECLARE_LOG4CXX_PATTERN(ThrowableInformationPatternConverter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ThrowableInformationPatternConverter)
- LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_PATTERN(ThrowableInformationPatternConverter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ThrowableInformationPatternConverter)
+ LOG4CXX_CAST_ENTRY_CHAIN(LoggingEventPatternConverter)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Gets an instance of the class.
- * @param options pattern options, may be null. If first element is "short",
- * only the first line of the throwable will be formatted.
- * @return instance of class.
- */
- static PatternConverterPtr newInstance(
- const std::vector<LogString>& options);
+ /**
+ * Gets an instance of the class.
+ * @param options pattern options, may be null. If first element is "short",
+ * only the first line of the throwable will be formatted.
+ * @return instance of class.
+ */
+ static PatternConverterPtr newInstance(
+ const std::vector<LogString>& options);
- using LoggingEventPatternConverter::format;
+ using LoggingEventPatternConverter::format;
- void format(const log4cxx::spi::LoggingEventPtr& event,
- LogString& toAppendTo,
- log4cxx::helpers::Pool& p) const;
+ void format(const log4cxx::spi::LoggingEventPtr& event,
+ LogString& toAppendTo,
+ log4cxx::helpers::Pool& p) const;
- /**
- * This converter obviously handles throwables.
- * @return true.
- */
- bool handlesThrowable() const;
+ /**
+ * This converter obviously handles throwables.
+ * @return true.
+ */
+ bool handlesThrowable() const;
};
}
}
diff --git a/src/main/include/log4cxx/patternlayout.h b/src/main/include/log4cxx/patternlayout.h
index 2cec7de..f722b5e 100644
--- a/src/main/include/log4cxx/patternlayout.h
+++ b/src/main/include/log4cxx/patternlayout.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_PATTERN_LAYOUT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/layout.h>
@@ -333,86 +333,86 @@
*/
class LOG4CXX_EXPORT PatternLayout : public Layout
{
- /**
- * Conversion pattern.
- */
- LogString conversionPattern;
+ /**
+ * Conversion pattern.
+ */
+ LogString conversionPattern;
- /**
- * Pattern converters.
- */
- LoggingEventPatternConverterList patternConverters;
+ /**
+ * Pattern converters.
+ */
+ LoggingEventPatternConverterList patternConverters;
- /**
- * Field widths and alignment corresponding to pattern converters.
- */
- FormattingInfoList patternFields;
+ /**
+ * Field widths and alignment corresponding to pattern converters.
+ */
+ FormattingInfoList patternFields;
- public:
- DECLARE_LOG4CXX_OBJECT(PatternLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(PatternLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(PatternLayout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(PatternLayout)
+ LOG4CXX_CAST_ENTRY_CHAIN(Layout)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Does nothing
- */
- PatternLayout();
+ /**
+ * Does nothing
+ */
+ PatternLayout();
- /**
- * Constructs a PatternLayout using the supplied conversion pattern.
- */
- PatternLayout(const LogString& pattern);
+ /**
+ * Constructs a PatternLayout using the supplied conversion pattern.
+ */
+ PatternLayout(const LogString& pattern);
- /**
- * Set the <strong>ConversionPattern</strong> option. This is the string which
- * controls formatting and consists of a mix of literal content and
- * conversion specifiers.
- */
- void setConversionPattern(const LogString& conversionPattern);
+ /**
+ * Set the <strong>ConversionPattern</strong> option. This is the string which
+ * controls formatting and consists of a mix of literal content and
+ * conversion specifiers.
+ */
+ void setConversionPattern(const LogString& conversionPattern);
- /**
- * Returns the value of the <strong>ConversionPattern</strong> option.
- */
- inline LogString getConversionPattern() const
- {
- return conversionPattern;
- }
+ /**
+ * Returns the value of the <strong>ConversionPattern</strong> option.
+ */
+ inline LogString getConversionPattern() const
+ {
+ return conversionPattern;
+ }
- /**
- * Call createPatternParser
- */
- virtual void activateOptions(log4cxx::helpers::Pool& p);
+ /**
+ * Call createPatternParser
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& p);
- virtual void setOption(const LogString& option, const LogString& value);
+ virtual void setOption(const LogString& option, const LogString& value);
- /**
- * The PatternLayout does not handle the throwable contained within
- * {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
- * <code>true</code>.
- */
- virtual bool ignoresThrowable() const
- {
- return true;
- }
+ /**
+ * The PatternLayout does not handle the throwable contained within
+ * {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
+ * <code>true</code>.
+ */
+ virtual bool ignoresThrowable() const
+ {
+ return true;
+ }
- /**
- * Produces a formatted string as specified by the conversion pattern.
- */
- virtual void format( LogString& output,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& pool) const;
+ /**
+ * Produces a formatted string as specified by the conversion pattern.
+ */
+ virtual void format( LogString& output,
+ const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& pool) const;
- protected:
- virtual log4cxx::pattern::PatternMap getFormatSpecifiers();
+ protected:
+ virtual log4cxx::pattern::PatternMap getFormatSpecifiers();
};
LOG4CXX_PTR_DEF(PatternLayout);
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_PATTERN_LAYOUT_H
diff --git a/src/main/include/log4cxx/propertyconfigurator.h b/src/main/include/log4cxx/propertyconfigurator.h
index bc952cd..d4611fe 100644
--- a/src/main/include/log4cxx/propertyconfigurator.h
+++ b/src/main/include/log4cxx/propertyconfigurator.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_PROPERTY_CONFIGURATOR_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -91,307 +91,307 @@
<code>/home/xyz</code>.
*/
class LOG4CXX_EXPORT PropertyConfigurator :
- virtual public spi::Configurator,
- virtual public helpers::ObjectImpl
+ virtual public spi::Configurator,
+ virtual public helpers::ObjectImpl
{
- protected:
+ protected:
- /**
- Used internally to keep track of configured appenders.
- */
- std::map<LogString, AppenderPtr>* registry;
+ /**
+ Used internally to keep track of configured appenders.
+ */
+ std::map<LogString, AppenderPtr>* registry;
- /**
- Used to create new instances of logger
- */
- helpers::ObjectPtrT<spi::LoggerFactory> loggerFactory;
+ /**
+ Used to create new instances of logger
+ */
+ helpers::ObjectPtrT<spi::LoggerFactory> loggerFactory;
- public:
- DECLARE_LOG4CXX_OBJECT(PropertyConfigurator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(spi::Configurator)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(PropertyConfigurator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(spi::Configurator)
+ END_LOG4CXX_CAST_MAP()
- PropertyConfigurator();
- virtual ~PropertyConfigurator();
- void addRef() const;
- void releaseRef() const;
+ PropertyConfigurator();
+ virtual ~PropertyConfigurator();
+ void addRef() const;
+ void releaseRef() const;
- /**
- Read configuration from a file. <b>The existing configuration is
- not cleared nor reset.</b> If you require a different behavior,
- then call {@link LogManager#resetConfiguration
- resetConfiguration} method before calling
- <code>doConfigure</code>.
+ /**
+ Read configuration from a file. <b>The existing configuration is
+ not cleared nor reset.</b> If you require a different behavior,
+ then call {@link LogManager#resetConfiguration
+ resetConfiguration} method before calling
+ <code>doConfigure</code>.
- <p>The configuration file consists of statements in the format
- <code>key=value</code>. The syntax of different configuration
- elements are discussed below.
+ <p>The configuration file consists of statements in the format
+ <code>key=value</code>. The syntax of different configuration
+ elements are discussed below.
- <h3>Repository-wide threshold</h3>
+ <h3>Repository-wide threshold</h3>
- <p>The repository-wide threshold filters logging requests by level
- regardless of logger. The syntax is:
+ <p>The repository-wide threshold filters logging requests by level
+ regardless of logger. The syntax is:
- <pre>
- log4j.threshold=[level]
- </pre>
+ <pre>
+ log4j.threshold=[level]
+ </pre>
- <p>The level value can consist of the string values OFF, FATAL,
- ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</em> value. A
- custom level value can be specified in the form
- level#classname. By default the repository-wide threshold is set
- to the lowest possible value, namely the level <code>ALL</code>.
- </p>
+ <p>The level value can consist of the string values OFF, FATAL,
+ ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</em> value. A
+ custom level value can be specified in the form
+ level#classname. By default the repository-wide threshold is set
+ to the lowest possible value, namely the level <code>ALL</code>.
+ </p>
- <h3>Appender configuration</h3>
+ <h3>Appender configuration</h3>
- <p>Appender configuration syntax is:
- <pre>
- # For appender named <i>appenderName</i>, set its class.
- # Note: The appender name can contain dots.
- log4j.appender.appenderName=fully.qualified.name.of.appender.class
+ <p>Appender configuration syntax is:
+ <pre>
+ # For appender named <i>appenderName</i>, set its class.
+ # Note: The appender name can contain dots.
+ log4j.appender.appenderName=fully.qualified.name.of.appender.class
- # Set appender specific options.
- log4j.appender.appenderName.option1=value1
- ...
- log4j.appender.appenderName.optionN=valueN
- </pre>
+ # Set appender specific options.
+ log4j.appender.appenderName.option1=value1
+ ...
+ log4j.appender.appenderName.optionN=valueN
+ </pre>
- For each named appender you can configure its {@link Layout Layout}. The
- syntax for configuring an appender's layout is:
- <pre>
- log4j.appender.appenderName.layout=fully.qualified.name.of.layout.class
- log4j.appender.appenderName.layout.option1=value1
- ....
- log4j.appender.appenderName.layout.optionN=valueN
- </pre>
+ For each named appender you can configure its {@link Layout Layout}. The
+ syntax for configuring an appender's layout is:
+ <pre>
+ log4j.appender.appenderName.layout=fully.qualified.name.of.layout.class
+ log4j.appender.appenderName.layout.option1=value1
+ ....
+ log4j.appender.appenderName.layout.optionN=valueN
+ </pre>
- <h3>Configuring loggers</h3>
+ <h3>Configuring loggers</h3>
- <p>The syntax for configuring the root logger is:
- <pre>
- log4j.rootLogger=[level], appenderName, appenderName, ...
- </pre>
+ <p>The syntax for configuring the root logger is:
+ <pre>
+ log4j.rootLogger=[level], appenderName, appenderName, ...
+ </pre>
- <p>This syntax means that an optional <em>level</em> can be
- supplied followed by appender names separated by commas.
+ <p>This syntax means that an optional <em>level</em> can be
+ supplied followed by appender names separated by commas.
- <p>The level value can consist of the string values OFF, FATAL,
- ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</em> value. A
- custom level value can be specified in the form
- <code>level#classname</code>.
+ <p>The level value can consist of the string values OFF, FATAL,
+ ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</em> value. A
+ custom level value can be specified in the form
+ <code>level#classname</code>.
- <p>If a level value is specified, then the root level is set
- to the corresponding level. If no level value is specified,
- then the root level remains untouched.
+ <p>If a level value is specified, then the root level is set
+ to the corresponding level. If no level value is specified,
+ then the root level remains untouched.
- <p>The root logger can be assigned multiple appenders.
+ <p>The root logger can be assigned multiple appenders.
- <p>Each <i>appenderName</i> (separated by commas) will be added to
- the root logger. The named appender is defined using the
- appender syntax defined above.
+ <p>Each <i>appenderName</i> (separated by commas) will be added to
+ the root logger. The named appender is defined using the
+ appender syntax defined above.
- <p>For non-root categories the syntax is almost the same:
- <pre>
- log4j.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName,
- ...
- </pre>
+ <p>For non-root categories the syntax is almost the same:
+ <pre>
+ log4j.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName,
+ ...
+ </pre>
- <p>The meaning of the optional level value is discussed above
- in relation to the root logger. In addition however, the value
- INHERITED can be specified meaning that the named logger should
- inherit its level from the logger hierarchy.
+ <p>The meaning of the optional level value is discussed above
+ in relation to the root logger. In addition however, the value
+ INHERITED can be specified meaning that the named logger should
+ inherit its level from the logger hierarchy.
- <p>If no level value is supplied, then the level of the
- named logger remains untouched.
+ <p>If no level value is supplied, then the level of the
+ named logger remains untouched.
- <p>By default categories inherit their level from the
- hierarchy. However, if you set the level of a logger and later
- decide that that logger should inherit its level, then you should
- specify INHERITED as the value for the level value. NULL is a
- synonym for INHERITED.
+ <p>By default categories inherit their level from the
+ hierarchy. However, if you set the level of a logger and later
+ decide that that logger should inherit its level, then you should
+ specify INHERITED as the value for the level value. NULL is a
+ synonym for INHERITED.
- <p>Similar to the root logger syntax, each <i>appenderName</i>
- (separated by commas) will be attached to the named logger.
+ <p>Similar to the root logger syntax, each <i>appenderName</i>
+ (separated by commas) will be attached to the named logger.
- <p>See the <a href="Introduction.html#additivity">appender
- additivity rule</a> in the user manual for the meaning of the
- <code>additivity</code> flag.
+ <p>See the <a href="Introduction.html#additivity">appender
+ additivity rule</a> in the user manual for the meaning of the
+ <code>additivity</code> flag.
- <h3>Logger Factories</h3>
+ <h3>Logger Factories</h3>
- The usage of custom logger factories is discouraged and no longer
- documented.
+ The usage of custom logger factories is discouraged and no longer
+ documented.
- <h3>Example</h3>
+ <h3>Example</h3>
- <p>An example configuration is given below. Other configuration
- file examples are given in the <code>examples</code> folder.
+ <p>An example configuration is given below. Other configuration
+ file examples are given in the <code>examples</code> folder.
- <pre>
+ <pre>
- # Set options for appender named "A1".
- # Appender "A1" will be a SyslogAppender
- log4j.appender.A1=SyslogAppender
+ # Set options for appender named "A1".
+ # Appender "A1" will be a SyslogAppender
+ log4j.appender.A1=SyslogAppender
- # The syslog daemon resides on www.abc.net
- log4j.appender.A1.SyslogHost=www.abc.net
+ # The syslog daemon resides on www.abc.net
+ log4j.appender.A1.SyslogHost=www.abc.net
- # A1's layout is a PatternLayout, using the conversion pattern
- # <b>%r %-5p %c{2} %M.%L %x - %m\n</b>. Thus, the log output will
- # include # the relative time since the start of the application in
- # milliseconds, followed by the level of the log request,
- # followed by the two rightmost components of the logger name,
- # followed by the callers method name, followed by the line number,
- # the nested disgnostic context and finally the message itself.
- # Refer to the documentation of PatternLayout for further information
- # on the syntax of the ConversionPattern key.
- log4j.appender.A1.layout=PatternLayout
- log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
+ # A1's layout is a PatternLayout, using the conversion pattern
+ # <b>%r %-5p %c{2} %M.%L %x - %m\n</b>. Thus, the log output will
+ # include # the relative time since the start of the application in
+ # milliseconds, followed by the level of the log request,
+ # followed by the two rightmost components of the logger name,
+ # followed by the callers method name, followed by the line number,
+ # the nested disgnostic context and finally the message itself.
+ # Refer to the documentation of PatternLayout for further information
+ # on the syntax of the ConversionPattern key.
+ log4j.appender.A1.layout=PatternLayout
+ log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
- # Set options for appender named "A2"
- # A2 should be a RollingFileAppender, with maximum file size of 10 MB
- # using at most one backup file. A2's layout is TTCC, using the
- # ISO8061 date format with context printing enabled.
- log4j.appender.A2=RollingFileAppender
- log4j.appender.A2.MaxFileSize=10MB
- log4j.appender.A2.MaxBackupIndex=1
- log4j.appender.A2.layout=TTCCLayout
- log4j.appender.A2.layout.ContextPrinting=enabled
- log4j.appender.A2.layout.DateFormat=ISO8601
+ # Set options for appender named "A2"
+ # A2 should be a RollingFileAppender, with maximum file size of 10 MB
+ # using at most one backup file. A2's layout is TTCC, using the
+ # ISO8061 date format with context printing enabled.
+ log4j.appender.A2=RollingFileAppender
+ log4j.appender.A2.MaxFileSize=10MB
+ log4j.appender.A2.MaxBackupIndex=1
+ log4j.appender.A2.layout=TTCCLayout
+ log4j.appender.A2.layout.ContextPrinting=enabled
+ log4j.appender.A2.layout.DateFormat=ISO8601
- # Root logger set to DEBUG using the A2 appender defined above.
- log4j.rootLogger=DEBUG, A2
+ # Root logger set to DEBUG using the A2 appender defined above.
+ log4j.rootLogger=DEBUG, A2
- # Logger definitions:
- # The SECURITY logger inherits is level from root. However, it's output
- # will go to A1 appender defined above. It's additivity is non-cumulative.
- log4j.logger.SECURITY=INHERIT, A1
- log4j.additivity.SECURITY=false
+ # Logger definitions:
+ # The SECURITY logger inherits is level from root. However, it's output
+ # will go to A1 appender defined above. It's additivity is non-cumulative.
+ log4j.logger.SECURITY=INHERIT, A1
+ log4j.additivity.SECURITY=false
- # Only warnings or above will be logged for the logger "SECURITY.access".
- # Output will go to A1.
- log4j.logger.SECURITY.access=WARN
+ # Only warnings or above will be logged for the logger "SECURITY.access".
+ # Output will go to A1.
+ log4j.logger.SECURITY.access=WARN
- # The logger "class.of.the.day" inherits its level from the
- # logger hierarchy. Output will go to the appender's of the root
- # logger, A2 in this case.
- log4j.logger.class.of.the.day=INHERIT
- </pre>
+ # The logger "class.of.the.day" inherits its level from the
+ # logger hierarchy. Output will go to the appender's of the root
+ # logger, A2 in this case.
+ log4j.logger.class.of.the.day=INHERIT
+ </pre>
- <p>Refer to the <b>setOption</b> method in each Appender and
- Layout for class specific options.
+ <p>Refer to the <b>setOption</b> method in each Appender and
+ Layout for class specific options.
- <p>Use the <code>#</code> or <code>!</code> characters at the
- beginning of a line for comments.
+ <p>Use the <code>#</code> or <code>!</code> characters at the
+ beginning of a line for comments.
- <p>
- @param configFileName The name of the configuration file where the
- configuration information is stored.
- @param hierarchy The hierarchy to operation upon.
- */
- void doConfigure(const File& configFileName,
- spi::LoggerRepositoryPtr& hierarchy);
+ <p>
+ @param configFileName The name of the configuration file where the
+ configuration information is stored.
+ @param hierarchy The hierarchy to operation upon.
+ */
+ void doConfigure(const File& configFileName,
+ spi::LoggerRepositoryPtr& hierarchy);
- /**
- Read configuration options from file <code>configFilename</code>.
- */
- static void configure(const File& configFilename);
+ /**
+ Read configuration options from file <code>configFilename</code>.
+ */
+ static void configure(const File& configFilename);
- /**
- Like {@link #configureAndWatch(const File& configFilename, long delay)}
- except that the
- default delay as defined by helpers::FileWatchdog#DEFAULT_DELAY
- is used.
- @param configFilename A file in key=value format.
- */
- static void configureAndWatch(const File& configFilename);
+ /**
+ Like {@link #configureAndWatch(const File& configFilename, long delay)}
+ except that the
+ default delay as defined by helpers::FileWatchdog#DEFAULT_DELAY
+ is used.
+ @param configFilename A file in key=value format.
+ */
+ static void configureAndWatch(const File& configFilename);
- /**
- Read the configuration file <code>configFilename</code> if it
- exists. Moreover, a thread will be created that will periodically
- check if <code>configFilename</code> has been created or
- modified. The period is determined by the <code>delay</code>
- argument. If a change or file creation is detected, then
- <code>configFilename</code> is read to configure log4j.
+ /**
+ Read the configuration file <code>configFilename</code> if it
+ exists. Moreover, a thread will be created that will periodically
+ check if <code>configFilename</code> has been created or
+ modified. The period is determined by the <code>delay</code>
+ argument. If a change or file creation is detected, then
+ <code>configFilename</code> is read to configure log4j.
- @param configFilename A file in key=value format.
- @param delay The delay in milliseconds to wait between each check.
- */
- static void configureAndWatch(const File& configFilename,
- long delay);
+ @param configFilename A file in key=value format.
+ @param delay The delay in milliseconds to wait between each check.
+ */
+ static void configureAndWatch(const File& configFilename,
+ long delay);
- /**
- Read configuration options from <code>properties</code>.
- See #doConfigure(const File&, log4cxx::spi::LoggerRepositoryPtr&)
- for the expected format.
- */
- static void configure(helpers::Properties& properties);
+ /**
+ Read configuration options from <code>properties</code>.
+ See #doConfigure(const File&, log4cxx::spi::LoggerRepositoryPtr&)
+ for the expected format.
+ */
+ static void configure(helpers::Properties& properties);
- /**
- Read configuration options from <code>properties</code>.
- See #doConfigure(const File&, log4cxx::spi::LoggerRepositoryPtr&)
- for the expected format.
- */
- void doConfigure(helpers::Properties& properties,
- spi::LoggerRepositoryPtr& hierarchy);
+ /**
+ Read configuration options from <code>properties</code>.
+ See #doConfigure(const File&, log4cxx::spi::LoggerRepositoryPtr&)
+ for the expected format.
+ */
+ void doConfigure(helpers::Properties& properties,
+ spi::LoggerRepositoryPtr& hierarchy);
- // --------------------------------------------------------------------------
- // Internal stuff
- // --------------------------------------------------------------------------
- protected:
- /**
- Check the provided <code>Properties</code> object for a
- #loggerFactory
- entry specified by LOGGER_FACTORY_KEY. If such an entry
- exists, an attempt is made to create an instance using the default
- constructor. This instance is used for subsequent Logger creations
- within this configurator.
- @see #parseCatsAndRenderers
- */
- void configureLoggerFactory(helpers::Properties& props);
+ // --------------------------------------------------------------------------
+ // Internal stuff
+ // --------------------------------------------------------------------------
+ protected:
+ /**
+ Check the provided <code>Properties</code> object for a
+ #loggerFactory
+ entry specified by LOGGER_FACTORY_KEY. If such an entry
+ exists, an attempt is made to create an instance using the default
+ constructor. This instance is used for subsequent Logger creations
+ within this configurator.
+ @see #parseCatsAndRenderers
+ */
+ void configureLoggerFactory(helpers::Properties& props);
- void configureRootLogger(helpers::Properties& props,
- spi::LoggerRepositoryPtr& hierarchy);
+ void configureRootLogger(helpers::Properties& props,
+ spi::LoggerRepositoryPtr& hierarchy);
- /**
- Parse non-root elements, such non-root categories and renderers.
- */
- void parseCatsAndRenderers(helpers::Properties& props,
- spi::LoggerRepositoryPtr& hierarchy);
+ /**
+ Parse non-root elements, such non-root categories and renderers.
+ */
+ void parseCatsAndRenderers(helpers::Properties& props,
+ spi::LoggerRepositoryPtr& hierarchy);
- /**
- Parse the additivity option for a non-root logger.
- */
- void parseAdditivityForLogger(helpers::Properties& props,
- LoggerPtr& cat, const LogString& loggerName);
+ /**
+ Parse the additivity option for a non-root logger.
+ */
+ void parseAdditivityForLogger(helpers::Properties& props,
+ LoggerPtr& cat, const LogString& loggerName);
- /**
- This method must work for the root logger as well.
- */
- void parseLogger(
- helpers::Properties& props, LoggerPtr& logger,
- const LogString& optionKey, const LogString& loggerName,
- const LogString& value);
+ /**
+ This method must work for the root logger as well.
+ */
+ void parseLogger(
+ helpers::Properties& props, LoggerPtr& logger,
+ const LogString& optionKey, const LogString& loggerName,
+ const LogString& value);
- AppenderPtr parseAppender(
- helpers::Properties& props, const LogString& appenderName);
+ AppenderPtr parseAppender(
+ helpers::Properties& props, const LogString& appenderName);
- void registryPut(const AppenderPtr& appender);
- AppenderPtr registryGet(const LogString& name);
+ void registryPut(const AppenderPtr& appender);
+ AppenderPtr registryGet(const LogString& name);
- private:
- PropertyConfigurator(const PropertyConfigurator&);
- PropertyConfigurator& operator=(const PropertyConfigurator&);
- static PropertyWatchdog* pdog;
+ private:
+ PropertyConfigurator(const PropertyConfigurator&);
+ PropertyConfigurator& operator=(const PropertyConfigurator&);
+ static PropertyWatchdog* pdog;
}; // class PropertyConfigurator
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/rolling/action.h b/src/main/include/log4cxx/rolling/action.h
index 0dec165..7c4f4c7 100644
--- a/src/main/include/log4cxx/rolling/action.h
+++ b/src/main/include/log4cxx/rolling/action.h
@@ -34,50 +34,50 @@
*/
class Action : public virtual log4cxx::helpers::ObjectImpl
{
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Action)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Action)
- END_LOG4CXX_CAST_MAP()
- /**
- * Is action complete.
- */
- bool complete;
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Action)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Action)
+ END_LOG4CXX_CAST_MAP()
+ /**
+ * Is action complete.
+ */
+ bool complete;
- /**
- * Is action interrupted.
- */
- bool interrupted;
+ /**
+ * Is action interrupted.
+ */
+ bool interrupted;
- log4cxx::helpers::Pool pool;
- log4cxx::helpers::Mutex mutex;
+ log4cxx::helpers::Pool pool;
+ log4cxx::helpers::Mutex mutex;
- protected:
- /**
- * Constructor.
- */
- Action();
- virtual ~Action();
+ protected:
+ /**
+ * Constructor.
+ */
+ Action();
+ virtual ~Action();
- public:
- /**
- * Perform action.
- *
- * @return true if successful.
- */
- virtual bool execute(log4cxx::helpers::Pool& pool) const = 0;
+ public:
+ /**
+ * Perform action.
+ *
+ * @return true if successful.
+ */
+ virtual bool execute(log4cxx::helpers::Pool& pool) const = 0;
- void run(log4cxx::helpers::Pool& pool);
+ void run(log4cxx::helpers::Pool& pool);
- void close();
+ void close();
- /**
- * Tests if the action is complete.
- * @return true if action is complete.
- */
- bool isComplete() const;
+ /**
+ * Tests if the action is complete.
+ * @return true if action is complete.
+ */
+ bool isComplete() const;
- void reportException(const std::exception&);
+ void reportException(const std::exception&);
};
diff --git a/src/main/include/log4cxx/rolling/filerenameaction.h b/src/main/include/log4cxx/rolling/filerenameaction.h
index f0605dc..53338a0 100644
--- a/src/main/include/log4cxx/rolling/filerenameaction.h
+++ b/src/main/include/log4cxx/rolling/filerenameaction.h
@@ -29,29 +29,29 @@
class FileRenameAction : public Action
{
- const File source;
- const File destination;
- bool renameEmptyFile;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileRenameAction)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FileRenameAction)
- LOG4CXX_CAST_ENTRY_CHAIN(Action)
- END_LOG4CXX_CAST_MAP()
+ const File source;
+ const File destination;
+ bool renameEmptyFile;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileRenameAction)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FileRenameAction)
+ LOG4CXX_CAST_ENTRY_CHAIN(Action)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Constructor.
- */
- FileRenameAction(const File& toRename,
- const File& renameTo,
- bool renameEmptyFile);
+ /**
+ * Constructor.
+ */
+ FileRenameAction(const File& toRename,
+ const File& renameTo,
+ bool renameEmptyFile);
- /**
- * Perform action.
- *
- * @return true if successful.
- */
- virtual bool execute(log4cxx::helpers::Pool& pool) const;
+ /**
+ * Perform action.
+ *
+ * @return true if successful.
+ */
+ virtual bool execute(log4cxx::helpers::Pool& pool) const;
};
LOG4CXX_PTR_DEF(FileRenameAction);
diff --git a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
index f8024b5..1b910ec 100644
--- a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
@@ -48,70 +48,70 @@
class LOG4CXX_EXPORT FilterBasedTriggeringPolicy : public TriggeringPolicy
{
- DECLARE_LOG4CXX_OBJECT(FilterBasedTriggeringPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FilterBasedTriggeringPolicy)
- LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(FilterBasedTriggeringPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FilterBasedTriggeringPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
- /**
- * The first filter in the filter chain. Set to <code>null</code> initially.
- */
- log4cxx::spi::FilterPtr headFilter;
+ /**
+ * The first filter in the filter chain. Set to <code>null</code> initially.
+ */
+ log4cxx::spi::FilterPtr headFilter;
- /**
- * The last filter in the filter chain.
- */
- log4cxx::spi::FilterPtr tailFilter;
+ /**
+ * The last filter in the filter chain.
+ */
+ log4cxx::spi::FilterPtr tailFilter;
- public:
- /**
- * Creates a new FilterBasedTriggeringPolicy.
- */
- FilterBasedTriggeringPolicy();
- virtual ~FilterBasedTriggeringPolicy();
+ public:
+ /**
+ * Creates a new FilterBasedTriggeringPolicy.
+ */
+ FilterBasedTriggeringPolicy();
+ virtual ~FilterBasedTriggeringPolicy();
- /**
- * Determines if a rollover may be appropriate at this time. If
- * true is returned, RolloverPolicy.rollover will be called but it
- * can determine that a rollover is not warranted.
- *
- * @param appender A reference to the appender.
- * @param event A reference to the currently event.
- * @param filename The filename for the currently active log file.
- * @param fileLength Length of the file in bytes.
- * @return true if a rollover should occur.
- */
- virtual bool isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& filename,
- size_t fileLength);
+ /**
+ * Determines if a rollover may be appropriate at this time. If
+ * true is returned, RolloverPolicy.rollover will be called but it
+ * can determine that a rollover is not warranted.
+ *
+ * @param appender A reference to the appender.
+ * @param event A reference to the currently event.
+ * @param filename The filename for the currently active log file.
+ * @param fileLength Length of the file in bytes.
+ * @return true if a rollover should occur.
+ */
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
- /**
- * Add a filter to end of the filter list.
- * @param newFilter filter to add to end of list.
- */
- void addFilter(const log4cxx::spi::FilterPtr& newFilter);
+ /**
+ * Add a filter to end of the filter list.
+ * @param newFilter filter to add to end of list.
+ */
+ void addFilter(const log4cxx::spi::FilterPtr& newFilter);
- /**
- * Clear the filters chain.
- *
- */
- void clearFilters();
+ /**
+ * Clear the filters chain.
+ *
+ */
+ void clearFilters();
- /**
- * Returns the head Filter.
- *
- */
- log4cxx::spi::FilterPtr& getFilter();
+ /**
+ * Returns the head Filter.
+ *
+ */
+ log4cxx::spi::FilterPtr& getFilter();
- /**
- * Prepares the instance for use.
- */
- void activateOptions(log4cxx::helpers::Pool&);
+ /**
+ * Prepares the instance for use.
+ */
+ void activateOptions(log4cxx::helpers::Pool&);
- void setOption(const LogString& option, const LogString& value);
+ void setOption(const LogString& option, const LogString& value);
};
LOG4CXX_PTR_DEF(FilterBasedTriggeringPolicy);
diff --git a/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h b/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
index e7d4936..35b5c7b 100644
--- a/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/fixedwindowrollingpolicy.h
@@ -70,58 +70,58 @@
* */
class LOG4CXX_EXPORT FixedWindowRollingPolicy : public RollingPolicyBase
{
- DECLARE_LOG4CXX_OBJECT(FixedWindowRollingPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FixedWindowRollingPolicy)
- LOG4CXX_CAST_ENTRY_CHAIN(RollingPolicyBase)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(FixedWindowRollingPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FixedWindowRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(RollingPolicyBase)
+ END_LOG4CXX_CAST_MAP()
- int minIndex;
- int maxIndex;
- bool explicitActiveFile;
+ int minIndex;
+ int maxIndex;
+ bool explicitActiveFile;
- /**
- * It's almost always a bad idea to have a large window size, say over 12.
- */
- enum { MAX_WINDOW_SIZE = 12 };
+ /**
+ * It's almost always a bad idea to have a large window size, say over 12.
+ */
+ enum { MAX_WINDOW_SIZE = 12 };
- bool purge(int purgeStart, int maxIndex, log4cxx::helpers::Pool& p) const;
+ bool purge(int purgeStart, int maxIndex, log4cxx::helpers::Pool& p) const;
- public:
+ public:
- FixedWindowRollingPolicy();
+ FixedWindowRollingPolicy();
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option,
- const LogString& value);
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option,
+ const LogString& value);
- void rollover();
+ void rollover();
- int getMaxIndex() const;
+ int getMaxIndex() const;
- int getMinIndex() const;
+ int getMinIndex() const;
- void setMaxIndex(int newVal);
- void setMinIndex(int newVal);
+ void setMaxIndex(int newVal);
+ void setMinIndex(int newVal);
- /**
- * {@inheritDoc}
- */
- RolloverDescriptionPtr initialize(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool);
+ /**
+ * {@inheritDoc}
+ */
+ RolloverDescriptionPtr initialize(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
- /**
- * {@inheritDoc}
- */
- RolloverDescriptionPtr rollover(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool);
+ /**
+ * {@inheritDoc}
+ */
+ RolloverDescriptionPtr rollover(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
- protected:
- log4cxx::pattern::PatternMap getFormatSpecifiers() const;
+ protected:
+ log4cxx::pattern::PatternMap getFormatSpecifiers() const;
};
diff --git a/src/main/include/log4cxx/rolling/gzcompressaction.h b/src/main/include/log4cxx/rolling/gzcompressaction.h
index 38a9561..0b99f36 100644
--- a/src/main/include/log4cxx/rolling/gzcompressaction.h
+++ b/src/main/include/log4cxx/rolling/gzcompressaction.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_ROLLING_GZ_COMPRESS_ACTION_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/rolling/action.h>
@@ -34,33 +34,33 @@
class GZCompressAction : public Action
{
- const File source;
- const File destination;
- bool deleteSource;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(GZCompressAction)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(GZCompressAction)
- LOG4CXX_CAST_ENTRY_CHAIN(Action)
- END_LOG4CXX_CAST_MAP()
+ const File source;
+ const File destination;
+ bool deleteSource;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(GZCompressAction)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(GZCompressAction)
+ LOG4CXX_CAST_ENTRY_CHAIN(Action)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Constructor.
- */
- GZCompressAction(const File& source,
- const File& destination,
- bool deleteSource);
+ /**
+ * Constructor.
+ */
+ GZCompressAction(const File& source,
+ const File& destination,
+ bool deleteSource);
- /**
- * Perform action.
- *
- * @return true if successful.
- */
- virtual bool execute(log4cxx::helpers::Pool& pool) const;
+ /**
+ * Perform action.
+ *
+ * @return true if successful.
+ */
+ virtual bool execute(log4cxx::helpers::Pool& pool) const;
- private:
- GZCompressAction(const GZCompressAction&);
- GZCompressAction& operator=(const GZCompressAction&);
+ private:
+ GZCompressAction(const GZCompressAction&);
+ GZCompressAction& operator=(const GZCompressAction&);
};
LOG4CXX_PTR_DEF(GZCompressAction);
@@ -69,7 +69,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif
diff --git a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
index bdaf0ca..49122f0 100644
--- a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
@@ -42,33 +42,33 @@
*/
class LOG4CXX_EXPORT ManualTriggeringPolicy : public TriggeringPolicy
{
- DECLARE_LOG4CXX_OBJECT(ManualTriggeringPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ManualTriggeringPolicy)
- LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(ManualTriggeringPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ManualTriggeringPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
- public:
- ManualTriggeringPolicy();
- /**
- * Determines if a rollover may be appropriate at this time. If
- * true is returned, RolloverPolicy.rollover will be called but it
- * can determine that a rollover is not warranted.
- *
- * @param appender A reference to the appender.
- * @param event A reference to the currently event.
- * @param filename The filename for the currently active log file.
- * @param fileLength Length of the file in bytes.
- * @return true if a rollover should occur.
- */
- virtual bool isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& filename,
- size_t fileLength);
+ public:
+ ManualTriggeringPolicy();
+ /**
+ * Determines if a rollover may be appropriate at this time. If
+ * true is returned, RolloverPolicy.rollover will be called but it
+ * can determine that a rollover is not warranted.
+ *
+ * @param appender A reference to the appender.
+ * @param event A reference to the currently event.
+ * @param filename The filename for the currently active log file.
+ * @param fileLength Length of the file in bytes.
+ * @return true if a rollover should occur.
+ */
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
- void activateOptions(log4cxx::helpers::Pool&);
- void setOption(const LogString& option, const LogString& value);
+ void activateOptions(log4cxx::helpers::Pool&);
+ void setOption(const LogString& option, const LogString& value);
};
}
}
diff --git a/src/main/include/log4cxx/rolling/rollingfileappender.h b/src/main/include/log4cxx/rolling/rollingfileappender.h
index 4ccd45a..29ce553 100644
--- a/src/main/include/log4cxx/rolling/rollingfileappender.h
+++ b/src/main/include/log4cxx/rolling/rollingfileappender.h
@@ -74,28 +74,28 @@
* */
class LOG4CXX_EXPORT RollingFileAppender : public RollingFileAppenderSkeleton
{
- DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingFileAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(RollingFileAppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingFileAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(RollingFileAppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- public:
- RollingFileAppender();
+ public:
+ RollingFileAppender();
- using RollingFileAppenderSkeleton::getRollingPolicy;
+ using RollingFileAppenderSkeleton::getRollingPolicy;
- using RollingFileAppenderSkeleton::getTriggeringPolicy;
+ using RollingFileAppenderSkeleton::getTriggeringPolicy;
- /**
- * Sets the rolling policy. In case the 'policy' argument also implements
- * {@link TriggeringPolicy}, then the triggering policy for this appender
- * is automatically set to be the policy argument.
- * @param policy
- */
- using RollingFileAppenderSkeleton::setRollingPolicy;
+ /**
+ * Sets the rolling policy. In case the 'policy' argument also implements
+ * {@link TriggeringPolicy}, then the triggering policy for this appender
+ * is automatically set to be the policy argument.
+ * @param policy
+ */
+ using RollingFileAppenderSkeleton::setRollingPolicy;
- using RollingFileAppenderSkeleton::setTriggeringPolicy;
+ using RollingFileAppenderSkeleton::setTriggeringPolicy;
};
diff --git a/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h b/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h
index 1eb648f..e84f8ef 100644
--- a/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h
+++ b/src/main/include/log4cxx/rolling/rollingfileappenderskeleton.h
@@ -39,132 +39,132 @@
* */
class LOG4CXX_EXPORT RollingFileAppenderSkeleton : public FileAppender
{
- DECLARE_LOG4CXX_OBJECT(RollingFileAppenderSkeleton)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingFileAppenderSkeleton)
- LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(RollingFileAppenderSkeleton)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingFileAppenderSkeleton)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Triggering policy.
- */
- TriggeringPolicyPtr triggeringPolicy;
+ /**
+ * Triggering policy.
+ */
+ TriggeringPolicyPtr triggeringPolicy;
- /**
- * Rolling policy.
- */
- RollingPolicyPtr rollingPolicy;
+ /**
+ * Rolling policy.
+ */
+ RollingPolicyPtr rollingPolicy;
- /**
- * Length of current active log file.
- */
- size_t fileLength;
+ /**
+ * Length of current active log file.
+ */
+ size_t fileLength;
- /**
- * save the loggingevent
- */
- spi::LoggingEventPtr* _event;
- public:
- /**
- * The default constructor simply calls its {@link
- * FileAppender#FileAppender parents constructor}.
- * */
- RollingFileAppenderSkeleton();
+ /**
+ * save the loggingevent
+ */
+ spi::LoggingEventPtr* _event;
+ public:
+ /**
+ * The default constructor simply calls its {@link
+ * FileAppender#FileAppender parents constructor}.
+ * */
+ RollingFileAppenderSkeleton();
- void activateOptions(log4cxx::helpers::Pool&);
+ void activateOptions(log4cxx::helpers::Pool&);
- /**
- Implements the usual roll over behaviour.
+ /**
+ Implements the usual roll over behaviour.
- <p>If <code>MaxBackupIndex</code> is positive, then files
- {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>}
- are renamed to {<code>File.2</code>, ...,
- <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is
- renamed <code>File.1</code> and closed. A new <code>File</code> is
- created to receive further log output.
+ <p>If <code>MaxBackupIndex</code> is positive, then files
+ {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>}
+ are renamed to {<code>File.2</code>, ...,
+ <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is
+ renamed <code>File.1</code> and closed. A new <code>File</code> is
+ created to receive further log output.
- <p>If <code>MaxBackupIndex</code> is equal to zero, then the
- <code>File</code> is truncated with no backup files created.
+ <p>If <code>MaxBackupIndex</code> is equal to zero, then the
+ <code>File</code> is truncated with no backup files created.
- */
- bool rollover(log4cxx::helpers::Pool& p);
+ */
+ bool rollover(log4cxx::helpers::Pool& p);
- protected:
+ protected:
- /**
- Actual writing occurs here.
- */
- virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ /**
+ Actual writing occurs here.
+ */
+ virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- protected:
+ protected:
- RollingPolicyPtr getRollingPolicy() const;
+ RollingPolicyPtr getRollingPolicy() const;
- TriggeringPolicyPtr getTriggeringPolicy() const;
+ TriggeringPolicyPtr getTriggeringPolicy() const;
- /**
- * Sets the rolling policy. In case the 'policy' argument also implements
- * {@link TriggeringPolicy}, then the triggering policy for this appender
- * is automatically set to be the policy argument.
- * @param policy
- */
- void setRollingPolicy(const RollingPolicyPtr& policy);
+ /**
+ * Sets the rolling policy. In case the 'policy' argument also implements
+ * {@link TriggeringPolicy}, then the triggering policy for this appender
+ * is automatically set to be the policy argument.
+ * @param policy
+ */
+ void setRollingPolicy(const RollingPolicyPtr& policy);
- void setTriggeringPolicy(const TriggeringPolicyPtr& policy);
+ void setTriggeringPolicy(const TriggeringPolicyPtr& policy);
- public:
- /**
- * Close appender. Waits for any asynchronous file compression actions to be completed.
- */
- void close();
+ public:
+ /**
+ * Close appender. Waits for any asynchronous file compression actions to be completed.
+ */
+ void close();
- protected:
- /**
- Returns an OutputStreamWriter when passed an OutputStream. The
- encoding used will depend on the value of the
- <code>encoding</code> property. If the encoding value is
- specified incorrectly the writer will be opened using the default
- system encoding (an error message will be printed to the loglog.
- @param os output stream, may not be null.
- @return new writer.
- */
- log4cxx::helpers::WriterPtr createWriter(log4cxx::helpers::OutputStreamPtr& os);
+ protected:
+ /**
+ Returns an OutputStreamWriter when passed an OutputStream. The
+ encoding used will depend on the value of the
+ <code>encoding</code> property. If the encoding value is
+ specified incorrectly the writer will be opened using the default
+ system encoding (an error message will be printed to the loglog.
+ @param os output stream, may not be null.
+ @return new writer.
+ */
+ log4cxx::helpers::WriterPtr createWriter(log4cxx::helpers::OutputStreamPtr& os);
- public:
+ public:
- /**
- * Get byte length of current active log file.
- * @return byte length of current active log file.
- */
- size_t getFileLength() const;
+ /**
+ * Get byte length of current active log file.
+ * @return byte length of current active log file.
+ */
+ size_t getFileLength() const;
#ifdef LOG4CXX_MULTI_PROCESS
- /**
- * Set byte length of current active log file.
- * @return void
- */
- void setFileLength(size_t length);
+ /**
+ * Set byte length of current active log file.
+ * @return void
+ */
+ void setFileLength(size_t length);
- /**
- * Release the file lock
- * @return void
- */
- void releaseFileLock(apr_file_t* lock_file);
- /**
- * re-open the latest file when its own handler has been renamed
- * @return void
- */
- void reopenLatestFile(log4cxx::helpers::Pool& p);
+ /**
+ * Release the file lock
+ * @return void
+ */
+ void releaseFileLock(apr_file_t* lock_file);
+ /**
+ * re-open the latest file when its own handler has been renamed
+ * @return void
+ */
+ void reopenLatestFile(log4cxx::helpers::Pool& p);
#endif
- /**
- * Increments estimated byte length of current active log file.
- * @param increment additional bytes written to log file.
- */
- void incrementFileLength(size_t increment);
+ /**
+ * Increments estimated byte length of current active log file.
+ * @param increment additional bytes written to log file.
+ */
+ void incrementFileLength(size_t increment);
};
diff --git a/src/main/include/log4cxx/rolling/rollingpolicy.h b/src/main/include/log4cxx/rolling/rollingpolicy.h
index dda944f..e5c38f2 100644
--- a/src/main/include/log4cxx/rolling/rollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicy.h
@@ -40,45 +40,45 @@
*
*/
class LOG4CXX_EXPORT RollingPolicy :
- public virtual spi::OptionHandler
+ public virtual spi::OptionHandler
{
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicy)
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicy)
- public:
- virtual ~RollingPolicy() {}
+ public:
+ virtual ~RollingPolicy() {}
- /**
- * Initialize the policy and return any initial actions for rolling file appender.
- *
- * @param currentActiveFile current value of RollingFileAppender.getFile().
- * @param append current value of RollingFileAppender.getAppend().
- * @param pool pool for memory allocations during call.
- * @return Description of the initialization, may be null to indicate
- * no initialization needed.
- * @throws SecurityException if denied access to log files.
- */
- virtual RolloverDescriptionPtr initialize(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool) = 0;
+ /**
+ * Initialize the policy and return any initial actions for rolling file appender.
+ *
+ * @param currentActiveFile current value of RollingFileAppender.getFile().
+ * @param append current value of RollingFileAppender.getAppend().
+ * @param pool pool for memory allocations during call.
+ * @return Description of the initialization, may be null to indicate
+ * no initialization needed.
+ * @throws SecurityException if denied access to log files.
+ */
+ virtual RolloverDescriptionPtr initialize(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool) = 0;
- /**
- * Prepare for a rollover. This method is called prior to
- * closing the active log file, performs any necessary
- * preliminary actions and describes actions needed
- * after close of current log file.
- *
- * @param currentActiveFile file name for current active log file.
- * @param append current value of the parent FileAppender.getAppend().
- * @param pool pool for memory allocations during call.
- * @return Description of pending rollover, may be null to indicate no rollover
- * at this time.
- * @throws SecurityException if denied access to log files.
- */
- virtual RolloverDescriptionPtr rollover(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool) = 0;
+ /**
+ * Prepare for a rollover. This method is called prior to
+ * closing the active log file, performs any necessary
+ * preliminary actions and describes actions needed
+ * after close of current log file.
+ *
+ * @param currentActiveFile file name for current active log file.
+ * @param append current value of the parent FileAppender.getAppend().
+ * @param pool pool for memory allocations during call.
+ * @return Description of pending rollover, may be null to indicate no rollover
+ * at this time.
+ * @throws SecurityException if denied access to log files.
+ */
+ virtual RolloverDescriptionPtr rollover(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool) = 0;
};
LOG4CXX_PTR_DEF(RollingPolicy);
diff --git a/src/main/include/log4cxx/rolling/rollingpolicybase.h b/src/main/include/log4cxx/rolling/rollingpolicybase.h
index 630bcd6..56753b1 100644
--- a/src/main/include/log4cxx/rolling/rollingpolicybase.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicybase.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_ROLLING_ROLLING_POLICY_BASE_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -47,82 +47,82 @@
*
*/
class LOG4CXX_EXPORT RollingPolicyBase :
- public virtual RollingPolicy,
- public virtual helpers::ObjectImpl
+ public virtual RollingPolicy,
+ public virtual helpers::ObjectImpl
{
- protected:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicyBase)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingPolicy)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- END_LOG4CXX_CAST_MAP()
+ protected:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicyBase)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingPolicy)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ END_LOG4CXX_CAST_MAP()
- private:
- /**
- * File name pattern converters.
- */
- PatternConverterList patternConverters;
+ private:
+ /**
+ * File name pattern converters.
+ */
+ PatternConverterList patternConverters;
- /**
- * File name field specifiers.
- */
- FormattingInfoList patternFields;
+ /**
+ * File name field specifiers.
+ */
+ FormattingInfoList patternFields;
- /**
- * File name pattern.
- */
- LogString fileNamePatternStr;
+ /**
+ * File name pattern.
+ */
+ LogString fileNamePatternStr;
- public:
- RollingPolicyBase();
- virtual ~RollingPolicyBase();
- void addRef() const;
- void releaseRef() const;
- virtual void activateOptions(log4cxx::helpers::Pool& p) = 0;
- virtual log4cxx::pattern::PatternMap getFormatSpecifiers() const = 0;
+ public:
+ RollingPolicyBase();
+ virtual ~RollingPolicyBase();
+ void addRef() const;
+ void releaseRef() const;
+ virtual void activateOptions(log4cxx::helpers::Pool& p) = 0;
+ virtual log4cxx::pattern::PatternMap getFormatSpecifiers() const = 0;
- virtual void setOption(const LogString& option,
- const LogString& value);
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- /**
- * Set file name pattern.
- * @param fnp file name pattern.
- */
- void setFileNamePattern(const LogString& fnp);
+ /**
+ * Set file name pattern.
+ * @param fnp file name pattern.
+ */
+ void setFileNamePattern(const LogString& fnp);
- /**
- * Get file name pattern.
- * @return file name pattern.
- */
- LogString getFileNamePattern() const;
+ /**
+ * Get file name pattern.
+ * @return file name pattern.
+ */
+ LogString getFileNamePattern() const;
#ifdef LOG4CXX_MULTI_PROCESS
- PatternConverterList getPatternConverterList()
- {
- return patternConverters;
- }
+ PatternConverterList getPatternConverterList()
+ {
+ return patternConverters;
+ }
#endif
- protected:
- /**
- * Parse file name pattern.
- */
- void parseFileNamePattern();
+ protected:
+ /**
+ * Parse file name pattern.
+ */
+ void parseFileNamePattern();
- /**
- * Format file name.
- *
- * @param obj object to be evaluted in formatting, may not be null.
- * @param buf string buffer to which formatted file name is appended, may not be null.
- * @param p memory pool.
- */
- void formatFileName(log4cxx::helpers::ObjectPtr& obj,
- LogString& buf, log4cxx::helpers::Pool& p) const;
+ /**
+ * Format file name.
+ *
+ * @param obj object to be evaluted in formatting, may not be null.
+ * @param buf string buffer to which formatted file name is appended, may not be null.
+ * @param p memory pool.
+ */
+ void formatFileName(log4cxx::helpers::ObjectPtr& obj,
+ LogString& buf, log4cxx::helpers::Pool& p) const;
- log4cxx::pattern::PatternConverterPtr getIntegerPatternConverter() const;
- log4cxx::pattern::PatternConverterPtr getDatePatternConverter() const;
+ log4cxx::pattern::PatternConverterPtr getIntegerPatternConverter() const;
+ log4cxx::pattern::PatternConverterPtr getDatePatternConverter() const;
};
@@ -131,7 +131,7 @@
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif
diff --git a/src/main/include/log4cxx/rolling/rolloverdescription.h b/src/main/include/log4cxx/rolling/rolloverdescription.h
index 892e0ff..a1a4d96 100644
--- a/src/main/include/log4cxx/rolling/rolloverdescription.h
+++ b/src/main/include/log4cxx/rolling/rolloverdescription.h
@@ -29,71 +29,71 @@
class RolloverDescription : public log4cxx::helpers::ObjectImpl
{
- DECLARE_LOG4CXX_OBJECT(RolloverDescription)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RolloverDescription)
- END_LOG4CXX_CAST_MAP()
- /**
- * Active log file name after rollover.
- */
- LogString activeFileName;
+ DECLARE_LOG4CXX_OBJECT(RolloverDescription)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RolloverDescription)
+ END_LOG4CXX_CAST_MAP()
+ /**
+ * Active log file name after rollover.
+ */
+ LogString activeFileName;
- /**
- * Should active file be opened for appending.
- */
- bool append;
+ /**
+ * Should active file be opened for appending.
+ */
+ bool append;
- /**
- * Action to be completed after close of current active log file
- * before returning control to caller.
- */
- ActionPtr synchronous;
+ /**
+ * Action to be completed after close of current active log file
+ * before returning control to caller.
+ */
+ ActionPtr synchronous;
- /**
- * Action to be completed after close of current active log file
- * and before next rollover attempt, may be executed asynchronously.
- */
- ActionPtr asynchronous;
+ /**
+ * Action to be completed after close of current active log file
+ * and before next rollover attempt, may be executed asynchronously.
+ */
+ ActionPtr asynchronous;
- public:
- RolloverDescription();
- /**
- * Create new instance.
- * @param activeFileName active log file name after rollover, may not be null.
- * @param append true if active log file after rollover should be opened for appending.
- * @param synchronous action to be completed after close of current active log file, may be null.
- * @param asynchronous action to be completed after close of current active log file and
- * before next rollover attempt.
- */
- RolloverDescription(
- const LogString& activeFileName,
- const bool append,
- const ActionPtr& synchronous,
- const ActionPtr& asynchronous);
+ public:
+ RolloverDescription();
+ /**
+ * Create new instance.
+ * @param activeFileName active log file name after rollover, may not be null.
+ * @param append true if active log file after rollover should be opened for appending.
+ * @param synchronous action to be completed after close of current active log file, may be null.
+ * @param asynchronous action to be completed after close of current active log file and
+ * before next rollover attempt.
+ */
+ RolloverDescription(
+ const LogString& activeFileName,
+ const bool append,
+ const ActionPtr& synchronous,
+ const ActionPtr& asynchronous);
- /**
- * Active log file name after rollover.
- * @return active log file name after rollover.
- */
- LogString getActiveFileName() const;
+ /**
+ * Active log file name after rollover.
+ * @return active log file name after rollover.
+ */
+ LogString getActiveFileName() const;
- bool getAppend() const;
+ bool getAppend() const;
- /**
- * Action to be completed after close of current active log file
- * before returning control to caller.
- *
- * @return action, may be null.
- */
- ActionPtr getSynchronous() const;
+ /**
+ * Action to be completed after close of current active log file
+ * before returning control to caller.
+ *
+ * @return action, may be null.
+ */
+ ActionPtr getSynchronous() const;
- /**
- * Action to be completed after close of current active log file
- * and before next rollover attempt, may be executed asynchronously.
- *
- * @return action, may be null.
- */
- ActionPtr getAsynchronous() const;
+ /**
+ * Action to be completed after close of current active log file
+ * and before next rollover attempt, may be executed asynchronously.
+ *
+ * @return action, may be null.
+ */
+ ActionPtr getAsynchronous() const;
};
LOG4CXX_PTR_DEF(RolloverDescription);
diff --git a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
index 86b6083..c47b40a 100644
--- a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
@@ -42,40 +42,40 @@
*/
class LOG4CXX_EXPORT SizeBasedTriggeringPolicy : public TriggeringPolicy
{
- DECLARE_LOG4CXX_OBJECT(SizeBasedTriggeringPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SizeBasedTriggeringPolicy)
- LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(SizeBasedTriggeringPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SizeBasedTriggeringPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
- protected:
- size_t maxFileSize;
+ protected:
+ size_t maxFileSize;
- public:
- SizeBasedTriggeringPolicy();
- /**
- * Determines if a rollover may be appropriate at this time. If
- * true is returned, RolloverPolicy.rollover will be called but it
- * can determine that a rollover is not warranted.
- *
- * @param appender A reference to the appender.
- * @param event A reference to the currently event.
- * @param filename The filename for the currently active log file.
- * @param fileLength Length of the file in bytes.
- * @return true if a rollover should occur.
- */
- virtual bool isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& filename,
- size_t fileLength);
+ public:
+ SizeBasedTriggeringPolicy();
+ /**
+ * Determines if a rollover may be appropriate at this time. If
+ * true is returned, RolloverPolicy.rollover will be called but it
+ * can determine that a rollover is not warranted.
+ *
+ * @param appender A reference to the appender.
+ * @param event A reference to the currently event.
+ * @param filename The filename for the currently active log file.
+ * @param fileLength Length of the file in bytes.
+ * @return true if a rollover should occur.
+ */
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
- size_t getMaxFileSize();
+ size_t getMaxFileSize();
- void setMaxFileSize(size_t l);
+ void setMaxFileSize(size_t l);
- void activateOptions(log4cxx::helpers::Pool&);
- void setOption(const LogString& option, const LogString& value);
+ void activateOptions(log4cxx::helpers::Pool&);
+ void setOption(const LogString& option, const LogString& value);
};
LOG4CXX_PTR_DEF(SizeBasedTriggeringPolicy);
diff --git a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
index e3ced73..92e757c 100755
--- a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
@@ -139,151 +139,151 @@
* <code>RollingFileAppender</code>.
*/
class LOG4CXX_EXPORT TimeBasedRollingPolicy : public RollingPolicyBase,
- public TriggeringPolicy
+ public TriggeringPolicy
{
- DECLARE_LOG4CXX_OBJECT(TimeBasedRollingPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TimeBasedRollingPolicy)
- LOG4CXX_CAST_ENTRY_CHAIN(RollingPolicyBase)
- LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(TimeBasedRollingPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TimeBasedRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(RollingPolicyBase)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
- private:
- /**
- * Time for next determination if time for rollover.
- */
- log4cxx_time_t nextCheck;
+ private:
+ /**
+ * Time for next determination if time for rollover.
+ */
+ log4cxx_time_t nextCheck;
- /**
- * File name at last rollover.
- */
- LogString lastFileName;
+ /**
+ * File name at last rollover.
+ */
+ LogString lastFileName;
- /**
- * mmap pointer
- */
- apr_mmap_t* _mmap;
+ /**
+ * mmap pointer
+ */
+ apr_mmap_t* _mmap;
- /*
- * pool for mmap handler
- * */
- log4cxx::helpers::Pool* _mmapPool;
+ /*
+ * pool for mmap handler
+ * */
+ log4cxx::helpers::Pool* _mmapPool;
- /**
- * mmap file descriptor
- */
- apr_file_t* _file_map;
+ /**
+ * mmap file descriptor
+ */
+ apr_file_t* _file_map;
- /**
- * mmap file name
- */
- std::string _mapFileName;
+ /**
+ * mmap file name
+ */
+ std::string _mapFileName;
- /*
- * lock file handle
- * */
- apr_file_t* _lock_file;
+ /*
+ * lock file handle
+ * */
+ apr_file_t* _lock_file;
- /**
- * Check nextCheck if it has already been set
- * Timebased rolling policy has an issue when working at low rps.
- * Under low rps, multiple processes will not be scheduled in time for the second chance(do rolling),
- * so the rolling mechanism will not be triggered even if the time period is out of date.
- * This results in log entries will be accumulated for serveral minutes to be rolling.
- * Adding this flag to provide rolling opportunity for a process even if it is writing the first log entry
- */
- bool bAlreadyInitialized;
+ /**
+ * Check nextCheck if it has already been set
+ * Timebased rolling policy has an issue when working at low rps.
+ * Under low rps, multiple processes will not be scheduled in time for the second chance(do rolling),
+ * so the rolling mechanism will not be triggered even if the time period is out of date.
+ * This results in log entries will be accumulated for serveral minutes to be rolling.
+ * Adding this flag to provide rolling opportunity for a process even if it is writing the first log entry
+ */
+ bool bAlreadyInitialized;
- /*
- * If the current file name contains date information, retrieve the current writting file from mmap
- * */
- bool bRefreshCurFile;
+ /*
+ * If the current file name contains date information, retrieve the current writting file from mmap
+ * */
+ bool bRefreshCurFile;
- /*
- * mmap file name
- * */
- LogString _fileNamePattern;
+ /*
+ * mmap file name
+ * */
+ LogString _fileNamePattern;
- /**
- * Length of any file type suffix (.gz, .zip).
- */
- int suffixLength;
+ /**
+ * Length of any file type suffix (.gz, .zip).
+ */
+ int suffixLength;
- public:
- TimeBasedRollingPolicy();
- void addRef() const;
- void releaseRef() const;
- void activateOptions(log4cxx::helpers::Pool& );
+ public:
+ TimeBasedRollingPolicy();
+ void addRef() const;
+ void releaseRef() const;
+ void activateOptions(log4cxx::helpers::Pool& );
#ifdef LOG4CXX_MULTI_PROCESS
- virtual ~TimeBasedRollingPolicy();
+ virtual ~TimeBasedRollingPolicy();
- /**
- * Generate mmap file
- */
- int createMMapFile(const std::string& lastfilename, log4cxx::helpers::Pool& pool);
+ /**
+ * Generate mmap file
+ */
+ int createMMapFile(const std::string& lastfilename, log4cxx::helpers::Pool& pool);
- /**
- * Detect if the mmap file is empty
- */
- bool isMapFileEmpty(log4cxx::helpers::Pool& pool);
+ /**
+ * Detect if the mmap file is empty
+ */
+ bool isMapFileEmpty(log4cxx::helpers::Pool& pool);
- /**
- * init MMapFile
- */
- void initMMapFile(const LogString& lastFileName, log4cxx::helpers::Pool& pool);
+ /**
+ * init MMapFile
+ */
+ void initMMapFile(const LogString& lastFileName, log4cxx::helpers::Pool& pool);
- /**
- * lock MMapFile
- */
- int lockMMapFile(int type);
+ /**
+ * lock MMapFile
+ */
+ int lockMMapFile(int type);
- /**
- * unlock MMapFile
- */
- int unLockMMapFile();
+ /**
+ * unlock MMapFile
+ */
+ int unLockMMapFile();
- /**
- * create MMapFile/lockFile
- */
- const std::string createFile(const std::string& filename, const std::string& suffix, log4cxx::helpers::Pool& pool);
+ /**
+ * create MMapFile/lockFile
+ */
+ const std::string createFile(const std::string& filename, const std::string& suffix, log4cxx::helpers::Pool& pool);
#endif
- /**
- * {@inheritDoc}
- */
- RolloverDescriptionPtr initialize(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool);
+ /**
+ * {@inheritDoc}
+ */
+ RolloverDescriptionPtr initialize(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
- /**
- * {@inheritDoc}
- */
- RolloverDescriptionPtr rollover(
- const LogString& currentActiveFile,
- const bool append,
- log4cxx::helpers::Pool& pool);
+ /**
+ * {@inheritDoc}
+ */
+ RolloverDescriptionPtr rollover(
+ const LogString& currentActiveFile,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
- /**
- * Determines if a rollover may be appropriate at this time. If
- * true is returned, RolloverPolicy.rollover will be called but it
- * can determine that a rollover is not warranted.
- *
- * @param appender A reference to the appender.
- * @param event A reference to the currently event.
- * @param filename The filename for the currently active log file.
- * @param fileLength Length of the file in bytes.
- * @return true if a rollover should occur.
- */
- virtual bool isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& filename,
- size_t fileLength);
+ /**
+ * Determines if a rollover may be appropriate at this time. If
+ * true is returned, RolloverPolicy.rollover will be called but it
+ * can determine that a rollover is not warranted.
+ *
+ * @param appender A reference to the appender.
+ * @param event A reference to the currently event.
+ * @param filename The filename for the currently active log file.
+ * @param fileLength Length of the file in bytes.
+ * @return true if a rollover should occur.
+ */
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
- protected:
- log4cxx::pattern::PatternMap getFormatSpecifiers() const;
+ protected:
+ log4cxx::pattern::PatternMap getFormatSpecifiers() const;
};
diff --git a/src/main/include/log4cxx/rolling/triggeringpolicy.h b/src/main/include/log4cxx/rolling/triggeringpolicy.h
index 7c4c62b..d8a4169 100644
--- a/src/main/include/log4cxx/rolling/triggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/triggeringpolicy.h
@@ -42,35 +42,35 @@
* */
class LOG4CXX_EXPORT TriggeringPolicy :
- public virtual spi::OptionHandler,
- public virtual helpers::ObjectImpl
+ public virtual spi::OptionHandler,
+ public virtual helpers::ObjectImpl
{
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(TriggeringPolicy)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TriggeringPolicy)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- END_LOG4CXX_CAST_MAP()
- public:
- virtual ~TriggeringPolicy();
- void addRef() const;
- void releaseRef() const;
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(TriggeringPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TriggeringPolicy)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ END_LOG4CXX_CAST_MAP()
+ public:
+ virtual ~TriggeringPolicy();
+ void addRef() const;
+ void releaseRef() const;
- /**
- * Determines if a rollover may be appropriate at this time. If
- * true is returned, RolloverPolicy.rollover will be called but it
- * can determine that a rollover is not warranted.
- *
- * @param appender A reference to the appender.
- * @param event A reference to the currently event.
- * @param filename The filename for the currently active log file.
- * @param fileLength Length of the file in bytes.
- * @return true if a rollover should occur.
- */
- virtual bool isTriggeringEvent(
- Appender* appender,
- const log4cxx::spi::LoggingEventPtr& event,
- const LogString& filename,
- size_t fileLength) = 0;
+ /**
+ * Determines if a rollover may be appropriate at this time. If
+ * true is returned, RolloverPolicy.rollover will be called but it
+ * can determine that a rollover is not warranted.
+ *
+ * @param appender A reference to the appender.
+ * @param event A reference to the currently event.
+ * @param filename The filename for the currently active log file.
+ * @param fileLength Length of the file in bytes.
+ * @return true if a rollover should occur.
+ */
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength) = 0;
};
diff --git a/src/main/include/log4cxx/rolling/zipcompressaction.h b/src/main/include/log4cxx/rolling/zipcompressaction.h
index 2e7b9fb..385b3df 100644
--- a/src/main/include/log4cxx/rolling/zipcompressaction.h
+++ b/src/main/include/log4cxx/rolling/zipcompressaction.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_ROLLING_ZIP_COMPRESS_ACTION_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -35,33 +35,33 @@
class ZipCompressAction : public Action
{
- const File source;
- const File destination;
- bool deleteSource;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ZipCompressAction)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ZipCompressAction)
- LOG4CXX_CAST_ENTRY_CHAIN(Action)
- END_LOG4CXX_CAST_MAP()
+ const File source;
+ const File destination;
+ bool deleteSource;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ZipCompressAction)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ZipCompressAction)
+ LOG4CXX_CAST_ENTRY_CHAIN(Action)
+ END_LOG4CXX_CAST_MAP()
- /**
- * Constructor.
- */
- ZipCompressAction(const File& source,
- const File& destination,
- bool deleteSource);
+ /**
+ * Constructor.
+ */
+ ZipCompressAction(const File& source,
+ const File& destination,
+ bool deleteSource);
- /**
- * Perform action.
- *
- * @return true if successful.
- */
- virtual bool execute(log4cxx::helpers::Pool& pool) const;
+ /**
+ * Perform action.
+ *
+ * @return true if successful.
+ */
+ virtual bool execute(log4cxx::helpers::Pool& pool) const;
- private:
- ZipCompressAction(const ZipCompressAction&);
- ZipCompressAction& operator=(const ZipCompressAction&);
+ private:
+ ZipCompressAction(const ZipCompressAction&);
+ ZipCompressAction& operator=(const ZipCompressAction&);
};
LOG4CXX_PTR_DEF(ZipCompressAction);
@@ -69,7 +69,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
}
diff --git a/src/main/include/log4cxx/rollingfileappender.h b/src/main/include/log4cxx/rollingfileappender.h
index 9d9ca79..69d4674 100644
--- a/src/main/include/log4cxx/rollingfileappender.h
+++ b/src/main/include/log4cxx/rollingfileappender.h
@@ -18,8 +18,8 @@
#define _LOG4CXX_ROLLING_FILE_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/rolling/rollingfileappenderskeleton.h>
@@ -30,77 +30,77 @@
/** RollingFileAppender extends FileAppender to backup the log files when they reach a certain size. */
class LOG4CXX_EXPORT RollingFileAppender : public log4cxx::rolling::RollingFileAppenderSkeleton
{
- private:
- /** The default maximum file size is 10MB. */
- long maxFileSize;
+ private:
+ /** The default maximum file size is 10MB. */
+ long maxFileSize;
- /** There is one backup file by default. */
- int maxBackupIndex;
+ /** There is one backup file by default. */
+ int maxBackupIndex;
- public:
- //
- // Use custom class to use non-default name to avoid
- // conflict with log4cxx::rolling::RollingFileAppender
- DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS( RollingFileAppender, ClassRollingFileAppender )
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY( RollingFileAppender )
- LOG4CXX_CAST_ENTRY_CHAIN( FileAppender )
- END_LOG4CXX_CAST_MAP()
- /** The default constructor simply calls its {@link FileAppender#FileAppender parents constructor}. */
- RollingFileAppender();
+ public:
+ //
+ // Use custom class to use non-default name to avoid
+ // conflict with log4cxx::rolling::RollingFileAppender
+ DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS( RollingFileAppender, ClassRollingFileAppender )
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY( RollingFileAppender )
+ LOG4CXX_CAST_ENTRY_CHAIN( FileAppender )
+ END_LOG4CXX_CAST_MAP()
+ /** The default constructor simply calls its {@link FileAppender#FileAppender parents constructor}. */
+ RollingFileAppender();
- /**
- Instantiate a RollingFileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the ouput destination for this appender.
+ /**
+ Instantiate a RollingFileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the ouput destination for this appender.
- <p>If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by
- <code>filename</code> will be truncated before being opened.
- */
- RollingFileAppender( const LayoutPtr& layout, const LogString& fileName, bool append );
+ <p>If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by
+ <code>filename</code> will be truncated before being opened.
+ */
+ RollingFileAppender( const LayoutPtr& layout, const LogString& fileName, bool append );
- /**
- Instantiate a FileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the output destination for this appender.
- <p>The file will be appended to.
- */
- RollingFileAppender( const LayoutPtr& layout, const LogString& fileName );
+ /**
+ Instantiate a FileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the output destination for this appender.
+ <p>The file will be appended to.
+ */
+ RollingFileAppender( const LayoutPtr& layout, const LogString& fileName );
- virtual ~RollingFileAppender();
+ virtual ~RollingFileAppender();
- /** Returns the value of the <b>MaxBackupIndex</b> option. */
- int getMaxBackupIndex() const;
+ /** Returns the value of the <b>MaxBackupIndex</b> option. */
+ int getMaxBackupIndex() const;
- /** Get the maximum size that the output file is allowed to reach before being rolled over to backup files. */
- long getMaximumFileSize() const;
+ /** Get the maximum size that the output file is allowed to reach before being rolled over to backup files. */
+ long getMaximumFileSize() const;
- /**
- Set the maximum number of backup files to keep around.
+ /**
+ Set the maximum number of backup files to keep around.
- <p>The <b>MaxBackupIndex</b> option determines how many backup
- files are kept before the oldest is erased. This option takes
- a positive integer value. If set to zero, then there will be no
- backup files and the log file will be truncated when it reaches <code>MaxFileSize</code>.
- */
- void setMaxBackupIndex( int maxBackupIndex );
+ <p>The <b>MaxBackupIndex</b> option determines how many backup
+ files are kept before the oldest is erased. This option takes
+ a positive integer value. If set to zero, then there will be no
+ backup files and the log file will be truncated when it reaches <code>MaxFileSize</code>.
+ */
+ void setMaxBackupIndex( int maxBackupIndex );
- /**
- Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
+ /**
+ Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
- <p>In configuration files, the <b>MaxFileSize</b> option takes an
- long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is
- interpreted being expressed respectively in kilobytes, megabytes
- or gigabytes. For example, the value "10KB" will be interpreted as 10240.
- */
- void setMaxFileSize( const LogString& value );
+ <p>In configuration files, the <b>MaxFileSize</b> option takes an
+ long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is
+ interpreted being expressed respectively in kilobytes, megabytes
+ or gigabytes. For example, the value "10KB" will be interpreted as 10240.
+ */
+ void setMaxFileSize( const LogString& value );
- void setMaximumFileSize( int value );
+ void setMaximumFileSize( int value );
- virtual void setOption( const LogString& option, const LogString& value );
+ virtual void setOption( const LogString& option, const LogString& value );
- /** Prepares RollingFileAppender for use. */
- void activateOptions( log4cxx::helpers::Pool& pool );
+ /** Prepares RollingFileAppender for use. */
+ void activateOptions( log4cxx::helpers::Pool& pool );
}; // class RollingFileAppender
@@ -110,7 +110,7 @@
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_ROLLING_FILE_APPENDER_H
diff --git a/src/main/include/log4cxx/simplelayout.h b/src/main/include/log4cxx/simplelayout.h
index fde9388..5899638 100644
--- a/src/main/include/log4cxx/simplelayout.h
+++ b/src/main/include/log4cxx/simplelayout.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SIMPLE_LAYOUT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -42,45 +42,45 @@
*/
class LOG4CXX_EXPORT SimpleLayout : public Layout
{
- public:
- DECLARE_LOG4CXX_OBJECT(SimpleLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(SimpleLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(SimpleLayout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(SimpleLayout)
+ LOG4CXX_CAST_ENTRY_CHAIN(Layout)
+ END_LOG4CXX_CAST_MAP()
- /**
- Returns the log statement in a format consisting of the
- <code>level</code>, followed by " - " and then the
- <code>message</code>. For example, <pre> INFO - "A message"
- </pre>
+ /**
+ Returns the log statement in a format consisting of the
+ <code>level</code>, followed by " - " and then the
+ <code>message</code>. For example, <pre> INFO - "A message"
+ </pre>
- @return A byte array in SimpleLayout format.
- */
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& pool) const;
+ @return A byte array in SimpleLayout format.
+ */
+ virtual void format(LogString& output,
+ const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& pool) const;
- /**
- The SimpleLayout does not handle the throwable contained within
- {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
- <code>true</code>.
- */
- bool ignoresThrowable() const
- {
- return true;
- }
+ /**
+ The SimpleLayout does not handle the throwable contained within
+ {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
+ <code>true</code>.
+ */
+ bool ignoresThrowable() const
+ {
+ return true;
+ }
- virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}
- virtual void setOption(const LogString& /* option */,
- const LogString& /* value */) {}
+ virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}
+ virtual void setOption(const LogString& /* option */,
+ const LogString& /* value */) {}
};
LOG4CXX_PTR_DEF(SimpleLayout);
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_SIMPLE_LAYOUT_H
diff --git a/src/main/include/log4cxx/spi/appenderattachable.h b/src/main/include/log4cxx/spi/appenderattachable.h
index 7b71f1c..3f88af5 100644
--- a/src/main/include/log4cxx/spi/appenderattachable.h
+++ b/src/main/include/log4cxx/spi/appenderattachable.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
@@ -38,49 +38,49 @@
*/
class LOG4CXX_EXPORT AppenderAttachable : public virtual helpers::Object
{
- public:
- // Methods
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderAttachable)
+ public:
+ // Methods
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderAttachable)
- /**
- * Add an appender.
- */
- virtual void addAppender(const AppenderPtr& newAppender) = 0;
+ /**
+ * Add an appender.
+ */
+ virtual void addAppender(const AppenderPtr& newAppender) = 0;
- /**
- * Get all previously added appenders as an AppenderList.
- */
- virtual AppenderList getAllAppenders() const = 0;
+ /**
+ * Get all previously added appenders as an AppenderList.
+ */
+ virtual AppenderList getAllAppenders() const = 0;
- /**
- * Get an appender by name.
- */
- virtual AppenderPtr getAppender(const LogString& name) const = 0;
+ /**
+ * Get an appender by name.
+ */
+ virtual AppenderPtr getAppender(const LogString& name) const = 0;
- /**
- * Returns <code>true</code> if the specified appender is in list of
- * attached appenders, <code>false</code> otherwise.
- */
- virtual bool isAttached(const AppenderPtr& appender) const = 0;
+ /**
+ * Returns <code>true</code> if the specified appender is in list of
+ * attached appenders, <code>false</code> otherwise.
+ */
+ virtual bool isAttached(const AppenderPtr& appender) const = 0;
- /**
- * Remove all previously added appenders.
- */
- virtual void removeAllAppenders() = 0;
+ /**
+ * Remove all previously added appenders.
+ */
+ virtual void removeAllAppenders() = 0;
- /**
- * Remove the appender passed as parameter from the list of appenders.
- */
- virtual void removeAppender(const AppenderPtr& appender) = 0;
+ /**
+ * Remove the appender passed as parameter from the list of appenders.
+ */
+ virtual void removeAppender(const AppenderPtr& appender) = 0;
- /**
- * Remove the appender with the name passed as parameter from the
- * list of appenders.
- */
- virtual void removeAppender(const LogString& name) = 0;
+ /**
+ * Remove the appender with the name passed as parameter from the
+ * list of appenders.
+ */
+ virtual void removeAppender(const LogString& name) = 0;
- // Dtor
- virtual ~AppenderAttachable() {}
+ // Dtor
+ virtual ~AppenderAttachable() {}
};
LOG4CXX_PTR_DEF(AppenderAttachable);
@@ -88,7 +88,7 @@
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_SPI_APPENDER_ATTACHABLE_H_
diff --git a/src/main/include/log4cxx/spi/configurator.h b/src/main/include/log4cxx/spi/configurator.h
index 61ae313..c7a8706 100644
--- a/src/main/include/log4cxx/spi/configurator.h
+++ b/src/main/include/log4cxx/spi/configurator.h
@@ -31,27 +31,27 @@
*/
class LOG4CXX_EXPORT Configurator : virtual public helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Configurator)
- Configurator();
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Configurator)
+ Configurator();
- /**
- Interpret a resource pointed by a URL and set up log4j accordingly.
+ /**
+ Interpret a resource pointed by a URL and set up log4j accordingly.
- The configuration is done relative to the <code>hierarchy</code>
- parameter.
+ The configuration is done relative to the <code>hierarchy</code>
+ parameter.
- @param configFileName The file to parse
- @param repository The hierarchy to operation upon.
- */
- virtual void doConfigure(const File& configFileName,
- spi::LoggerRepositoryPtr& repository) = 0;
+ @param configFileName The file to parse
+ @param repository The hierarchy to operation upon.
+ */
+ virtual void doConfigure(const File& configFileName,
+ spi::LoggerRepositoryPtr& repository) = 0;
- private:
- Configurator(const Configurator&);
- Configurator& operator=(const Configurator&);
- bool initialized;
+ private:
+ Configurator(const Configurator&);
+ Configurator& operator=(const Configurator&);
+ bool initialized;
};
LOG4CXX_PTR_DEF(Configurator);
diff --git a/src/main/include/log4cxx/spi/defaultrepositoryselector.h b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
index 22835a6..267f77e 100644
--- a/src/main/include/log4cxx/spi/defaultrepositoryselector.h
+++ b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
@@ -27,22 +27,22 @@
namespace spi
{
class LOG4CXX_EXPORT DefaultRepositorySelector :
- public virtual RepositorySelector,
- public virtual helpers::ObjectImpl
+ public virtual RepositorySelector,
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(DefaultRepositorySelector)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RepositorySelector)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(DefaultRepositorySelector)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RepositorySelector)
+ END_LOG4CXX_CAST_MAP()
- DefaultRepositorySelector(const LoggerRepositoryPtr& repository1);
- void addRef() const;
- void releaseRef() const;
- virtual LoggerRepositoryPtr& getLoggerRepository();
+ DefaultRepositorySelector(const LoggerRepositoryPtr& repository1);
+ void addRef() const;
+ void releaseRef() const;
+ virtual LoggerRepositoryPtr& getLoggerRepository();
- private:
- LoggerRepositoryPtr repository;
+ private:
+ LoggerRepositoryPtr repository;
};
} // namespace spi
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/spi/errorhandler.h b/src/main/include/log4cxx/spi/errorhandler.h
index 5d6d1ae..09b9054 100644
--- a/src/main/include/log4cxx/spi/errorhandler.h
+++ b/src/main/include/log4cxx/spi/errorhandler.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SPI_ERROR_HANDLER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -35,17 +35,17 @@
{
class ErrorCode
{
- public:
- enum
- {
- GENERIC_FAILURE = 0,
- WRITE_FAILURE = 1,
- FLUSH_FAILURE = 2,
- CLOSE_FAILURE = 3,
- FILE_OPEN_FAILURE = 4,
- MISSING_LAYOUT = 5,
- ADDRESS_PARSE_FAILURE = 6
- };
+ public:
+ enum
+ {
+ GENERIC_FAILURE = 0,
+ WRITE_FAILURE = 1,
+ FLUSH_FAILURE = 2,
+ CLOSE_FAILURE = 3,
+ FILE_OPEN_FAILURE = 4,
+ MISSING_LAYOUT = 5,
+ ADDRESS_PARSE_FAILURE = 6
+ };
};
@@ -63,62 +63,62 @@
*/
class LOG4CXX_EXPORT ErrorHandler : public virtual OptionHandler
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(ErrorHandler)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(ErrorHandler)
- LOG4CXX_CAST_ENTRY(OptionHandler)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(ErrorHandler)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(ErrorHandler)
+ LOG4CXX_CAST_ENTRY(OptionHandler)
+ END_LOG4CXX_CAST_MAP()
- virtual ~ErrorHandler() {}
+ virtual ~ErrorHandler() {}
- /**
- Add a reference to a logger to which the failing appender might
- be attached to. The failing appender will be searched and
- replaced only in the loggers you add through this method.
+ /**
+ Add a reference to a logger to which the failing appender might
+ be attached to. The failing appender will be searched and
+ replaced only in the loggers you add through this method.
- @param logger One of the loggers that will be searched for the failing
- appender in view of replacement.
- */
- virtual void setLogger(const LoggerPtr& logger) = 0;
+ @param logger One of the loggers that will be searched for the failing
+ appender in view of replacement.
+ */
+ virtual void setLogger(const LoggerPtr& logger) = 0;
- /**
- Equivalent to the error(const String&, helpers::Exception&, int,
- spi::LoggingEvent&) with the the event parameteter set to
- null.
- */
- virtual void error(const LogString& message, const std::exception& e,
- int errorCode) const = 0;
+ /**
+ Equivalent to the error(const String&, helpers::Exception&, int,
+ spi::LoggingEvent&) with the the event parameteter set to
+ null.
+ */
+ virtual void error(const LogString& message, const std::exception& e,
+ int errorCode) const = 0;
- /**
- This method is normally used to just print the error message
- passed as a parameter.
- */
- virtual void error(const LogString& message) const = 0;
+ /**
+ This method is normally used to just print the error message
+ passed as a parameter.
+ */
+ virtual void error(const LogString& message) const = 0;
- /**
- This method is invoked to handle the error.
+ /**
+ This method is invoked to handle the error.
- @param message The message assoicated with the error.
- @param e The Exption that was thrown when the error occured.
- @param errorCode The error code associated with the error.
- @param event The logging event that the failing appender is asked
- to log.
- */
- virtual void error(const LogString& message, const std::exception& e,
- int errorCode, const LoggingEventPtr& event) const = 0;
+ @param message The message assoicated with the error.
+ @param e The Exption that was thrown when the error occured.
+ @param errorCode The error code associated with the error.
+ @param event The logging event that the failing appender is asked
+ to log.
+ */
+ virtual void error(const LogString& message, const std::exception& e,
+ int errorCode, const LoggingEventPtr& event) const = 0;
- /**
- Set the appender for which errors are handled. This method is
- usually called when the error handler is configured.
- */
- virtual void setAppender(const AppenderPtr& appender) = 0;
+ /**
+ Set the appender for which errors are handled. This method is
+ usually called when the error handler is configured.
+ */
+ virtual void setAppender(const AppenderPtr& appender) = 0;
- /**
- Set the appender to fallback upon in case of failure.
- */
- virtual void setBackupAppender(const AppenderPtr& appender) = 0;
+ /**
+ Set the appender to fallback upon in case of failure.
+ */
+ virtual void setBackupAppender(const AppenderPtr& appender) = 0;
};
LOG4CXX_PTR_DEF(ErrorHandler);
@@ -126,7 +126,7 @@
} //namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_SPI_ERROR_HANDLER_H
diff --git a/src/main/include/log4cxx/spi/filter.h b/src/main/include/log4cxx/spi/filter.h
index bd8feaf..2f5fd89 100644
--- a/src/main/include/log4cxx/spi/filter.h
+++ b/src/main/include/log4cxx/spi/filter.h
@@ -67,65 +67,65 @@
xml::DOMConfigurator DOMConfigurator}.
*/
class LOG4CXX_EXPORT Filter : public virtual OptionHandler,
- public virtual helpers::ObjectImpl
+ public virtual helpers::ObjectImpl
{
- /**
- Points to the next filter in the filter chain.
- */
- FilterPtr next;
- public:
- Filter();
+ /**
+ Points to the next filter in the filter chain.
+ */
+ FilterPtr next;
+ public:
+ Filter();
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Filter)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(Filter)
- LOG4CXX_CAST_ENTRY(spi::OptionHandler)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Filter)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(Filter)
+ LOG4CXX_CAST_ENTRY(spi::OptionHandler)
+ END_LOG4CXX_CAST_MAP()
- log4cxx::spi::FilterPtr getNext() const;
- void setNext(const log4cxx::spi::FilterPtr& newNext);
+ log4cxx::spi::FilterPtr getNext() const;
+ void setNext(const log4cxx::spi::FilterPtr& newNext);
- enum FilterDecision
- {
- /**
- The log event must be dropped immediately without consulting
- with the remaining filters, if any, in the chain. */
- DENY = -1,
- /**
- This filter is neutral with respect to the log event. The
- remaining filters, if any, should be consulted for a final decision.
- */
- NEUTRAL = 0,
- /**
- The log event must be logged immediately without consulting with
- the remaining filters, if any, in the chain.
- */
- ACCEPT = 1
+ enum FilterDecision
+ {
+ /**
+ The log event must be dropped immediately without consulting
+ with the remaining filters, if any, in the chain. */
+ DENY = -1,
+ /**
+ This filter is neutral with respect to the log event. The
+ remaining filters, if any, should be consulted for a final decision.
+ */
+ NEUTRAL = 0,
+ /**
+ The log event must be logged immediately without consulting with
+ the remaining filters, if any, in the chain.
+ */
+ ACCEPT = 1
- };
+ };
- /**
- Usually filters options become active when set. We provide a
+ /**
+ Usually filters options become active when set. We provide a
- default do-nothing implementation for convenience.
- */
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option, const LogString& value);
+ default do-nothing implementation for convenience.
+ */
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option, const LogString& value);
- /**
- <p>If the decision is <code>DENY</code>, then the event will be
- dropped. If the decision is <code>NEUTRAL</code>, then the next
- filter, if any, will be invoked. If the decision is ACCEPT then
- the event will be logged without consulting with other filters in
- the chain.
+ /**
+ <p>If the decision is <code>DENY</code>, then the event will be
+ dropped. If the decision is <code>NEUTRAL</code>, then the next
+ filter, if any, will be invoked. If the decision is ACCEPT then
+ the event will be logged without consulting with other filters in
+ the chain.
- @param event The LoggingEvent to decide upon.
- @return The decision of the filter. */
- virtual FilterDecision decide(const LoggingEventPtr& event) const = 0;
+ @param event The LoggingEvent to decide upon.
+ @return The decision of the filter. */
+ virtual FilterDecision decide(const LoggingEventPtr& event) const = 0;
};
}
}
diff --git a/src/main/include/log4cxx/spi/hierarchyeventlistener.h b/src/main/include/log4cxx/spi/hierarchyeventlistener.h
index 637f875..d5e32bb 100644
--- a/src/main/include/log4cxx/spi/hierarchyeventlistener.h
+++ b/src/main/include/log4cxx/spi/hierarchyeventlistener.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SPI_HIERARCHY_EVENT_LISTENER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -39,18 +39,18 @@
/** Listen to events occuring within a Hierarchy.*/
class LOG4CXX_EXPORT HierarchyEventListener :
- public virtual log4cxx::helpers::Object
+ public virtual log4cxx::helpers::Object
{
- public:
- virtual ~HierarchyEventListener() {}
+ public:
+ virtual ~HierarchyEventListener() {}
- virtual void addAppenderEvent(
- const log4cxx::helpers::ObjectPtrT<Logger>& logger,
- const log4cxx::helpers::ObjectPtrT<Appender>& appender) = 0;
+ virtual void addAppenderEvent(
+ const log4cxx::helpers::ObjectPtrT<Logger>& logger,
+ const log4cxx::helpers::ObjectPtrT<Appender>& appender) = 0;
- virtual void removeAppenderEvent(
- const log4cxx::helpers::ObjectPtrT<Logger>& logger,
- const log4cxx::helpers::ObjectPtrT<Appender>& appender) = 0;
+ virtual void removeAppenderEvent(
+ const log4cxx::helpers::ObjectPtrT<Logger>& logger,
+ const log4cxx::helpers::ObjectPtrT<Appender>& appender) = 0;
};
LOG4CXX_PTR_DEF(HierarchyEventListener);
LOG4CXX_LIST_DEF(HierarchyEventListenerList, HierarchyEventListenerPtr);
@@ -59,7 +59,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_SPI_HIERARCHY_EVENT_LISTENER_H
diff --git a/src/main/include/log4cxx/spi/location/locationinfo.h b/src/main/include/log4cxx/spi/location/locationinfo.h
index b8f4703..6616780 100644
--- a/src/main/include/log4cxx/spi/location/locationinfo.h
+++ b/src/main/include/log4cxx/spi/location/locationinfo.h
@@ -32,83 +32,83 @@
*/
class LOG4CXX_EXPORT LocationInfo
{
- public:
+ public:
- /**
- * When location information is not available the constant
- * <code>NA</code> is returned. Current value of this string constant is <b>?</b>.
- */
- static const char* const NA;
- static const char* const NA_METHOD;
+ /**
+ * When location information is not available the constant
+ * <code>NA</code> is returned. Current value of this string constant is <b>?</b>.
+ */
+ static const char* const NA;
+ static const char* const NA_METHOD;
- static const LocationInfo& getLocationUnavailable();
+ static const LocationInfo& getLocationUnavailable();
- /**
- * Constructor.
- * @remarks Used by LOG4CXX_LOCATION to generate
- * location info for current code site
- */
- LocationInfo( const char* const fileName,
- const char* const functionName,
- int lineNumber);
+ /**
+ * Constructor.
+ * @remarks Used by LOG4CXX_LOCATION to generate
+ * location info for current code site
+ */
+ LocationInfo( const char* const fileName,
+ const char* const functionName,
+ int lineNumber);
- /**
- * Default constructor.
- */
- LocationInfo();
+ /**
+ * Default constructor.
+ */
+ LocationInfo();
- /**
- * Copy constructor.
- * @param src source location
- */
- LocationInfo( const LocationInfo& src );
+ /**
+ * Copy constructor.
+ * @param src source location
+ */
+ LocationInfo( const LocationInfo& src );
- /**
- * Assignment operator.
- * @param src source location
- */
- LocationInfo& operator = ( const LocationInfo& src );
+ /**
+ * Assignment operator.
+ * @param src source location
+ */
+ LocationInfo& operator = ( const LocationInfo& src );
- /**
- * Resets location info to default state.
- */
- void clear();
+ /**
+ * Resets location info to default state.
+ */
+ void clear();
- /** Return the class name of the call site. */
- const std::string getClassName() const;
+ /** Return the class name of the call site. */
+ const std::string getClassName() const;
- /**
- * Return the file name of the caller.
- * @returns file name, may be null.
- */
- const char* getFileName() const;
+ /**
+ * Return the file name of the caller.
+ * @returns file name, may be null.
+ */
+ const char* getFileName() const;
- /**
- * Returns the line number of the caller.
- * @returns line number, -1 if not available.
- */
- int getLineNumber() const;
+ /**
+ * Returns the line number of the caller.
+ * @returns line number, -1 if not available.
+ */
+ int getLineNumber() const;
- /** Returns the method name of the caller. */
- const std::string getMethodName() const;
+ /** Returns the method name of the caller. */
+ const std::string getMethodName() const;
- void write(log4cxx::helpers::ObjectOutputStream& os, log4cxx::helpers::Pool& p) const;
+ void write(log4cxx::helpers::ObjectOutputStream& os, log4cxx::helpers::Pool& p) const;
- private:
- /** Caller's line number. */
- int lineNumber;
+ private:
+ /** Caller's line number. */
+ int lineNumber;
- /** Caller's file name. */
- const char* fileName;
+ /** Caller's file name. */
+ const char* fileName;
- /** Caller's method name. */
- const char* methodName;
+ /** Caller's method name. */
+ const char* methodName;
};
@@ -117,24 +117,24 @@
#if !defined(LOG4CXX_LOCATION)
#if defined(_MSC_VER)
- #if _MSC_VER >= 1300
- #define __LOG4CXX_FUNC__ __FUNCSIG__
- #endif
+ #if _MSC_VER >= 1300
+ #define __LOG4CXX_FUNC__ __FUNCSIG__
+ #endif
#else
- #if defined(__GNUC__)
- #define __LOG4CXX_FUNC__ __PRETTY_FUNCTION__
- #else
- #if defined(__BORLANDC__)
- #define __LOG4CXX_FUNC__ __FUNC__
- #endif
- #endif
+ #if defined(__GNUC__)
+ #define __LOG4CXX_FUNC__ __PRETTY_FUNCTION__
+ #else
+ #if defined(__BORLANDC__)
+ #define __LOG4CXX_FUNC__ __FUNC__
+ #endif
+ #endif
#endif
#if !defined(__LOG4CXX_FUNC__)
- #define __LOG4CXX_FUNC__ ""
+ #define __LOG4CXX_FUNC__ ""
#endif
#define LOG4CXX_LOCATION ::log4cxx::spi::LocationInfo(__FILE__, \
- __LOG4CXX_FUNC__, \
- __LINE__)
+ __LOG4CXX_FUNC__, \
+ __LINE__)
#endif
#endif //_LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
diff --git a/src/main/include/log4cxx/spi/loggerfactory.h b/src/main/include/log4cxx/spi/loggerfactory.h
index d1aff27..846c69b 100644
--- a/src/main/include/log4cxx/spi/loggerfactory.h
+++ b/src/main/include/log4cxx/spi/loggerfactory.h
@@ -31,12 +31,12 @@
*/
class LOG4CXX_EXPORT LoggerFactory : public virtual helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(LoggerFactory)
- virtual ~LoggerFactory() {}
- virtual LoggerPtr makeNewLoggerInstance(
- log4cxx::helpers::Pool& pool,
- const LogString& name) const = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(LoggerFactory)
+ virtual ~LoggerFactory() {}
+ virtual LoggerPtr makeNewLoggerInstance(
+ log4cxx::helpers::Pool& pool,
+ const LogString& name) const = 0;
};
diff --git a/src/main/include/log4cxx/spi/loggerrepository.h b/src/main/include/log4cxx/spi/loggerrepository.h
index 656163c..794c72d 100644
--- a/src/main/include/log4cxx/spi/loggerrepository.h
+++ b/src/main/include/log4cxx/spi/loggerrepository.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SPI_LOG_REPOSITORY_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -46,62 +46,62 @@
*/
class LOG4CXX_EXPORT LoggerRepository : public virtual helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(LoggerRepository)
- virtual ~LoggerRepository() {}
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(LoggerRepository)
+ virtual ~LoggerRepository() {}
- /**
- Add a {@link spi::HierarchyEventListener HierarchyEventListener}
- event to the repository.
- */
- virtual void addHierarchyEventListener(const HierarchyEventListenerPtr&
- listener) = 0;
- /**
- Is the repository disabled for a given level? The answer depends
- on the repository threshold and the <code>level</code>
- parameter. See also #setThreshold method. */
- virtual bool isDisabled(int level) const = 0;
+ /**
+ Add a {@link spi::HierarchyEventListener HierarchyEventListener}
+ event to the repository.
+ */
+ virtual void addHierarchyEventListener(const HierarchyEventListenerPtr&
+ listener) = 0;
+ /**
+ Is the repository disabled for a given level? The answer depends
+ on the repository threshold and the <code>level</code>
+ parameter. See also #setThreshold method. */
+ virtual bool isDisabled(int level) const = 0;
- /**
- Set the repository-wide threshold. All logging requests below the
- threshold are immediately dropped. By default, the threshold is
- set to <code>Level::getAll()</code> which has the lowest possible rank. */
- virtual void setThreshold(const LevelPtr& level) = 0;
+ /**
+ Set the repository-wide threshold. All logging requests below the
+ threshold are immediately dropped. By default, the threshold is
+ set to <code>Level::getAll()</code> which has the lowest possible rank. */
+ virtual void setThreshold(const LevelPtr& level) = 0;
- /**
- Another form of {@link #setThreshold(const LevelPtr&)
- setThreshold} accepting a string
- parameter instead of a <code>Level</code>. */
- virtual void setThreshold(const LogString& val) = 0;
+ /**
+ Another form of {@link #setThreshold(const LevelPtr&)
+ setThreshold} accepting a string
+ parameter instead of a <code>Level</code>. */
+ virtual void setThreshold(const LogString& val) = 0;
- virtual void emitNoAppenderWarning(const LoggerPtr& logger) = 0;
+ virtual void emitNoAppenderWarning(const LoggerPtr& logger) = 0;
- /**
- Get the repository-wide threshold. See {@link
- #setThreshold(const LevelPtr&) setThreshold}
- for an explanation. */
- virtual const LevelPtr& getThreshold() const = 0;
+ /**
+ Get the repository-wide threshold. See {@link
+ #setThreshold(const LevelPtr&) setThreshold}
+ for an explanation. */
+ virtual const LevelPtr& getThreshold() const = 0;
- virtual LoggerPtr getLogger(const LogString& name) = 0;
+ virtual LoggerPtr getLogger(const LogString& name) = 0;
- virtual LoggerPtr getLogger(const LogString& name,
- const spi::LoggerFactoryPtr& factory) = 0;
+ virtual LoggerPtr getLogger(const LogString& name,
+ const spi::LoggerFactoryPtr& factory) = 0;
- virtual LoggerPtr getRootLogger() const = 0;
+ virtual LoggerPtr getRootLogger() const = 0;
- virtual LoggerPtr exists(const LogString& name) = 0;
+ virtual LoggerPtr exists(const LogString& name) = 0;
- virtual void shutdown() = 0;
+ virtual void shutdown() = 0;
- virtual LoggerList getCurrentLoggers() const = 0;
+ virtual LoggerList getCurrentLoggers() const = 0;
- virtual void fireAddAppenderEvent(const LoggerPtr& logger,
- const AppenderPtr& appender) = 0;
+ virtual void fireAddAppenderEvent(const LoggerPtr& logger,
+ const AppenderPtr& appender) = 0;
- virtual void resetConfiguration() = 0;
+ virtual void resetConfiguration() = 0;
- virtual bool isConfigured() = 0;
- virtual void setConfigured(bool configured) = 0;
+ virtual bool isConfigured() = 0;
+ virtual void setConfigured(bool configured) = 0;
}; // class LoggerRepository
@@ -109,7 +109,7 @@
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
diff --git a/src/main/include/log4cxx/spi/loggingevent.h b/src/main/include/log4cxx/spi/loggingevent.h
index c5af803..20bdfa9 100644
--- a/src/main/include/log4cxx/spi/loggingevent.h
+++ b/src/main/include/log4cxx/spi/loggingevent.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_SPI_LOGGING_EVENT_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -54,214 +54,214 @@
<p>This class is of concern to those wishing to extend log4cxx.
*/
class LOG4CXX_EXPORT LoggingEvent :
- public virtual helpers::ObjectImpl
+ public virtual helpers::ObjectImpl
{
- public:
- DECLARE_LOG4CXX_OBJECT(LoggingEvent)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(LoggingEvent)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(LoggingEvent)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(LoggingEvent)
+ END_LOG4CXX_CAST_MAP()
- typedef spi::KeySet KeySet;
+ typedef spi::KeySet KeySet;
- /** For serialization only
- */
- LoggingEvent();
+ /** For serialization only
+ */
+ LoggingEvent();
- /**
- Instantiate a LoggingEvent from the supplied parameters.
+ /**
+ Instantiate a LoggingEvent from the supplied parameters.
- <p>Except timeStamp all the other fields of
- <code>LoggingEvent</code> are filled when actually needed.
- <p>
- @param logger The logger of this event.
- @param level The level of this event.
- @param message The message of this event.
- @param location location of logging request.
- */
- LoggingEvent(const LogString& logger,
- const LevelPtr& level, const LogString& message,
- const log4cxx::spi::LocationInfo& location);
+ <p>Except timeStamp all the other fields of
+ <code>LoggingEvent</code> are filled when actually needed.
+ <p>
+ @param logger The logger of this event.
+ @param level The level of this event.
+ @param message The message of this event.
+ @param location location of logging request.
+ */
+ LoggingEvent(const LogString& logger,
+ const LevelPtr& level, const LogString& message,
+ const log4cxx::spi::LocationInfo& location);
- ~LoggingEvent();
+ ~LoggingEvent();
- /** Return the level of this event. */
- inline const LevelPtr& getLevel() const
- {
- return level;
- }
+ /** Return the level of this event. */
+ inline const LevelPtr& getLevel() const
+ {
+ return level;
+ }
- /** Return the name of the logger. */
- inline const LogString& getLoggerName() const
- {
- return logger;
- }
+ /** Return the name of the logger. */
+ inline const LogString& getLoggerName() const
+ {
+ return logger;
+ }
- /** Return the message for this logging event. */
- inline const LogString& getMessage() const
- {
- return message;
- }
+ /** Return the message for this logging event. */
+ inline const LogString& getMessage() const
+ {
+ return message;
+ }
- /** Return the message for this logging event. */
- inline const LogString& getRenderedMessage() const
- {
- return message;
- }
+ /** Return the message for this logging event. */
+ inline const LogString& getRenderedMessage() const
+ {
+ return message;
+ }
- /**Returns the time when the application started,
- in microseconds elapsed since 01.01.1970.
- */
- static log4cxx_time_t getStartTime();
+ /**Returns the time when the application started,
+ in microseconds elapsed since 01.01.1970.
+ */
+ static log4cxx_time_t getStartTime();
- /** Return the threadName of this event. */
- inline const LogString& getThreadName() const
- {
- return threadName;
- }
+ /** Return the threadName of this event. */
+ inline const LogString& getThreadName() const
+ {
+ return threadName;
+ }
- /** The number of microseconds elapsed from 01.01.1970 until logging event
- was created. */
- inline log4cxx_time_t getTimeStamp() const
- {
- return timeStamp;
- }
+ /** The number of microseconds elapsed from 01.01.1970 until logging event
+ was created. */
+ inline log4cxx_time_t getTimeStamp() const
+ {
+ return timeStamp;
+ }
- /* Return the file where this log statement was written. */
- inline const log4cxx::spi::LocationInfo& getLocationInformation() const
- {
- return locationInfo;
- }
+ /* Return the file where this log statement was written. */
+ inline const log4cxx::spi::LocationInfo& getLocationInformation() const
+ {
+ return locationInfo;
+ }
- /**
- * This method appends the NDC for this event to passed string. It will return the
- * correct content even if the event was generated in a different
- * thread or even on a different machine. The NDC#get method
- * should <em>never</em> be called directly.
- *
- * @param dest destination for NDC, unchanged if NDC is not set.
- * @return true if NDC is set.
- */
- bool getNDC(LogString& dest) const;
+ /**
+ * This method appends the NDC for this event to passed string. It will return the
+ * correct content even if the event was generated in a different
+ * thread or even on a different machine. The NDC#get method
+ * should <em>never</em> be called directly.
+ *
+ * @param dest destination for NDC, unchanged if NDC is not set.
+ * @return true if NDC is set.
+ */
+ bool getNDC(LogString& dest) const;
- /**
- * Writes the content of the LoggingEvent
- * in a format compatible with log4j's serialized form.
- */
- void write(helpers::ObjectOutputStream& os, helpers::Pool& p) const;
+ /**
+ * Writes the content of the LoggingEvent
+ * in a format compatible with log4j's serialized form.
+ */
+ void write(helpers::ObjectOutputStream& os, helpers::Pool& p) const;
- /**
- * Appends the the context corresponding to the <code>key</code> parameter.
- * If there is a local MDC copy, possibly because we are in a logging
- * server or running inside AsyncAppender, then we search for the key in
- * MDC copy, if a value is found it is returned. Otherwise, if the search
- * in MDC copy returns an empty result, then the current thread's
- * <code>MDC</code> is used.
- *
- * <p>
- * Note that <em>both</em> the local MDC copy and the current thread's MDC
- * are searched.
- * </p>
- * @param key key.
- * @param dest string to which value, if any, is appended.
- * @return true if key had a corresponding value.
- */
- bool getMDC(const LogString& key, LogString& dest) const;
+ /**
+ * Appends the the context corresponding to the <code>key</code> parameter.
+ * If there is a local MDC copy, possibly because we are in a logging
+ * server or running inside AsyncAppender, then we search for the key in
+ * MDC copy, if a value is found it is returned. Otherwise, if the search
+ * in MDC copy returns an empty result, then the current thread's
+ * <code>MDC</code> is used.
+ *
+ * <p>
+ * Note that <em>both</em> the local MDC copy and the current thread's MDC
+ * are searched.
+ * </p>
+ * @param key key.
+ * @param dest string to which value, if any, is appended.
+ * @return true if key had a corresponding value.
+ */
+ bool getMDC(const LogString& key, LogString& dest) const;
- /**
- * Returns the set of of the key values in the MDC for the event.
- * The returned set is unmodifiable by the caller.
- *
- * @return Set an unmodifiable set of the MDC keys.
- *
- */
- KeySet getMDCKeySet() const;
+ /**
+ * Returns the set of of the key values in the MDC for the event.
+ * The returned set is unmodifiable by the caller.
+ *
+ * @return Set an unmodifiable set of the MDC keys.
+ *
+ */
+ KeySet getMDCKeySet() const;
- /**
- Obtain a copy of this thread's MDC prior to serialization
- or asynchronous logging.
- */
- void getMDCCopy() const;
+ /**
+ Obtain a copy of this thread's MDC prior to serialization
+ or asynchronous logging.
+ */
+ void getMDCCopy() const;
- /**
- * Return a previously set property.
- * @param key key.
- * @param dest string to which value, if any, is appended.
- * @return true if key had a corresponding value.
- */
- bool getProperty(const LogString& key, LogString& dest) const;
- /**
- * Returns the set of of the key values in the properties
- * for the event. The returned set is unmodifiable by the caller.
- *
- * @return Set an unmodifiable set of the property keys.
- */
- KeySet getPropertyKeySet() const;
+ /**
+ * Return a previously set property.
+ * @param key key.
+ * @param dest string to which value, if any, is appended.
+ * @return true if key had a corresponding value.
+ */
+ bool getProperty(const LogString& key, LogString& dest) const;
+ /**
+ * Returns the set of of the key values in the properties
+ * for the event. The returned set is unmodifiable by the caller.
+ *
+ * @return Set an unmodifiable set of the property keys.
+ */
+ KeySet getPropertyKeySet() const;
- /**
- * Set a string property using a key and a string value. since 1.3
- */
- void setProperty(const LogString& key, const LogString& value);
+ /**
+ * Set a string property using a key and a string value. since 1.3
+ */
+ void setProperty(const LogString& key, const LogString& value);
- private:
- /**
- * The logger of the logging event.
- **/
- LogString logger;
+ private:
+ /**
+ * The logger of the logging event.
+ **/
+ LogString logger;
- /** level of logging event. */
- LevelPtr level;
+ /** level of logging event. */
+ LevelPtr level;
- /** The nested diagnostic context (NDC) of logging event. */
- mutable LogString* ndc;
+ /** The nested diagnostic context (NDC) of logging event. */
+ mutable LogString* ndc;
- /** The mapped diagnostic context (MDC) of logging event. */
- mutable MDC::Map* mdcCopy;
+ /** The mapped diagnostic context (MDC) of logging event. */
+ mutable MDC::Map* mdcCopy;
- /**
- * A map of String keys and String values.
- */
- std::map<LogString, LogString>* properties;
+ /**
+ * A map of String keys and String values.
+ */
+ std::map<LogString, LogString>* properties;
- /** Have we tried to do an NDC lookup? If we did, there is no need
- * to do it again. Note that its value is always false when
- * serialized. Thus, a receiving SocketNode will never use it's own
- * (incorrect) NDC. See also writeObject method.
- */
- mutable bool ndcLookupRequired;
+ /** Have we tried to do an NDC lookup? If we did, there is no need
+ * to do it again. Note that its value is always false when
+ * serialized. Thus, a receiving SocketNode will never use it's own
+ * (incorrect) NDC. See also writeObject method.
+ */
+ mutable bool ndcLookupRequired;
- /**
- * Have we tried to do an MDC lookup? If we did, there is no need to do it
- * again. Note that its value is always false when serialized. See also
- * the getMDC and getMDCCopy methods.
- */
- mutable bool mdcCopyLookupRequired;
+ /**
+ * Have we tried to do an MDC lookup? If we did, there is no need to do it
+ * again. Note that its value is always false when serialized. See also
+ * the getMDC and getMDCCopy methods.
+ */
+ mutable bool mdcCopyLookupRequired;
- /** The application supplied message of logging event. */
- LogString message;
+ /** The application supplied message of logging event. */
+ LogString message;
- /** The number of microseconds elapsed from 01.01.1970 until logging event
- was created. */
- log4cxx_time_t timeStamp;
+ /** The number of microseconds elapsed from 01.01.1970 until logging event
+ was created. */
+ log4cxx_time_t timeStamp;
- /** The is the location where this log statement was written. */
- const log4cxx::spi::LocationInfo locationInfo;
+ /** The is the location where this log statement was written. */
+ const log4cxx::spi::LocationInfo locationInfo;
- /** The identifier of thread in which this logging event
- was generated.
- */
- const LogString threadName;
+ /** The identifier of thread in which this logging event
+ was generated.
+ */
+ const LogString threadName;
- //
- // prevent copy and assignment
- //
- LoggingEvent(const LoggingEvent&);
- LoggingEvent& operator=(const LoggingEvent&);
- static const LogString getCurrentThreadName();
+ //
+ // prevent copy and assignment
+ //
+ LoggingEvent(const LoggingEvent&);
+ LoggingEvent& operator=(const LoggingEvent&);
+ static const LogString getCurrentThreadName();
- static void writeProlog(log4cxx::helpers::ObjectOutputStream& os, log4cxx::helpers::Pool& p);
+ static void writeProlog(log4cxx::helpers::ObjectOutputStream& os, log4cxx::helpers::Pool& p);
};
@@ -271,7 +271,7 @@
}
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
diff --git a/src/main/include/log4cxx/spi/optionhandler.h b/src/main/include/log4cxx/spi/optionhandler.h
index b86aa7a..58fdf7b 100644
--- a/src/main/include/log4cxx/spi/optionhandler.h
+++ b/src/main/include/log4cxx/spi/optionhandler.h
@@ -34,35 +34,35 @@
*/
class LOG4CXX_EXPORT OptionHandler : public virtual helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(OptionHandler)
- virtual ~OptionHandler() {}
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(OptionHandler)
+ virtual ~OptionHandler() {}
- /**
- Activate the options that were previously set with calls to option
- setters.
+ /**
+ Activate the options that were previously set with calls to option
+ setters.
- <p>This allows to defer activiation of the options until all
- options have been set. This is required for components which have
- related options that remain ambigous until all are set.
+ <p>This allows to defer activiation of the options until all
+ options have been set. This is required for components which have
+ related options that remain ambigous until all are set.
- <p>For example, the FileAppender has the {@link
- FileAppender#setFile File} and {@link
- FileAppender#setAppend Append} options both of
- which are ambigous until the other is also set. */
- virtual void activateOptions(log4cxx::helpers::Pool& p) = 0;
+ <p>For example, the FileAppender has the {@link
+ FileAppender#setFile File} and {@link
+ FileAppender#setAppend Append} options both of
+ which are ambigous until the other is also set. */
+ virtual void activateOptions(log4cxx::helpers::Pool& p) = 0;
- /**
- Set <code>option</code> to <code>value</code>.
+ /**
+ Set <code>option</code> to <code>value</code>.
- <p>The handling of each option depends on the OptionHandler
- instance. Some options may become active immediately whereas
- other may be activated only when #activateOptions is
- called.
- */
- virtual void setOption(const LogString& option,
- const LogString& value) = 0;
+ <p>The handling of each option depends on the OptionHandler
+ instance. Some options may become active immediately whereas
+ other may be activated only when #activateOptions is
+ called.
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value) = 0;
}; // class OptionConverter
} // namespace spi
diff --git a/src/main/include/log4cxx/spi/repositoryselector.h b/src/main/include/log4cxx/spi/repositoryselector.h
index 50131e8..fe9542d 100644
--- a/src/main/include/log4cxx/spi/repositoryselector.h
+++ b/src/main/include/log4cxx/spi/repositoryselector.h
@@ -42,10 +42,10 @@
*/
class LOG4CXX_EXPORT RepositorySelector : public virtual helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(RepositorySelector)
- virtual ~RepositorySelector() {}
- virtual LoggerRepositoryPtr& getLoggerRepository() = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(RepositorySelector)
+ virtual ~RepositorySelector() {}
+ virtual LoggerRepositoryPtr& getLoggerRepository() = 0;
};
LOG4CXX_PTR_DEF(RepositorySelector);
} //namespace spi
diff --git a/src/main/include/log4cxx/spi/rootlogger.h b/src/main/include/log4cxx/spi/rootlogger.h
index bb1073d..f2f3e8c 100644
--- a/src/main/include/log4cxx/spi/rootlogger.h
+++ b/src/main/include/log4cxx/spi/rootlogger.h
@@ -35,24 +35,24 @@
*/
class LOG4CXX_EXPORT RootLogger : public Logger
{
- public:
- /**
- The root logger names itself as "root". However, the root
- logger cannot be retrieved by name.
- */
- RootLogger(log4cxx::helpers::Pool& pool, const LevelPtr& level);
+ public:
+ /**
+ The root logger names itself as "root". However, the root
+ logger cannot be retrieved by name.
+ */
+ RootLogger(log4cxx::helpers::Pool& pool, const LevelPtr& level);
- /**
- Return the assigned level value without walking the logger
- hierarchy.
- */
- virtual const LevelPtr& getEffectiveLevel() const;
+ /**
+ Return the assigned level value without walking the logger
+ hierarchy.
+ */
+ virtual const LevelPtr& getEffectiveLevel() const;
- /**
- Setting a null value to the level of the root logger may have catastrophic
- results. We prevent this here.
- */
- void setLevel(const LevelPtr& level);
+ /**
+ Setting a null value to the level of the root logger may have catastrophic
+ results. We prevent this here.
+ */
+ void setLevel(const LevelPtr& level);
};
} // namespace spi
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/spi/triggeringeventevaluator.h b/src/main/include/log4cxx/spi/triggeringeventevaluator.h
index 2fac426..191c759 100644
--- a/src/main/include/log4cxx/spi/triggeringeventevaluator.h
+++ b/src/main/include/log4cxx/spi/triggeringeventevaluator.h
@@ -36,12 +36,12 @@
*/
class LOG4CXX_EXPORT TriggeringEventEvaluator : public virtual helpers::Object
{
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(TriggeringEventEvaluator)
- /**
- Is this the triggering event?
- */
- virtual bool isTriggeringEvent(const spi::LoggingEventPtr& event) = 0;
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(TriggeringEventEvaluator)
+ /**
+ Is this the triggering event?
+ */
+ virtual bool isTriggeringEvent(const spi::LoggingEventPtr& event) = 0;
};
LOG4CXX_PTR_DEF(TriggeringEventEvaluator);
}
diff --git a/src/main/include/log4cxx/stream.h b/src/main/include/log4cxx/stream.h
index 73814d2..8dcaf41 100644
--- a/src/main/include/log4cxx/stream.h
+++ b/src/main/include/log4cxx/stream.h
@@ -36,180 +36,180 @@
*/
class LOG4CXX_EXPORT logstream_base
{
- public:
- /**
- * Create new instance.
- * @param logger logger logger used in log requests.
- * @param level indicates level that will be used in log requests. Can
- * be modified later by inserting a level or calling setLevel.
- */
- logstream_base(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level);
- /**
- * Destructor.
- */
- virtual ~logstream_base();
- /**
- * Insertion operator for std::fixed and similar manipulators.
- */
- void insert(std::ios_base & (*manip)(std::ios_base&));
+ public:
+ /**
+ * Create new instance.
+ * @param logger logger logger used in log requests.
+ * @param level indicates level that will be used in log requests. Can
+ * be modified later by inserting a level or calling setLevel.
+ */
+ logstream_base(const log4cxx::LoggerPtr& logger,
+ const log4cxx::LevelPtr& level);
+ /**
+ * Destructor.
+ */
+ virtual ~logstream_base();
+ /**
+ * Insertion operator for std::fixed and similar manipulators.
+ */
+ void insert(std::ios_base & (*manip)(std::ios_base&));
- /**
- * get precision.
- */
- int precision();
- /**
- * get width.
- */
- int width();
- /**
- * set precision. This should be used in preference to inserting an std::setprecision(n)
- * since the other requires construction of an STL stream which may be expensive.
- */
- int precision(int newval);
- /**
- * set width. This should be used in preference to inserting an std::setw(n)
- * since the other requires construction of an STL stream which may be expensive.
- */
- int width(int newval);
- /**
- * Get fill character.
- */
- int fill();
- /**
- * Set fill character.
- */
- int fill(int newval);
+ /**
+ * get precision.
+ */
+ int precision();
+ /**
+ * get width.
+ */
+ int width();
+ /**
+ * set precision. This should be used in preference to inserting an std::setprecision(n)
+ * since the other requires construction of an STL stream which may be expensive.
+ */
+ int precision(int newval);
+ /**
+ * set width. This should be used in preference to inserting an std::setw(n)
+ * since the other requires construction of an STL stream which may be expensive.
+ */
+ int width(int newval);
+ /**
+ * Get fill character.
+ */
+ int fill();
+ /**
+ * Set fill character.
+ */
+ int fill(int newval);
- /**
- * Set flags. see std::ios_base.
- */
- std::ios_base::fmtflags flags(std::ios_base::fmtflags newflags);
- /**
- * Set flags. see std::ios_base.
- */
- std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags, std::ios_base::fmtflags mask);
- /**
- * Set flags. see std::ios_base.
- */
- std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags);
+ /**
+ * Set flags. see std::ios_base.
+ */
+ std::ios_base::fmtflags flags(std::ios_base::fmtflags newflags);
+ /**
+ * Set flags. see std::ios_base.
+ */
+ std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags, std::ios_base::fmtflags mask);
+ /**
+ * Set flags. see std::ios_base.
+ */
+ std::ios_base::fmtflags setf(std::ios_base::fmtflags newflags);
- /**
- * end of message manipulator, triggers logging.
- */
- static logstream_base& endmsg(logstream_base&);
+ /**
+ * end of message manipulator, triggers logging.
+ */
+ static logstream_base& endmsg(logstream_base&);
- /**
- * no-operation manipulator, Used to avoid ambiguity with VC6.
- */
- static logstream_base& nop(logstream_base&);
+ /**
+ * no-operation manipulator, Used to avoid ambiguity with VC6.
+ */
+ static logstream_base& nop(logstream_base&);
- /**
- * end of message action.
- */
- void end_message();
+ /**
+ * end of message action.
+ */
+ void end_message();
- /**
- * Set the level.
- * @param level level
- */
- void setLevel(const LevelPtr& level);
- /**
- * Returns true if the current level is the same or high as the
- * level of logger at time of construction or last setLevel.
- */
- inline bool isEnabled() const
- {
- return enabled;
- }
+ /**
+ * Set the level.
+ * @param level level
+ */
+ void setLevel(const LevelPtr& level);
+ /**
+ * Returns true if the current level is the same or high as the
+ * level of logger at time of construction or last setLevel.
+ */
+ inline bool isEnabled() const
+ {
+ return enabled;
+ }
- /**
- * Returns if logger is currently enabled for the specified level.
- */
- bool isEnabledFor(const LevelPtr& level) const;
+ /**
+ * Returns if logger is currently enabled for the specified level.
+ */
+ bool isEnabledFor(const LevelPtr& level) const;
- /**
- * Sets the location for subsequent log requests.
- */
- void setLocation(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Sets the location for subsequent log requests.
+ */
+ void setLocation(const log4cxx::spi::LocationInfo& location);
- /**
- * Sets the state of the embedded stream (if any)
- * to the state of the formatting info.
- * @param os stream to receive formatting info.
- * @param fillchar receives fill charater.
- * @return true if fill character was specified.
- */
- bool set_stream_state(std::ios_base& os, int& fillchar);
+ /**
+ * Sets the state of the embedded stream (if any)
+ * to the state of the formatting info.
+ * @param os stream to receive formatting info.
+ * @param fillchar receives fill charater.
+ * @return true if fill character was specified.
+ */
+ bool set_stream_state(std::ios_base& os, int& fillchar);
- protected:
- /**
- * Dispatches the pending log request.
- */
- virtual void log(LoggerPtr& logger,
- const LevelPtr& level,
- const log4cxx::spi::LocationInfo& location) = 0;
- /**
- * Erase any content in the message construction buffer.
- */
- virtual void erase() = 0;
- /**
- * Copy state of embedded stream (if any)
- * to value and mask instances of std::ios_base
- * and return fill character value.
- */
- virtual void get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const = 0;
- virtual void refresh_stream_state() = 0;
+ protected:
+ /**
+ * Dispatches the pending log request.
+ */
+ virtual void log(LoggerPtr& logger,
+ const LevelPtr& level,
+ const log4cxx::spi::LocationInfo& location) = 0;
+ /**
+ * Erase any content in the message construction buffer.
+ */
+ virtual void erase() = 0;
+ /**
+ * Copy state of embedded stream (if any)
+ * to value and mask instances of std::ios_base
+ * and return fill character value.
+ */
+ virtual void get_stream_state(std::ios_base& base,
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const = 0;
+ virtual void refresh_stream_state() = 0;
- private:
- /**
- * prevent copy constructor.
- */
- logstream_base(logstream_base&);
- /**
- * prevent copy operatpr.
- */
- logstream_base& operator=(logstream_base&);
- /**
- * Minimal extension of std::ios_base to allow creation
- * of embedded IO states.
- */
- class LOG4CXX_EXPORT logstream_ios_base : public std::ios_base
- {
- public:
- logstream_ios_base(std::ios_base::fmtflags initval,
- int initsize);
- } initset, initclear;
- /**
- * fill character.
- */
- int fillchar;
- /**
- * true if fill character is set.
- */
- bool fillset;
- /**
- * true if assigned level was same or higher than level of associated logger.
- */
- bool enabled;
- /**
- * associated logger.
- */
- log4cxx::LoggerPtr logger;
- /**
- * associated level.
- */
- log4cxx::LevelPtr level;
- /**
- * associated level.
- */
- log4cxx::spi::LocationInfo location;
+ private:
+ /**
+ * prevent copy constructor.
+ */
+ logstream_base(logstream_base&);
+ /**
+ * prevent copy operatpr.
+ */
+ logstream_base& operator=(logstream_base&);
+ /**
+ * Minimal extension of std::ios_base to allow creation
+ * of embedded IO states.
+ */
+ class LOG4CXX_EXPORT logstream_ios_base : public std::ios_base
+ {
+ public:
+ logstream_ios_base(std::ios_base::fmtflags initval,
+ int initsize);
+ } initset, initclear;
+ /**
+ * fill character.
+ */
+ int fillchar;
+ /**
+ * true if fill character is set.
+ */
+ bool fillset;
+ /**
+ * true if assigned level was same or higher than level of associated logger.
+ */
+ bool enabled;
+ /**
+ * associated logger.
+ */
+ log4cxx::LoggerPtr logger;
+ /**
+ * associated level.
+ */
+ log4cxx::LevelPtr level;
+ /**
+ * associated level.
+ */
+ log4cxx::spi::LocationInfo location;
};
typedef logstream_base& (*logstream_manipulator)(logstream_base&);
@@ -225,94 +225,94 @@
*/
class LOG4CXX_EXPORT logstream : public logstream_base
{
- typedef char Ch;
- public:
- /**
- * Constructor.
- */
- logstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level);
+ typedef char Ch;
+ public:
+ /**
+ * Constructor.
+ */
+ logstream(const log4cxx::LoggerPtr& logger,
+ const log4cxx::LevelPtr& level);
- /**
- * Constructor.
- */
- logstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ logstream(const Ch* loggerName,
+ const log4cxx::LevelPtr& level);
- /**
- * Constructor.
- */
- logstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ logstream(const std::basic_string<Ch>& loggerName,
+ const log4cxx::LevelPtr& level);
- ~logstream();
+ ~logstream();
- /**
- * Insertion operator for std::fixed and similar manipulators.
- */
- logstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
+ /**
+ * Insertion operator for std::fixed and similar manipulators.
+ */
+ logstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
- /**
- * Insertion operator for logstream_base::endmsg.
- */
- logstream& operator<<(logstream_manipulator manip);
+ /**
+ * Insertion operator for logstream_base::endmsg.
+ */
+ logstream& operator<<(logstream_manipulator manip);
- /**
- * Insertion operator for level.
- */
- logstream& operator<<(const log4cxx::LevelPtr& level);
- /**
- * Insertion operator for location.
- */
- logstream& operator<<(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Insertion operator for level.
+ */
+ logstream& operator<<(const log4cxx::LevelPtr& level);
+ /**
+ * Insertion operator for location.
+ */
+ logstream& operator<<(const log4cxx::spi::LocationInfo& location);
- /**
- * Alias for insertion operator for location. Kludge to avoid
- * inappropriate compiler ambiguity.
- */
- logstream& operator>>(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Alias for insertion operator for location. Kludge to avoid
+ * inappropriate compiler ambiguity.
+ */
+ logstream& operator>>(const log4cxx::spi::LocationInfo& location);
- /**
- * Cast operator to provide access to embedded std::basic_ostream.
- */
- operator std::basic_ostream<Ch>& ();
+ /**
+ * Cast operator to provide access to embedded std::basic_ostream.
+ */
+ operator std::basic_ostream<Ch>& ();
#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)
- /**
- * Template to allow any class with an std::basic_ostream inserter
- * to be applied to this class.
- */
- template <class V>
- inline log4cxx::logstream& operator<<(const V& val)
- {
- if (LOG4CXX_UNLIKELY(isEnabled()))
- {
- ((std::basic_ostream<char>&) *this) << val;
- }
+ /**
+ * Template to allow any class with an std::basic_ostream inserter
+ * to be applied to this class.
+ */
+ template <class V>
+ inline log4cxx::logstream& operator<<(const V& val)
+ {
+ if (LOG4CXX_UNLIKELY(isEnabled()))
+ {
+ ((std::basic_ostream<char>&) *this) << val;
+ }
- return *this;
- }
+ return *this;
+ }
#endif
- protected:
- virtual void log(LoggerPtr& logger,
- const LevelPtr& level,
- const log4cxx::spi::LocationInfo& location);
+ protected:
+ virtual void log(LoggerPtr& logger,
+ const LevelPtr& level,
+ const log4cxx::spi::LocationInfo& location);
- virtual void erase();
+ virtual void erase();
- virtual void get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const;
- virtual void refresh_stream_state();
+ virtual void get_stream_state(std::ios_base& base,
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const;
+ virtual void refresh_stream_state();
- private:
- logstream(const logstream&);
- logstream& operator=(const logstream&);
- std::basic_stringstream<Ch>* stream;
+ private:
+ logstream(const logstream&);
+ logstream& operator=(const logstream&);
+ std::basic_stringstream<Ch>* stream;
};
@@ -328,94 +328,94 @@
*/
class LOG4CXX_EXPORT wlogstream : public logstream_base
{
- typedef wchar_t Ch;
- public:
- /**
- * Constructor.
- */
- wlogstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level);
+ typedef wchar_t Ch;
+ public:
+ /**
+ * Constructor.
+ */
+ wlogstream(const log4cxx::LoggerPtr& logger,
+ const log4cxx::LevelPtr& level);
- /**
- * Constructor.
- */
- wlogstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ wlogstream(const Ch* loggerName,
+ const log4cxx::LevelPtr& level);
- /**
- * Constructor.
- */
- wlogstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ wlogstream(const std::basic_string<Ch>& loggerName,
+ const log4cxx::LevelPtr& level);
- ~wlogstream();
+ ~wlogstream();
- /**
- * Insertion operator for std::fixed and similar manipulators.
- */
- wlogstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
+ /**
+ * Insertion operator for std::fixed and similar manipulators.
+ */
+ wlogstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
- /**
- * Insertion operator for logstream_base::endmsg.
- */
- wlogstream& operator<<(logstream_manipulator manip);
+ /**
+ * Insertion operator for logstream_base::endmsg.
+ */
+ wlogstream& operator<<(logstream_manipulator manip);
- /**
- * Insertion operator for level.
- */
- wlogstream& operator<<(const log4cxx::LevelPtr& level);
- /**
- * Insertion operator for location.
- */
- wlogstream& operator<<(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Insertion operator for level.
+ */
+ wlogstream& operator<<(const log4cxx::LevelPtr& level);
+ /**
+ * Insertion operator for location.
+ */
+ wlogstream& operator<<(const log4cxx::spi::LocationInfo& location);
- /**
- * Alias for insertion operator for location. Kludge to avoid
- * inappropriate compiler ambiguity.
- */
- wlogstream& operator>>(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Alias for insertion operator for location. Kludge to avoid
+ * inappropriate compiler ambiguity.
+ */
+ wlogstream& operator>>(const log4cxx::spi::LocationInfo& location);
- /**
- * Cast operator to provide access to embedded std::basic_ostream.
- */
- operator std::basic_ostream<Ch>& ();
+ /**
+ * Cast operator to provide access to embedded std::basic_ostream.
+ */
+ operator std::basic_ostream<Ch>& ();
#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)
- /**
- * Template to allow any class with an std::basic_ostream inserter
- * to be applied to this class.
- */
- template <class V>
- inline log4cxx::wlogstream& operator<<(const V& val)
- {
- if (LOG4CXX_UNLIKELY(isEnabled()))
- {
- ((std::basic_ostream<wchar_t>&) *this) << val;
- }
+ /**
+ * Template to allow any class with an std::basic_ostream inserter
+ * to be applied to this class.
+ */
+ template <class V>
+ inline log4cxx::wlogstream& operator<<(const V& val)
+ {
+ if (LOG4CXX_UNLIKELY(isEnabled()))
+ {
+ ((std::basic_ostream<wchar_t>&) *this) << val;
+ }
- return *this;
- }
+ return *this;
+ }
#endif
- protected:
- virtual void log(LoggerPtr& logger,
- const LevelPtr& level,
- const log4cxx::spi::LocationInfo& location);
+ protected:
+ virtual void log(LoggerPtr& logger,
+ const LevelPtr& level,
+ const log4cxx::spi::LocationInfo& location);
- virtual void erase();
+ virtual void erase();
- virtual void get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const;
- virtual void refresh_stream_state();
+ virtual void get_stream_state(std::ios_base& base,
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const;
+ virtual void refresh_stream_state();
- private:
- wlogstream(const wlogstream&);
- wlogstream& operator=(const wlogstream&);
- std::basic_stringstream<Ch>* stream;
+ private:
+ wlogstream(const wlogstream&);
+ wlogstream& operator=(const wlogstream&);
+ std::basic_stringstream<Ch>* stream;
};
#endif
@@ -432,101 +432,101 @@
*/
class LOG4CXX_EXPORT ulogstream : public logstream_base
{
- typedef UniChar Ch;
- public:
- /**
- * Constructor.
- */
- ulogstream(const log4cxx::LoggerPtr& logger,
- const log4cxx::LevelPtr& level);
+ typedef UniChar Ch;
+ public:
+ /**
+ * Constructor.
+ */
+ ulogstream(const log4cxx::LoggerPtr& logger,
+ const log4cxx::LevelPtr& level);
#if LOG4CXX_UNICHAR_API
- /**
- * Constructor.
- */
- ulogstream(const Ch* loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ ulogstream(const Ch* loggerName,
+ const log4cxx::LevelPtr& level);
- /**
- * Constructor.
- */
- ulogstream(const std::basic_string<Ch>& loggerName,
- const log4cxx::LevelPtr& level);
+ /**
+ * Constructor.
+ */
+ ulogstream(const std::basic_string<Ch>& loggerName,
+ const log4cxx::LevelPtr& level);
#endif
#if LOG4CXX_CFSTRING_API
- ulogstream(const CFStringRef& loggerName,
- const log4cxx::LevelPtr& level);
+ ulogstream(const CFStringRef& loggerName,
+ const log4cxx::LevelPtr& level);
#endif
- ~ulogstream();
+ ~ulogstream();
- /**
- * Insertion operator for std::fixed and similar manipulators.
- */
- ulogstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
+ /**
+ * Insertion operator for std::fixed and similar manipulators.
+ */
+ ulogstream& operator<<(std::ios_base & (*manip)(std::ios_base&));
- /**
- * Insertion operator for logstream_base::endmsg.
- */
- ulogstream& operator<<(logstream_manipulator manip);
+ /**
+ * Insertion operator for logstream_base::endmsg.
+ */
+ ulogstream& operator<<(logstream_manipulator manip);
- /**
- * Insertion operator for level.
- */
- ulogstream& operator<<(const log4cxx::LevelPtr& level);
- /**
- * Insertion operator for location.
- */
- ulogstream& operator<<(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Insertion operator for level.
+ */
+ ulogstream& operator<<(const log4cxx::LevelPtr& level);
+ /**
+ * Insertion operator for location.
+ */
+ ulogstream& operator<<(const log4cxx::spi::LocationInfo& location);
- /**
- * Alias for insertion operator for location. Kludge to avoid
- * inappropriate compiler ambiguity.
- */
- ulogstream& operator>>(const log4cxx::spi::LocationInfo& location);
+ /**
+ * Alias for insertion operator for location. Kludge to avoid
+ * inappropriate compiler ambiguity.
+ */
+ ulogstream& operator>>(const log4cxx::spi::LocationInfo& location);
- /**
- * Cast operator to provide access to embedded std::basic_ostream.
- */
- operator std::basic_ostream<Ch>& ();
+ /**
+ * Cast operator to provide access to embedded std::basic_ostream.
+ */
+ operator std::basic_ostream<Ch>& ();
#if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE)
- /**
- * Template to allow any class with an std::basic_ostream inserter
- * to be applied to this class.
- */
- template <class V>
- inline ulogstream& operator<<(const V& val)
- {
- if (LOG4CXX_UNLIKELY(isEnabled()))
- {
- ((std::basic_ostream<Ch>&) *this) << val;
- }
+ /**
+ * Template to allow any class with an std::basic_ostream inserter
+ * to be applied to this class.
+ */
+ template <class V>
+ inline ulogstream& operator<<(const V& val)
+ {
+ if (LOG4CXX_UNLIKELY(isEnabled()))
+ {
+ ((std::basic_ostream<Ch>&) *this) << val;
+ }
- return *this;
- }
+ return *this;
+ }
#endif
- protected:
- virtual void log(LoggerPtr& logger,
- const LevelPtr& level,
- const log4cxx::spi::LocationInfo& location);
+ protected:
+ virtual void log(LoggerPtr& logger,
+ const LevelPtr& level,
+ const log4cxx::spi::LocationInfo& location);
- virtual void erase();
+ virtual void erase();
- virtual void get_stream_state(std::ios_base& base,
- std::ios_base& mask,
- int& fill,
- bool& fillSet) const;
- virtual void refresh_stream_state();
+ virtual void get_stream_state(std::ios_base& base,
+ std::ios_base& mask,
+ int& fill,
+ bool& fillSet) const;
+ virtual void refresh_stream_state();
- private:
- ulogstream(const ulogstream&);
- ulogstream& operator=(const ulogstream&);
- std::basic_stringstream<Ch>* stream;
+ private:
+ ulogstream(const ulogstream&);
+ ulogstream& operator=(const ulogstream&);
+ std::basic_stringstream<Ch>* stream;
};
#endif
@@ -549,12 +549,12 @@
template <class V>
inline log4cxx::logstream& operator<<(log4cxx::logstream& os, const V& val)
{
- if (LOG4CXX_UNLIKELY(os.isEnabled()))
- {
- ((std::basic_ostream<char>&) os) << val;
- }
+ if (LOG4CXX_UNLIKELY(os.isEnabled()))
+ {
+ ((std::basic_ostream<char>&) os) << val;
+ }
- return os;
+ return os;
}
#if LOG4CXX_WCHAR_T_API
@@ -565,22 +565,22 @@
template <class V>
inline log4cxx::wlogstream& operator<<(log4cxx::wlogstream& os, const V& val)
{
- if (LOG4CXX_UNLIKELY(os.isEnabled()))
- {
- ((std::basic_ostream<wchar_t>&) os) << val;
- }
+ if (LOG4CXX_UNLIKELY(os.isEnabled()))
+ {
+ ((std::basic_ostream<wchar_t>&) os) << val;
+ }
- return os;
+ return os;
}
#endif
#endif
#if !defined(LOG4CXX_ENDMSG)
- #if LOG4CXX_LOGSTREAM_ADD_NOP
- #define LOG4CXX_ENDMSG (log4cxx::logstream_manipulator) log4cxx::logstream_base::nop >> LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
- #else
- #define LOG4CXX_ENDMSG LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
- #endif
+ #if LOG4CXX_LOGSTREAM_ADD_NOP
+ #define LOG4CXX_ENDMSG (log4cxx::logstream_manipulator) log4cxx::logstream_base::nop >> LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
+ #else
+ #define LOG4CXX_ENDMSG LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg
+ #endif
#endif
diff --git a/src/main/include/log4cxx/ttcclayout.h b/src/main/include/log4cxx/ttcclayout.h
index 17e156b..4f9a810 100644
--- a/src/main/include/log4cxx/ttcclayout.h
+++ b/src/main/include/log4cxx/ttcclayout.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_TTCC_LAYOUT_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/helpers/datelayout.h>
@@ -72,135 +72,135 @@
*/
class LOG4CXX_EXPORT TTCCLayout : public helpers::DateLayout
{
- private:
- // Internal representation of options
- bool threadPrinting;
- bool categoryPrefixing;
- bool contextPrinting;
- bool filePrinting;
+ private:
+ // Internal representation of options
+ bool threadPrinting;
+ bool categoryPrefixing;
+ bool contextPrinting;
+ bool filePrinting;
- public:
- DECLARE_LOG4CXX_OBJECT(TTCCLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TTCCLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(TTCCLayout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TTCCLayout)
+ LOG4CXX_CAST_ENTRY_CHAIN(Layout)
+ END_LOG4CXX_CAST_MAP()
- /**
- Instantiate a TTCCLayout object with {@link
- helpers::RelativeTimeDateFormat RelativeTimeDateFormat} as the date
- formatter in the local time zone.
- */
- TTCCLayout();
+ /**
+ Instantiate a TTCCLayout object with {@link
+ helpers::RelativeTimeDateFormat RelativeTimeDateFormat} as the date
+ formatter in the local time zone.
+ */
+ TTCCLayout();
- /**
- Instantiate a TTCCLayout object using the local time zone. The
- DateFormat used will depend on the <code>dateFormatType</code>.
- <p>This constructor just calls the {@link
- helpers::DateLayout#setDateFormat DateLayout::setDateFormat} method.
- */
- TTCCLayout(const LogString& dateFormatType);
+ /**
+ Instantiate a TTCCLayout object using the local time zone. The
+ DateFormat used will depend on the <code>dateFormatType</code>.
+ <p>This constructor just calls the {@link
+ helpers::DateLayout#setDateFormat DateLayout::setDateFormat} method.
+ */
+ TTCCLayout(const LogString& dateFormatType);
- /**
- The <b>ThreadPrinting</b> option specifies whether the name of the
- current thread is part of log output or not. This is true by default.
- */
- inline void setThreadPrinting(bool threadPrinting1)
- {
- this->threadPrinting = threadPrinting1;
- }
+ /**
+ The <b>ThreadPrinting</b> option specifies whether the name of the
+ current thread is part of log output or not. This is true by default.
+ */
+ inline void setThreadPrinting(bool threadPrinting1)
+ {
+ this->threadPrinting = threadPrinting1;
+ }
- /**
- Returns value of the <b>ThreadPrinting</b> option.
- */
- inline bool getThreadPrinting() const
- {
- return threadPrinting;
- }
+ /**
+ Returns value of the <b>ThreadPrinting</b> option.
+ */
+ inline bool getThreadPrinting() const
+ {
+ return threadPrinting;
+ }
- /**
- The <b>CategoryPrefixing</b> option specifies whether Logger
- name is part of log output or not. This is true by default.
- */
- inline void setCategoryPrefixing(bool categoryPrefixing1)
- {
- this->categoryPrefixing = categoryPrefixing1;
- }
+ /**
+ The <b>CategoryPrefixing</b> option specifies whether Logger
+ name is part of log output or not. This is true by default.
+ */
+ inline void setCategoryPrefixing(bool categoryPrefixing1)
+ {
+ this->categoryPrefixing = categoryPrefixing1;
+ }
- /**
- Returns value of the <b>CategoryPrefixing</b> option.
- */
- inline bool getCategoryPrefixing() const
- {
- return categoryPrefixing;
- }
+ /**
+ Returns value of the <b>CategoryPrefixing</b> option.
+ */
+ inline bool getCategoryPrefixing() const
+ {
+ return categoryPrefixing;
+ }
- /**
- The <b>ContextPrinting</b> option specifies log output will include
- the nested context information belonging to the current thread.
- This is true by default.
- */
- inline void setContextPrinting(bool contextPrinting1)
- {
- this->contextPrinting = contextPrinting1;
- }
+ /**
+ The <b>ContextPrinting</b> option specifies log output will include
+ the nested context information belonging to the current thread.
+ This is true by default.
+ */
+ inline void setContextPrinting(bool contextPrinting1)
+ {
+ this->contextPrinting = contextPrinting1;
+ }
- /**
- Returns value of the <b>ContextPrinting</b> option.
- */
- inline bool getContextPrinting() const
- {
- return contextPrinting;
- }
+ /**
+ Returns value of the <b>ContextPrinting</b> option.
+ */
+ inline bool getContextPrinting() const
+ {
+ return contextPrinting;
+ }
- /**
- The <b>FilePrinting</b> option specifies log output will include
- the file and the line where the log statement was written.
- */
- inline void setFilePrinting(bool filePrinting1)
- {
- this->filePrinting = filePrinting1;
- }
+ /**
+ The <b>FilePrinting</b> option specifies log output will include
+ the file and the line where the log statement was written.
+ */
+ inline void setFilePrinting(bool filePrinting1)
+ {
+ this->filePrinting = filePrinting1;
+ }
- /**
- Returns value of the <b>ContextPrinting</b> option.
- */
- inline bool getFilePrinting() const
- {
- return filePrinting;
- }
+ /**
+ Returns value of the <b>ContextPrinting</b> option.
+ */
+ inline bool getFilePrinting() const
+ {
+ return filePrinting;
+ }
- /**
- In addition to the level of the statement and message, this function
- writes to the ouput stream time, thread, logger and NDC
- information.
+ /**
+ In addition to the level of the statement and message, this function
+ writes to the ouput stream time, thread, logger and NDC
+ information.
- <p>Time, thread, logger and diagnostic context are printed
- depending on options.
+ <p>Time, thread, logger and diagnostic context are printed
+ depending on options.
- @param output destination to receive formatted output.
- @param event event to format.
- @param pool pool used to allocate memory needed during formatting.
- */
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;
+ @param output destination to receive formatted output.
+ @param event event to format.
+ @param pool pool used to allocate memory needed during formatting.
+ */
+ virtual void format(LogString& output,
+ const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;
- /**
- The TTCCLayout does not handle the throwable contained within
- {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
- <code>true</code>.
- */
- virtual bool ignoresThrowable() const
- {
- return true;
- }
+ /**
+ The TTCCLayout does not handle the throwable contained within
+ {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
+ <code>true</code>.
+ */
+ virtual bool ignoresThrowable() const
+ {
+ return true;
+ }
};
LOG4CXX_PTR_DEF(TTCCLayout);
}
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif
diff --git a/src/main/include/log4cxx/varia/fallbackerrorhandler.h b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
index fe09093..728398e 100644
--- a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
+++ b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
@@ -38,78 +38,78 @@
logged in the new secondary appender.
*/
class LOG4CXX_EXPORT FallbackErrorHandler :
- public virtual spi::ErrorHandler,
- public virtual helpers::ObjectImpl
+ public virtual spi::ErrorHandler,
+ public virtual helpers::ObjectImpl
{
- private:
- AppenderPtr backup;
- AppenderPtr primary;
- std::vector<LoggerPtr> loggers;
+ private:
+ AppenderPtr backup;
+ AppenderPtr primary;
+ std::vector<LoggerPtr> loggers;
- public:
- DECLARE_LOG4CXX_OBJECT(FallbackErrorHandler)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(FallbackErrorHandler)
- LOG4CXX_CAST_ENTRY_CHAIN(spi::ErrorHandler)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(FallbackErrorHandler)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(FallbackErrorHandler)
+ LOG4CXX_CAST_ENTRY_CHAIN(spi::ErrorHandler)
+ END_LOG4CXX_CAST_MAP()
- FallbackErrorHandler();
- void addRef() const;
- void releaseRef() const;
+ FallbackErrorHandler();
+ void addRef() const;
+ void releaseRef() const;
- /**
- <em>Adds</em> the logger passed as parameter to the list of
- loggers that we need to search for in case of appender failure.
- */
- void setLogger(const LoggerPtr& logger);
+ /**
+ <em>Adds</em> the logger passed as parameter to the list of
+ loggers that we need to search for in case of appender failure.
+ */
+ void setLogger(const LoggerPtr& logger);
- /**
- No options to activate.
- */
- void activateOptions(log4cxx::helpers::Pool& p);
- void setOption(const LogString& option, const LogString& value);
+ /**
+ No options to activate.
+ */
+ void activateOptions(log4cxx::helpers::Pool& p);
+ void setOption(const LogString& option, const LogString& value);
- /**
- Prints the message and the stack trace of the exception on
- <code>System.err</code>.
- */
- void error(const LogString& message, const std::exception& e,
- int errorCode) const;
+ /**
+ Prints the message and the stack trace of the exception on
+ <code>System.err</code>.
+ */
+ void error(const LogString& message, const std::exception& e,
+ int errorCode) const;
- /**
- Prints the message and the stack trace of the exception on
- <code>System.err</code>.
- */
- void error(const LogString& message, const std::exception& e,
- int errorCode, const spi::LoggingEventPtr& event) const;
+ /**
+ Prints the message and the stack trace of the exception on
+ <code>System.err</code>.
+ */
+ void error(const LogString& message, const std::exception& e,
+ int errorCode, const spi::LoggingEventPtr& event) const;
- /**
- Print a the error message passed as parameter on
- <code>System.err</code>.
- */
- void error(const LogString& /* message */) const {}
+ /**
+ Print a the error message passed as parameter on
+ <code>System.err</code>.
+ */
+ void error(const LogString& /* message */) const {}
- /**
- Return the backup appender.
- */
- const AppenderPtr& getBackupAppender() const
- {
- return backup;
- }
+ /**
+ Return the backup appender.
+ */
+ const AppenderPtr& getBackupAppender() const
+ {
+ return backup;
+ }
- /**
- The appender to which this error handler is attached.
- */
- void setAppender(const AppenderPtr& primary);
+ /**
+ The appender to which this error handler is attached.
+ */
+ void setAppender(const AppenderPtr& primary);
- /**
- Set the backup appender.
- */
- void setBackupAppender(const AppenderPtr& backup);
+ /**
+ Set the backup appender.
+ */
+ void setBackupAppender(const AppenderPtr& backup);
};
LOG4CXX_PTR_DEF(FallbackErrorHandler);
diff --git a/src/main/include/log4cxx/writerappender.h b/src/main/include/log4cxx/writerappender.h
index 2507af1..677c4de 100644
--- a/src/main/include/log4cxx/writerappender.h
+++ b/src/main/include/log4cxx/writerappender.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_WRITER_APPENDER_H
#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning ( push )
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/appenderskeleton.h>
@@ -39,181 +39,181 @@
*/
class LOG4CXX_EXPORT WriterAppender : public AppenderSkeleton
{
- private:
- /**
- Immediate flush means that the underlying writer or output stream
- will be flushed at the end of each append operation. Immediate
- flush is slower but ensures that each append request is actually
- written. If <code>immediateFlush</code> is set to
- <code>false</code>, then there is a good chance that the last few
- logs events are not actually written to persistent media if and
- when the application crashes.
+ private:
+ /**
+ Immediate flush means that the underlying writer or output stream
+ will be flushed at the end of each append operation. Immediate
+ flush is slower but ensures that each append request is actually
+ written. If <code>immediateFlush</code> is set to
+ <code>false</code>, then there is a good chance that the last few
+ logs events are not actually written to persistent media if and
+ when the application crashes.
- <p>The <code>immediateFlush</code> variable is set to
- <code>true</code> by default.
+ <p>The <code>immediateFlush</code> variable is set to
+ <code>true</code> by default.
- */
- bool immediateFlush;
+ */
+ bool immediateFlush;
- /**
- The encoding to use when opening an input stream.
- <p>The <code>encoding</code> variable is set to <code>""</code> by
- default which results in the utilization of the system's default
- encoding. */
- LogString encoding;
+ /**
+ The encoding to use when opening an input stream.
+ <p>The <code>encoding</code> variable is set to <code>""</code> by
+ default which results in the utilization of the system's default
+ encoding. */
+ LogString encoding;
- /**
- * This is the {@link Writer Writer} where we will write to.
- */
- log4cxx::helpers::WriterPtr writer;
+ /**
+ * This is the {@link Writer Writer} where we will write to.
+ */
+ log4cxx::helpers::WriterPtr writer;
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(WriterAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(WriterAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(WriterAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(WriterAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
- /**
- This default constructor does nothing.*/
- WriterAppender();
- protected:
- WriterAppender(const LayoutPtr& layout,
- log4cxx::helpers::WriterPtr& writer);
- WriterAppender(const LayoutPtr& layout);
+ /**
+ This default constructor does nothing.*/
+ WriterAppender();
+ protected:
+ WriterAppender(const LayoutPtr& layout,
+ log4cxx::helpers::WriterPtr& writer);
+ WriterAppender(const LayoutPtr& layout);
- public:
- ~WriterAppender();
+ public:
+ ~WriterAppender();
- /**
- Derived appenders should override this method if option structure
- requires it.
- */
- virtual void activateOptions(log4cxx::helpers::Pool& pool);
+ /**
+ Derived appenders should override this method if option structure
+ requires it.
+ */
+ virtual void activateOptions(log4cxx::helpers::Pool& pool);
- /**
- If the <b>ImmediateFlush</b> option is set to
- <code>true</code>, the appender will flush at the end of each
- write. This is the default behavior. If the option is set to
- <code>false</code>, then the underlying stream can defer writing
- to physical medium to a later time.
+ /**
+ If the <b>ImmediateFlush</b> option is set to
+ <code>true</code>, the appender will flush at the end of each
+ write. This is the default behavior. If the option is set to
+ <code>false</code>, then the underlying stream can defer writing
+ to physical medium to a later time.
- <p>Avoiding the flush operation at the end of each append results in
- a performance gain of 10 to 20 percent. However, there is safety
- tradeoff involved in skipping flushing. Indeed, when flushing is
- skipped, then it is likely that the last few log events will not
- be recorded on disk when the application exits. This is a high
- price to pay even for a 20% performance gain.
- */
- void setImmediateFlush(bool value);
- /**
- Returns value of the <b>ImmediateFlush</b> option.
- */
- bool getImmediateFlush() const
- {
- return immediateFlush;
- }
+ <p>Avoiding the flush operation at the end of each append results in
+ a performance gain of 10 to 20 percent. However, there is safety
+ tradeoff involved in skipping flushing. Indeed, when flushing is
+ skipped, then it is likely that the last few log events will not
+ be recorded on disk when the application exits. This is a high
+ price to pay even for a 20% performance gain.
+ */
+ void setImmediateFlush(bool value);
+ /**
+ Returns value of the <b>ImmediateFlush</b> option.
+ */
+ bool getImmediateFlush() const
+ {
+ return immediateFlush;
+ }
- /**
- This method is called by the AppenderSkeleton#doAppend
- method.
+ /**
+ This method is called by the AppenderSkeleton#doAppend
+ method.
- <p>If the output stream exists and is writable then write a log
- statement to the output stream. Otherwise, write a single warning
- message to <code>stderr</code>.
+ <p>If the output stream exists and is writable then write a log
+ statement to the output stream. Otherwise, write a single warning
+ message to <code>stderr</code>.
- <p>The format of the output will depend on this appender's
- layout.
+ <p>The format of the output will depend on this appender's
+ layout.
- */
- virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ */
+ virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- protected:
- /**
- This method determines if there is a sense in attempting to append.
+ protected:
+ /**
+ This method determines if there is a sense in attempting to append.
- <p>It checks whether there is a set output target and also if
- there is a set layout. If these checks fail, then the boolean
- value <code>false</code> is returned. */
- virtual bool checkEntryConditions() const;
+ <p>It checks whether there is a set output target and also if
+ there is a set layout. If these checks fail, then the boolean
+ value <code>false</code> is returned. */
+ virtual bool checkEntryConditions() const;
- public:
- /**
- Close this appender instance. The underlying stream or writer is
- also closed.
+ public:
+ /**
+ Close this appender instance. The underlying stream or writer is
+ also closed.
- <p>Closed appenders cannot be reused.
- */
- virtual void close();
+ <p>Closed appenders cannot be reused.
+ */
+ virtual void close();
- protected:
- /**
- * Close the underlying {@link log4cxx::helpers::Writer}.
- * */
- void closeWriter();
+ protected:
+ /**
+ * Close the underlying {@link log4cxx::helpers::Writer}.
+ * */
+ void closeWriter();
- /**
- Returns an OutputStreamWriter when passed an OutputStream. The
- encoding used will depend on the value of the
- <code>encoding</code> property. If the encoding value is
- specified incorrectly the writer will be opened using the default
- system encoding (an error message will be printed to the loglog. */
- virtual log4cxx::helpers::WriterPtr createWriter(
- log4cxx::helpers::OutputStreamPtr& os);
+ /**
+ Returns an OutputStreamWriter when passed an OutputStream. The
+ encoding used will depend on the value of the
+ <code>encoding</code> property. If the encoding value is
+ specified incorrectly the writer will be opened using the default
+ system encoding (an error message will be printed to the loglog. */
+ virtual log4cxx::helpers::WriterPtr createWriter(
+ log4cxx::helpers::OutputStreamPtr& os);
- public:
- LogString getEncoding() const;
- void setEncoding(const LogString& value);
- void setOption(const LogString& option,
- const LogString& value);
+ public:
+ LogString getEncoding() const;
+ void setEncoding(const LogString& value);
+ void setOption(const LogString& option,
+ const LogString& value);
- /**
- <p>Sets the Writer where the log output will go. The
- specified Writer must be opened by the user and be
- writable.
+ /**
+ <p>Sets the Writer where the log output will go. The
+ specified Writer must be opened by the user and be
+ writable.
- <p>The <code>java.io.Writer</code> will be closed when the
- appender instance is closed.
+ <p>The <code>java.io.Writer</code> will be closed when the
+ appender instance is closed.
- <p><b>WARNING:</b> Logging to an unopened Writer will fail.
- <p>
- @param writer An already opened Writer. */
- void setWriter(const log4cxx::helpers::WriterPtr& writer);
+ <p><b>WARNING:</b> Logging to an unopened Writer will fail.
+ <p>
+ @param writer An already opened Writer. */
+ void setWriter(const log4cxx::helpers::WriterPtr& writer);
#ifdef LOG4CXX_MULTI_PROCESS
- const log4cxx::helpers::WriterPtr getWriter()
- {
- return writer;
- };
+ const log4cxx::helpers::WriterPtr getWriter()
+ {
+ return writer;
+ };
#endif
- virtual bool requiresLayout() const;
+ virtual bool requiresLayout() const;
- protected:
- /**
- Actual writing occurs here.
- */
- virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
+ protected:
+ /**
+ Actual writing occurs here.
+ */
+ virtual void subAppend(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
- /**
- Write a footer as produced by the embedded layout's
- Layout#appendFooter method. */
- virtual void writeFooter(log4cxx::helpers::Pool& p);
+ /**
+ Write a footer as produced by the embedded layout's
+ Layout#appendFooter method. */
+ virtual void writeFooter(log4cxx::helpers::Pool& p);
- /**
- Write a header as produced by the embedded layout's
- Layout#appendHeader method. */
- virtual void writeHeader(log4cxx::helpers::Pool& p);
+ /**
+ Write a header as produced by the embedded layout's
+ Layout#appendHeader method. */
+ virtual void writeHeader(log4cxx::helpers::Pool& p);
- private:
- //
- // prevent copy and assignment
- WriterAppender(const WriterAppender&);
- WriterAppender& operator=(const WriterAppender&);
+ private:
+ //
+ // prevent copy and assignment
+ WriterAppender(const WriterAppender&);
+ WriterAppender& operator=(const WriterAppender&);
};
LOG4CXX_PTR_DEF(WriterAppender);
@@ -221,7 +221,7 @@
} //namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning ( pop )
+ #pragma warning ( pop )
#endif
#endif //_LOG4CXX_WRITER_APPENDER_H
diff --git a/src/main/include/log4cxx/xml/domconfigurator.h b/src/main/include/log4cxx/xml/domconfigurator.h
index eb049b3..e6ed348 100644
--- a/src/main/include/log4cxx/xml/domconfigurator.h
+++ b/src/main/include/log4cxx/xml/domconfigurator.h
@@ -19,8 +19,8 @@
#define _LOG4CXX_XML_DOM_CONFIGURATOR_H
#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
+ #pragma warning (push)
+ #pragma warning ( disable: 4231 4251 4275 4786 )
#endif
@@ -40,8 +40,8 @@
#include <log4cxx/config/propertysetter.h>
extern "C" {
- struct apr_xml_doc;
- struct apr_xml_elem;
+ struct apr_xml_doc;
+ struct apr_xml_elem;
}
namespace log4cxx
@@ -67,251 +67,251 @@
<p>There are sample XML files included in the package.
*/
class LOG4CXX_EXPORT DOMConfigurator :
- virtual public spi::Configurator,
- virtual public helpers::ObjectImpl
+ virtual public spi::Configurator,
+ virtual public helpers::ObjectImpl
{
- protected:
- typedef std::map<LogString, AppenderPtr> AppenderMap;
- /**
- Used internally to parse appenders by IDREF name.
- */
- AppenderPtr findAppenderByName(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* elem,
- apr_xml_doc* doc,
- const LogString& appenderName,
- AppenderMap& appenders);
+ protected:
+ typedef std::map<LogString, AppenderPtr> AppenderMap;
+ /**
+ Used internally to parse appenders by IDREF name.
+ */
+ AppenderPtr findAppenderByName(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* elem,
+ apr_xml_doc* doc,
+ const LogString& appenderName,
+ AppenderMap& appenders);
- /**
- Used internally to parse appenders by IDREF element.
- */
- AppenderPtr findAppenderByReference(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* appenderRef,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to parse appenders by IDREF element.
+ */
+ AppenderPtr findAppenderByReference(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* appenderRef,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- /**
- Used internally to parse an appender element.
- */
- AppenderPtr parseAppender(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* appenderElement,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to parse an appender element.
+ */
+ AppenderPtr parseAppender(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* appenderElement,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- /**
- Used internally to parse an {@link spi::ErrorHandler ErrorHandler } element.
- */
- void parseErrorHandler(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- AppenderPtr& appender,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to parse an {@link spi::ErrorHandler ErrorHandler } element.
+ */
+ void parseErrorHandler(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ AppenderPtr& appender,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- /**
- Used internally to parse a filter element.
- */
- void parseFilters(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- std::vector<log4cxx::spi::FilterPtr>& filters);
+ /**
+ Used internally to parse a filter element.
+ */
+ void parseFilters(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ std::vector<log4cxx::spi::FilterPtr>& filters);
- /**
- Used internally to parse a logger element.
- */
- void parseLogger(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* loggerElement,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to parse a logger element.
+ */
+ void parseLogger(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* loggerElement,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- /**
- Used internally to parse the logger factory element.
- */
- void parseLoggerFactory(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* factoryElement);
+ /**
+ Used internally to parse the logger factory element.
+ */
+ void parseLoggerFactory(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* factoryElement);
- /**
- Used internally to parse the logger factory element.
- */
- log4cxx::helpers::ObjectPtr parseTriggeringPolicy(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* factoryElement);
+ /**
+ Used internally to parse the logger factory element.
+ */
+ log4cxx::helpers::ObjectPtr parseTriggeringPolicy(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* factoryElement);
- /**
- Used internally to parse the logger factory element.
- */
- log4cxx::rolling::RollingPolicyPtr parseRollingPolicy(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* factoryElement);
+ /**
+ Used internally to parse the logger factory element.
+ */
+ log4cxx::rolling::RollingPolicyPtr parseRollingPolicy(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* factoryElement);
- /**
- Used internally to parse the root logger element.
- */
- void parseRoot(log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* rootElement, apr_xml_doc* doc, AppenderMap& appenders);
+ /**
+ Used internally to parse the root logger element.
+ */
+ void parseRoot(log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* rootElement, apr_xml_doc* doc, AppenderMap& appenders);
- /**
- Used internally to parse the children of a logger element.
- */
- void parseChildrenOfLoggerElement(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* catElement,
- LoggerPtr logger, bool isRoot,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to parse the children of a logger element.
+ */
+ void parseChildrenOfLoggerElement(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* catElement,
+ LoggerPtr logger, bool isRoot,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- /**
- Used internally to parse a layout element.
- */
- LayoutPtr parseLayout(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* layout_element);
+ /**
+ Used internally to parse a layout element.
+ */
+ LayoutPtr parseLayout(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* layout_element);
- /**
- Used internally to parse a level element.
- */
- void parseLevel(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- LoggerPtr logger, bool isRoot);
+ /**
+ Used internally to parse a level element.
+ */
+ void parseLevel(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ LoggerPtr logger, bool isRoot);
- void setParameter(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* elem,
- log4cxx::config::PropertySetter& propSetter);
+ void setParameter(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* elem,
+ log4cxx::config::PropertySetter& propSetter);
- /**
- Used internally to configure the log4cxx framework from
- an in-memory representation of an XML document.
- */
- void parse(
- log4cxx::helpers::Pool& p,
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem* element,
- apr_xml_doc* doc,
- AppenderMap& appenders);
+ /**
+ Used internally to configure the log4cxx framework from
+ an in-memory representation of an XML document.
+ */
+ void parse(
+ log4cxx::helpers::Pool& p,
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem* element,
+ apr_xml_doc* doc,
+ AppenderMap& appenders);
- public:
- DOMConfigurator();
+ public:
+ DOMConfigurator();
- DECLARE_LOG4CXX_OBJECT(DOMConfigurator)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(spi::Configurator)
- END_LOG4CXX_CAST_MAP()
+ DECLARE_LOG4CXX_OBJECT(DOMConfigurator)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(spi::Configurator)
+ END_LOG4CXX_CAST_MAP()
- DOMConfigurator(log4cxx::helpers::Pool& p);
+ DOMConfigurator(log4cxx::helpers::Pool& p);
- void addRef() const;
- void releaseRef() const;
+ void addRef() const;
+ void releaseRef() const;
- /**
- A static version of #doConfigure.
- */
- static void configure(const std::string& filename);
+ /**
+ A static version of #doConfigure.
+ */
+ static void configure(const std::string& filename);
#if LOG4CXX_WCHAR_T_API
- static void configure(const std::wstring& filename);
+ static void configure(const std::wstring& filename);
#endif
#if LOG4CXX_UNICHAR_API
- static void configure(const std::basic_string<UniChar>& filename);
+ static void configure(const std::basic_string<UniChar>& filename);
#endif
#if LOG4CXX_CFSTRING_API
- static void configure(const CFStringRef& filename);
+ static void configure(const CFStringRef& filename);
#endif
- /**
- Like #configureAndWatch(const std::string& configFilename, long delay)
- except that the default delay as defined by
- log4cxx::helpers::FileWatchdog#DEFAULT_DELAY is used.
- @param configFilename A log4j configuration file in XML format.
- */
- static void configureAndWatch(const std::string& configFilename);
+ /**
+ Like #configureAndWatch(const std::string& configFilename, long delay)
+ except that the default delay as defined by
+ log4cxx::helpers::FileWatchdog#DEFAULT_DELAY is used.
+ @param configFilename A log4j configuration file in XML format.
+ */
+ static void configureAndWatch(const std::string& configFilename);
#if LOG4CXX_WCHAR_T_API
- static void configureAndWatch(const std::wstring& configFilename);
+ static void configureAndWatch(const std::wstring& configFilename);
#endif
#if LOG4CXX_UNICHAR_API
- static void configureAndWatch(const std::basic_string<UniChar>& configFilename);
+ static void configureAndWatch(const std::basic_string<UniChar>& configFilename);
#endif
#if LOG4CXX_CFSTRING_API
- static void configureAndWatch(const CFStringRef& configFilename);
+ static void configureAndWatch(const CFStringRef& configFilename);
#endif
- /**
- Read the configuration file <code>configFilename</code> if it
- exists. Moreover, a thread will be created that will periodically
- check if <code>configFilename</code> has been created or
- modified. The period is determined by the <code>delay</code>
- argument. If a change or file creation is detected, then
- <code>configFilename</code> is read to configure log4cxx.
+ /**
+ Read the configuration file <code>configFilename</code> if it
+ exists. Moreover, a thread will be created that will periodically
+ check if <code>configFilename</code> has been created or
+ modified. The period is determined by the <code>delay</code>
+ argument. If a change or file creation is detected, then
+ <code>configFilename</code> is read to configure log4cxx.
- @param configFilename A log4j configuration file in XML format.
- @param delay The delay in milliseconds to wait between each check.
- */
- static void configureAndWatch(const std::string& configFilename,
- long delay);
+ @param configFilename A log4j configuration file in XML format.
+ @param delay The delay in milliseconds to wait between each check.
+ */
+ static void configureAndWatch(const std::string& configFilename,
+ long delay);
#if LOG4CXX_WCHAR_T_API
- static void configureAndWatch(const std::wstring& configFilename,
- long delay);
+ static void configureAndWatch(const std::wstring& configFilename,
+ long delay);
#endif
#if LOG4CXX_UNICHAR_API
- static void configureAndWatch(const std::basic_string<UniChar>& configFilename,
- long delay);
+ static void configureAndWatch(const std::basic_string<UniChar>& configFilename,
+ long delay);
#endif
#if LOG4CXX_CFSTRING_API
- static void configureAndWatch(const CFStringRef& configFilename,
- long delay);
+ static void configureAndWatch(const CFStringRef& configFilename,
+ long delay);
#endif
- /**
- Interpret the XML file pointed by <code>filename</code> and set up
- log4cxx accordingly.
- <p>The configuration is done relative to the hierarchy parameter.
- @param filename The file to parse.
- @param repository The hierarchy to operation upon.
- */
- void doConfigure(const File& filename,
- spi::LoggerRepositoryPtr& repository);
+ /**
+ Interpret the XML file pointed by <code>filename</code> and set up
+ log4cxx accordingly.
+ <p>The configuration is done relative to the hierarchy parameter.
+ @param filename The file to parse.
+ @param repository The hierarchy to operation upon.
+ */
+ void doConfigure(const File& filename,
+ spi::LoggerRepositoryPtr& repository);
- protected:
- static LogString getAttribute(
- log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
- apr_xml_elem*,
- const std::string& attrName);
+ protected:
+ static LogString getAttribute(
+ log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
+ apr_xml_elem*,
+ const std::string& attrName);
- LogString subst(const LogString& value);
+ LogString subst(const LogString& value);
- protected:
- helpers::Properties props;
- spi::LoggerRepositoryPtr repository;
- spi::LoggerFactoryPtr loggerFactory;
+ protected:
+ helpers::Properties props;
+ spi::LoggerRepositoryPtr repository;
+ spi::LoggerFactoryPtr loggerFactory;
- private:
- // prevent assignment or copy statements
- DOMConfigurator(const DOMConfigurator&);
- DOMConfigurator& operator=(const DOMConfigurator&);
- static XMLWatchdog* xdog;
+ private:
+ // prevent assignment or copy statements
+ DOMConfigurator(const DOMConfigurator&);
+ DOMConfigurator& operator=(const DOMConfigurator&);
+ static XMLWatchdog* xdog;
};
LOG4CXX_PTR_DEF(DOMConfigurator);
} // namespace xml
} // namespace log4cxx
#if defined(_MSC_VER)
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif // _LOG4CXX_XML_DOM_CONFIGURATOR_H
diff --git a/src/main/include/log4cxx/xml/xmllayout.h b/src/main/include/log4cxx/xml/xmllayout.h
index 4c5f4e6..cff3e89 100644
--- a/src/main/include/log4cxx/xml/xmllayout.h
+++ b/src/main/include/log4cxx/xml/xmllayout.h
@@ -52,91 +52,91 @@
*/
class LOG4CXX_EXPORT XMLLayout : public Layout
{
- private:
+ private:
- // Print no location info by default
- bool locationInfo; //= false
- bool properties; // = false
+ // Print no location info by default
+ bool locationInfo; //= false
+ bool properties; // = false
- public:
- DECLARE_LOG4CXX_OBJECT(XMLLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(XMLLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
+ public:
+ DECLARE_LOG4CXX_OBJECT(XMLLayout)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(XMLLayout)
+ LOG4CXX_CAST_ENTRY_CHAIN(Layout)
+ END_LOG4CXX_CAST_MAP()
- XMLLayout();
+ XMLLayout();
- /**
- The <b>LocationInfo</b> option takes a boolean value. By
- default, it is set to false which means there will be no location
- information output by this layout. If the the option is set to
- true, then the file name and line number of the statement
- at the origin of the log statement will be output.
+ /**
+ The <b>LocationInfo</b> option takes a boolean value. By
+ default, it is set to false which means there will be no location
+ information output by this layout. If the the option is set to
+ true, then the file name and line number of the statement
+ at the origin of the log statement will be output.
- <p>If you are embedding this layout within a SMTPAppender
- then make sure to set the
- <b>LocationInfo</b> option of that appender as well.
- */
- inline void setLocationInfo(bool locationInfo1)
- {
- this->locationInfo = locationInfo1;
- }
+ <p>If you are embedding this layout within a SMTPAppender
+ then make sure to set the
+ <b>LocationInfo</b> option of that appender as well.
+ */
+ inline void setLocationInfo(bool locationInfo1)
+ {
+ this->locationInfo = locationInfo1;
+ }
- /**
- Returns the current value of the <b>LocationInfo</b> option.
- */
- inline bool getLocationInfo() const
- {
- return locationInfo;
- }
+ /**
+ Returns the current value of the <b>LocationInfo</b> option.
+ */
+ inline bool getLocationInfo() const
+ {
+ return locationInfo;
+ }
- /**
- * Sets whether MDC key-value pairs should be output, default false.
- * @param flag new value.
- *
- */
- inline void setProperties(bool flag)
- {
- properties = flag;
- }
+ /**
+ * Sets whether MDC key-value pairs should be output, default false.
+ * @param flag new value.
+ *
+ */
+ inline void setProperties(bool flag)
+ {
+ properties = flag;
+ }
- /**
- * Gets whether MDC key-value pairs should be output.
- * @return true if MDC key-value pairs are output.
- *
- */
- inline bool getProperties()
- {
- return properties;
- }
+ /**
+ * Gets whether MDC key-value pairs should be output.
+ * @return true if MDC key-value pairs are output.
+ *
+ */
+ inline bool getProperties()
+ {
+ return properties;
+ }
- /** No options to activate. */
- void activateOptions(log4cxx::helpers::Pool& /* p */) { }
+ /** No options to activate. */
+ void activateOptions(log4cxx::helpers::Pool& /* p */) { }
- /**
- Set options
- */
- virtual void setOption(const LogString& option,
- const LogString& value);
+ /**
+ Set options
+ */
+ virtual void setOption(const LogString& option,
+ const LogString& value);
- /**
- * Formats a {@link spi::LoggingEvent LoggingEvent}
- * in conformance with the log4cxx.dtd.
- **/
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& p) const;
+ /**
+ * Formats a {@link spi::LoggingEvent LoggingEvent}
+ * in conformance with the log4cxx.dtd.
+ **/
+ virtual void format(LogString& output,
+ const spi::LoggingEventPtr& event,
+ log4cxx::helpers::Pool& p) const;
- /**
- The XMLLayout prints and does not ignore exceptions. Hence the
- return value <code>false</code>.
- */
- virtual bool ignoresThrowable() const
- {
- return false;
- }
+ /**
+ The XMLLayout prints and does not ignore exceptions. Hence the
+ return value <code>false</code>.
+ */
+ virtual bool ignoresThrowable() const
+ {
+ return false;
+ }
}; // class XMLLayout
LOG4CXX_PTR_DEF(XMLLayout);