Apache log4cxx Version 0.13.0
xmllayout.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_XML_LAYOUT_H
19#define _LOG4CXX_XML_LAYOUT_H
20
21#include <log4cxx/layout.h>
22
23namespace log4cxx
24{
25namespace xml
26{
27
53class LOG4CXX_EXPORT XMLLayout : public Layout
54{
55 private:
56
57 // Print no location info by default
58 bool locationInfo; //= false
59 bool properties; // = false
60
61 public:
67
69
81 inline void setLocationInfo(bool locationInfo1)
82 {
83 this->locationInfo = locationInfo1;
84 }
85
89 inline bool getLocationInfo() const
90 {
91 return locationInfo;
92 }
93
99 inline void setProperties(bool flag)
100 {
101 properties = flag;
102 }
103
109 inline bool getProperties()
110 {
111 return properties;
112 }
113
114
117
121 virtual void setOption(const LogString& option,
122 const LogString& value);
123
128 virtual void format(LogString& output,
129 const spi::LoggingEventPtr& event,
130 log4cxx::helpers::Pool& p) const;
131
136 virtual bool ignoresThrowable() const
137 {
138 return false;
139 }
140
141}; // class XMLLayout
143} // namespace xml
144} // namespace log4cxx
145
146#endif // _LOG4CXX_XML_LAYOUT_H
Extend this abstract class to create your own log layout format.
Definition: layout.h:40
Definition: pool.h:33
The output of the XMLLayout consists of a series of log4j:event elements.
Definition: xmllayout.h:54
virtual void format(LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) const
Formats a LoggingEvent in conformance with the log4cxx.dtd.
bool getProperties()
Gets whether MDC key-value pairs should be output.
Definition: xmllayout.h:109
void activateOptions(log4cxx::helpers::Pool &)
No options to activate.
Definition: xmllayout.h:116
virtual void setOption(const LogString &option, const LogString &value)
Set options.
void setProperties(bool flag)
Sets whether MDC key-value pairs should be output, default false.
Definition: xmllayout.h:99
bool getLocationInfo() const
Returns the current value of the LocationInfo option.
Definition: xmllayout.h:89
virtual bool ignoresThrowable() const
The XMLLayout prints and does not ignore exceptions.
Definition: xmllayout.h:136
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:38
LOG4CXX_PTR_DEF(DOMConfigurator)
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:153
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:147
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:141