1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
15 Licensed to the Apache Software Foundation (ASF) under one or more
16 contributor license agreements. See the NOTICE file distributed with
17 this work for additional information regarding copyright ownership.
18 The ASF licenses this file to You under the Apache License, Version 2.0
19 (the "License"); you may not use this file except in compliance with
20 the License. You may obtain a copy of the License at
22 http://www.apache.org/licenses/LICENSE-2.0
24 Unless required by applicable law or agreed to in writing, software
25 distributed under the License is distributed on an "AS IS" BASIS,
26 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 See the License for the specific language governing permissions and
28 limitations under the License.
30 --><html xmlns="http://www.w3.org/1999/xhtml">
32 <title>log4cxx - Frequently Asked Technical Questions</title>
33 <style type="text/css" media="all">
34 @import url("./css/maven-base.css");
35 @import url("./css/maven-theme.css");
36 @import url("./css/site.css");
38 <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
39 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
41 <body class="composite">
43 <a href="http://logging.apache.org/" id="bannerLeft">
45 <img src="images/ls-logo.jpg" alt="" />
52 <div id="breadcrumbs">
62 Last Published: 2008-03-31
64 <a href="http://www.apache.org/" class="externalLink">Apache</a>
67 <a href="http://logging.apache.org/" class="externalLink">Logging Services</a>
99 <a href="download.html">Download</a>
103 <a href="changes-report.html">Changes</a>
107 <a href="license.html">License</a>
110 <h5>About log4cxx</h5>
114 <a href="index.html">What is log4cxx?</a>
118 <a href="apidocs/index.html">API Documentation</a>
129 <a href="mail-lists.html">Mailing Lists</a>
133 <a href="issue-tracking.html">Issue Tracking</a>
137 <a href="http://wiki.apache.org/logging-log4cxx" class="externalLink">Wiki</a>
144 <a href="source-repository.html">Repository</a>
159 <li class="expanded">
160 <a href="">Building</a>
164 <a href="building/autotools.html">autotools</a>
168 <a href="building/ant.html">Apache Ant</a>
172 <a href="building/maven.html">Apache Maven 2</a>
176 <a href="building/vstudio.html">Microsoft Visual Studio</a>
180 <a href="building/xcode.html">Apple Xcode</a>
189 <a href="http://www.apache.org" class="externalLink">Home</a>
193 <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship</a>
197 <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
201 <a href="http://www.apachecon.com" class="externalLink">Conferences</a>
204 <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
205 <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
217 <div id="bodyColumn">
218 <div id="contentBox">
219 <div class="section"><h2><a name="top">Frequently Asked Technical Questions</a>
221 <ol type="1"><li><a href="#custom_levels">How do I add a custom level to Apache log4cxx?</a>
223 <li><a href="#msvc_crash">My application on Windows crashes on shutdown?</a>
225 <li><a href="#unicode">Does Apache log4cxx support Unicode?</a>
229 <dl><dt><a name="custom_levels">How do I add a custom level to Apache log4cxx?</a>
232 <p>This is a common topic for all the Apache logging frameworks and
233 typically motivated to try to categorize events by functionality or
234 audience. An common request is to add an AUDIT level so that the
235 user can configure AUDIT level messages to go to a specific appender.
236 However, the logger name was designed explicitly to support
237 routing of messages by topic or audience. The common
238 pattern of using classnames for logger names obscures the more
239 general capability of logger name to represent the topic or audience
240 of the logging request. The easiest approach to solve the underlying issue
241 is to use a logger names like "AUDIT.com.example.MyPackage.MyClass"
242 that allow all AUDIT messages to be routed to a particular appender.
243 If you attempted to use a level for that then you would lose
244 the ability to distinguish between different significances within
246 </p><table border="0"><tr><td align="right"><a href="#top">[top]</a>
247 </td></tr></table><hr />
249 <dt><a name="msvc_crash">My application on Windows crashes on shutdown?</a>
252 <p>Apache log4cxx API calls use C++ Standard Template Library string
253 parameters. If the caller is using a different instance or type of the
254 C Runtime Library that log4cxx, then it is very likely that some memory
255 that was originally allocated by log4cxx would be freed by the caller.
256 If log4cxx and the caller are using different C RTL's, the program
257 will likely crash at the point. Use "Multithread DLL" with release
258 builds of log4cxx and "Multithread DLL Debug" with debug builds.
259 </p><table border="0"><tr><td align="right"><a href="#top">[top]</a>
260 </td></tr></table><hr />
262 <dt><a name="unicode">Does Apache log4cxx support Unicode?</a>
265 <p>Yes. Apache log4cxx exposes API methods in multiple string flavors
266 const char*, std::string, wchar_t*, std::wstring, CFStringRef et al.
267 const char* and std::string are interpreted according to the
268 current locale settings. Applications should call setlocale(LC_ALL, "")
269 on startup or the C RTL will assume US-ASCII.
270 Before being processed internally, all these are converted to the
271 LogString type which is one of several supported Unicode representations
272 selected by the --with-logchar option. When using methods that take LogString arguments,
273 the LOG4CXX_STR() macro can be used to convert ASCII literals to
274 the current LogString type. FileAppenders support an encoding
275 property which should be explicitly specified to "UTF-8" or "UTF-16"
277 </p><table border="0"><tr><td align="right"><a href="#top">[top]</a>
278 </td></tr></table></dd>
287 <div class="xright">©
290 Apache Software Foundation