Apache log4cxx  Version 0.12.1
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 
23 namespace log4cxx
24 {
25 namespace xml
26 {
27 
53 class 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 
68  XMLLayout();
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
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:148
void activateOptions(log4cxx::helpers::Pool &)
No options to activate.
Definition: xmllayout.h:116
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:142
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:37
virtual bool ignoresThrowable() const
The XMLLayout prints and does not ignore exceptions.
Definition: xmllayout.h:136
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:136
Extend this abstract class to create your own log layout format.
Definition: layout.h:37
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:39
The output of the XMLLayout consists of a series of log4j:event elements.
Definition: xmllayout.h:53
void setLocationInfo(bool locationInfo1)
The LocationInfo option takes a boolean value.
Definition: xmllayout.h:81
Definition: pool.h:32
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:154
bool getProperties()
Gets whether MDC key-value pairs should be output.
Definition: xmllayout.h:109
void setProperties(bool flag)
Sets whether MDC key-value pairs should be output, default false.
Definition: xmllayout.h:99
LOG4CXX_PTR_DEF(DOMConfigurator)
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66
bool getLocationInfo() const
Returns the current value of the LocationInfo option.
Definition: xmllayout.h:89