/usr/include/log4cxx/xml/domconfigurator.h is in liblog4cxx10-dev 0.10.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LOG4CXX_XML_DOM_CONFIGURATOR_H
#define _LOG4CXX_XML_DOM_CONFIGURATOR_H
#if defined(_MSC_VER)
#pragma warning (push)
#pragma warning ( disable: 4231 4251 4275 4786 )
#endif
#include <log4cxx/logstring.h>
#include <map>
#include <log4cxx/appender.h>
#include <log4cxx/layout.h>
#include <log4cxx/logger.h>
#include <log4cxx/helpers/properties.h>
#include <log4cxx/spi/configurator.h>
#include <log4cxx/helpers/charsetdecoder.h>
#include <log4cxx/spi/filter.h>
#include <log4cxx/rolling/triggeringpolicy.h>
#include <log4cxx/rolling/rollingpolicy.h>
#include <log4cxx/file.h>
#include <log4cxx/config/propertysetter.h>
extern "C" {
struct apr_xml_doc;
struct apr_xml_elem;
}
namespace log4cxx
{
namespace xml
{
/**
Use this class to initialize the log4cxx environment using a DOM tree.
<p>Sometimes it is useful to see how log4cxx is reading configuration
files. You can enable log4cxx internal logging by setting the
<code>debug</code> attribute in the
<code>log4cxx</code> element. As in
<pre>
<log4j:configuration <b>debug="true"</b> xmlns:log4j="http://jakarta.apache.org/log4j/">
...
</log4j:configuration>
</pre>
<p>There are sample XML files included in the package.
*/
class LOG4CXX_EXPORT DOMConfigurator :
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);
/**
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 {@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 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.
*/
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 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 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);
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);
public:
DOMConfigurator();
DECLARE_LOG4CXX_OBJECT(DOMConfigurator)
BEGIN_LOG4CXX_CAST_MAP()
LOG4CXX_CAST_ENTRY(spi::Configurator)
END_LOG4CXX_CAST_MAP()
DOMConfigurator(log4cxx::helpers::Pool& p);
void addRef() const;
void releaseRef() const;
/**
A static version of #doConfigure.
*/
static void configure(const std::string& filename);
#if LOG4CXX_WCHAR_T_API
static void configure(const std::wstring& filename);
#endif
#if LOG4CXX_UNICHAR_API
static void configure(const std::basic_string<UniChar>& filename);
#endif
#if LOG4CXX_CFSTRING_API
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);
#if LOG4CXX_WCHAR_T_API
static void configureAndWatch(const std::wstring& configFilename);
#endif
#if LOG4CXX_UNICHAR_API
static void configureAndWatch(const std::basic_string<UniChar>& configFilename);
#endif
#if LOG4CXX_CFSTRING_API
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.
@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);
#endif
#if LOG4CXX_UNICHAR_API
static void configureAndWatch(const std::basic_string<UniChar>& configFilename,
long delay);
#endif
#if LOG4CXX_CFSTRING_API
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);
protected:
static LogString getAttribute(
log4cxx::helpers::CharsetDecoderPtr& utf8Decoder,
apr_xml_elem*,
const std::string& attrName);
LogString subst(const LogString& value);
protected:
helpers::Properties props;
spi::LoggerRepositoryPtr repository;
spi::LoggerFactoryPtr loggerFactory;
private:
// prevent assignment or copy statements
DOMConfigurator(const DOMConfigurator&);
DOMConfigurator& operator=(const DOMConfigurator&);
};
LOG4CXX_PTR_DEF(DOMConfigurator);
} // namespace xml
} // namespace log4cxx
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
#endif // _LOG4CXX_XML_DOM_CONFIGURATOR_H
|