[2] | 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_LOGGER_H
|
---|
| 19 | #define _LOG4CXX_LOGGER_H
|
---|
| 20 |
|
---|
| 21 | #if defined(_MSC_VER)
|
---|
| 22 | #pragma warning ( push )
|
---|
| 23 | #pragma warning ( disable: 4231 4251 4275 4786 )
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #include <log4cxx/helpers/appenderattachableimpl.h>
|
---|
| 27 | #include <log4cxx/level.h>
|
---|
| 28 | #include <log4cxx/helpers/pool.h>
|
---|
| 29 | #include <log4cxx/helpers/mutex.h>
|
---|
| 30 | #include <log4cxx/spi/location/locationinfo.h>
|
---|
| 31 | #include <log4cxx/helpers/resourcebundle.h>
|
---|
| 32 | #include <log4cxx/helpers/messagebuffer.h>
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | namespace log4cxx
|
---|
| 36 | {
|
---|
| 37 |
|
---|
| 38 | namespace helpers {
|
---|
| 39 | class synchronized;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | namespace spi {
|
---|
| 43 | class LoggerRepository;
|
---|
| 44 | LOG4CXX_PTR_DEF(LoggerRepository);
|
---|
| 45 | class LoggerFactory;
|
---|
| 46 | LOG4CXX_PTR_DEF(LoggerFactory);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | class Logger;
|
---|
| 50 | /** smart pointer to a Logger class */
|
---|
| 51 | LOG4CXX_PTR_DEF(Logger);
|
---|
| 52 | LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | /**
|
---|
| 56 | This is the central class in the log4cxx package. Most logging
|
---|
| 57 | operations, except configuration, are done through this class.
|
---|
| 58 | */
|
---|
| 59 | class LOG4CXX_EXPORT Logger :
|
---|
| 60 | public virtual log4cxx::spi::AppenderAttachable,
|
---|
| 61 | public virtual helpers::ObjectImpl
|
---|
| 62 | {
|
---|
| 63 | public:
|
---|
| 64 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)
|
---|
| 65 | BEGIN_LOG4CXX_CAST_MAP()
|
---|
| 66 | LOG4CXX_CAST_ENTRY(Logger)
|
---|
| 67 | LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)
|
---|
| 68 | END_LOG4CXX_CAST_MAP()
|
---|
| 69 |
|
---|
| 70 | private:
|
---|
| 71 | /**
|
---|
| 72 | * Reference to memory pool.
|
---|
| 73 | */
|
---|
| 74 | helpers::Pool* pool;
|
---|
| 75 |
|
---|
| 76 | protected:
|
---|
| 77 | /**
|
---|
| 78 | The name of this logger.
|
---|
| 79 | */
|
---|
| 80 | LogString name;
|
---|
| 81 |
|
---|
| 82 | /**
|
---|
| 83 | The assigned level of this logger. The
|
---|
| 84 | <code>level</code> variable need not be assigned a value in
|
---|
| 85 | which case it is inherited form the hierarchy. */
|
---|
| 86 | LevelPtr level;
|
---|
| 87 |
|
---|
| 88 | /**
|
---|
| 89 | The parent of this logger. All loggers have at least one
|
---|
| 90 | ancestor which is the root logger. */
|
---|
| 91 | LoggerPtr parent;
|
---|
| 92 |
|
---|
| 93 | /** The resourceBundle for localized messages.
|
---|
| 94 |
|
---|
| 95 | @see setResourceBundle, getResourceBundle
|
---|
| 96 | */
|
---|
| 97 | helpers::ResourceBundlePtr resourceBundle;
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | // Loggers need to know what Hierarchy they are in
|
---|
| 101 | log4cxx::spi::LoggerRepository * repository;
|
---|
| 102 |
|
---|
| 103 | helpers::AppenderAttachableImplPtr aai;
|
---|
| 104 |
|
---|
| 105 | /** Additivity is set to true by default, that is children inherit
|
---|
| 106 | the appenders of their ancestors by default. If this variable is
|
---|
| 107 | set to <code>false</code> then the appenders found in the
|
---|
| 108 | ancestors of this logger are not used. However, the children
|
---|
| 109 | of this logger will inherit its appenders, unless the children
|
---|
| 110 | have their additivity flag set to <code>false</code> too. See
|
---|
| 111 | the user manual for more details. */
|
---|
| 112 | bool additive;
|
---|
| 113 |
|
---|
| 114 | protected:
|
---|
| 115 | friend class DefaultLoggerFactory;
|
---|
| 116 |
|
---|
| 117 | /**
|
---|
| 118 | This constructor created a new <code>logger</code> instance and
|
---|
| 119 | sets its name.
|
---|
| 120 |
|
---|
| 121 | <p>It is intended to be used by sub-classes only. You should not
|
---|
| 122 | create categories directly.
|
---|
| 123 |
|
---|
| 124 | @param pool lifetime of pool must be longer than logger.
|
---|
| 125 | @param name The name of the logger.
|
---|
| 126 | */
|
---|
| 127 | Logger(log4cxx::helpers::Pool& pool, const LogString& name);
|
---|
| 128 |
|
---|
| 129 | public:
|
---|
| 130 | ~Logger();
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 | void addRef() const;
|
---|
| 134 | void releaseRef() const;
|
---|
| 135 |
|
---|
| 136 | /**
|
---|
| 137 | Add <code>newAppender</code> to the list of appenders of this
|
---|
| 138 | Logger instance.
|
---|
| 139 |
|
---|
| 140 | <p>If <code>newAppender</code> is already in the list of
|
---|
| 141 | appenders, then it won't be added again.
|
---|
| 142 | */
|
---|
| 143 | virtual void addAppender(const AppenderPtr& newAppender);
|
---|
| 144 |
|
---|
| 145 |
|
---|
| 146 | /**
|
---|
| 147 | Call the appenders in the hierrachy starting at
|
---|
| 148 | <code>this</code>. If no appenders could be found, emit a
|
---|
| 149 | warning.
|
---|
| 150 |
|
---|
| 151 | <p>This method calls all the appenders inherited from the
|
---|
| 152 | hierarchy circumventing any evaluation of whether to log or not
|
---|
| 153 | to log the particular log request.
|
---|
| 154 |
|
---|
| 155 | @param event the event to log.
|
---|
| 156 | @param p memory pool for any allocations needed to process request.
|
---|
| 157 | */
|
---|
| 158 | void callAppenders(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const;
|
---|
| 159 |
|
---|
| 160 | /**
|
---|
| 161 | Close all attached appenders implementing the AppenderAttachable
|
---|
| 162 | interface.
|
---|
| 163 | */
|
---|
| 164 | void closeNestedAppenders();
|
---|
| 165 |
|
---|
| 166 | /**
|
---|
| 167 | Log a message string with the DEBUG level.
|
---|
| 168 |
|
---|
| 169 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 170 | enabled by comparing the level of this logger with the
|
---|
| 171 | DEBUG level. If this logger is
|
---|
| 172 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 173 | registered appenders in this logger and also higher in the
|
---|
| 174 | hierarchy depending on the value of the additivity flag.
|
---|
| 175 |
|
---|
| 176 | @param msg the message string to log.
|
---|
| 177 | @param location location of source of logging request.
|
---|
| 178 | */
|
---|
| 179 | void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 180 | /**
|
---|
| 181 | Log a message string with the DEBUG level.
|
---|
| 182 |
|
---|
| 183 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 184 | enabled by comparing the level of this logger with the
|
---|
| 185 | DEBUG level. If this logger is
|
---|
| 186 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 187 | registered appenders in this logger and also higher in the
|
---|
| 188 | hierarchy depending on the value of the additivity flag.
|
---|
| 189 |
|
---|
| 190 | @param msg the message string to log.
|
---|
| 191 | */
|
---|
| 192 | void debug(const std::string& msg) const;
|
---|
| 193 | #if LOG4CXX_WCHAR_T_API
|
---|
| 194 | /**
|
---|
| 195 | Log a message string with the DEBUG level.
|
---|
| 196 |
|
---|
| 197 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 198 | enabled by comparing the level of this logger with the
|
---|
| 199 | DEBUG level. If this logger is
|
---|
| 200 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 201 | registered appenders in this logger and also higher in the
|
---|
| 202 | hierarchy depending on the value of the additivity flag.
|
---|
| 203 |
|
---|
| 204 | @param msg the message string to log.
|
---|
| 205 | @param location location of source of logging request.
|
---|
| 206 | */
|
---|
| 207 | void debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 208 | /**
|
---|
| 209 | Log a message string with the DEBUG level.
|
---|
| 210 |
|
---|
| 211 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 212 | enabled by comparing the level of this logger with the
|
---|
| 213 | DEBUG level. If this logger is
|
---|
| 214 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 215 | registered appenders in this logger and also higher in the
|
---|
| 216 | hierarchy depending on the value of the additivity flag.
|
---|
| 217 |
|
---|
| 218 | @param msg the message string to log.
|
---|
| 219 | */
|
---|
| 220 | void debug(const std::wstring& msg) const;
|
---|
| 221 | #endif
|
---|
| 222 | #if LOG4CXX_UNICHAR_API
|
---|
| 223 | /**
|
---|
| 224 | Log a message string with the DEBUG level.
|
---|
| 225 |
|
---|
| 226 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 227 | enabled by comparing the level of this logger with the
|
---|
| 228 | DEBUG level. If this logger is
|
---|
| 229 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 230 | registered appenders in this logger and also higher in the
|
---|
| 231 | hierarchy depending on the value of the additivity flag.
|
---|
| 232 |
|
---|
| 233 | @param msg the message string to log.
|
---|
| 234 | @param location location of source of logging request.
|
---|
| 235 | */
|
---|
| 236 | void debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 237 | /**
|
---|
| 238 | Log a message string with the DEBUG level.
|
---|
| 239 |
|
---|
| 240 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 241 | enabled by comparing the level of this logger with the
|
---|
| 242 | DEBUG level. If this logger is
|
---|
| 243 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 244 | registered appenders in this logger and also higher in the
|
---|
| 245 | hierarchy depending on the value of the additivity flag.
|
---|
| 246 |
|
---|
| 247 | @param msg the message string to log.
|
---|
| 248 | */
|
---|
| 249 | void debug(const std::basic_string<UniChar>& msg) const;
|
---|
| 250 | #endif
|
---|
| 251 | #if LOG4CXX_CFSTRING_API
|
---|
| 252 | /**
|
---|
| 253 | Log a message string with the DEBUG level.
|
---|
| 254 |
|
---|
| 255 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 256 | enabled by comparing the level of this logger with the
|
---|
| 257 | DEBUG level. If this logger is
|
---|
| 258 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 259 | registered appenders in this logger and also higher in the
|
---|
| 260 | hierarchy depending on the value of the additivity flag.
|
---|
| 261 |
|
---|
| 262 | @param msg the message string to log.
|
---|
| 263 | @param location location of source of logging request.
|
---|
| 264 | */
|
---|
| 265 | void debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 266 | /**
|
---|
| 267 | Log a message string with the DEBUG level.
|
---|
| 268 |
|
---|
| 269 | <p>This method first checks if this logger is <code>DEBUG</code>
|
---|
| 270 | enabled by comparing the level of this logger with the
|
---|
| 271 | DEBUG level. If this logger is
|
---|
| 272 | <code>DEBUG</code> enabled, it proceeds to call all the
|
---|
| 273 | registered appenders in this logger and also higher in the
|
---|
| 274 | hierarchy depending on the value of the additivity flag.
|
---|
| 275 |
|
---|
| 276 | @param msg the message string to log.
|
---|
| 277 | */
|
---|
| 278 | void debug(const CFStringRef& msg) const;
|
---|
| 279 | #endif
|
---|
| 280 |
|
---|
| 281 | /**
|
---|
| 282 | Log a message string with the ERROR level.
|
---|
| 283 |
|
---|
| 284 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 285 | enabled by comparing the level of this logger with the
|
---|
| 286 | ERROR level. If this logger is
|
---|
| 287 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 288 | registered appenders in this logger and also higher in the
|
---|
| 289 | hierarchy depending on the value of the additivity flag.
|
---|
| 290 |
|
---|
| 291 | @param msg the message string to log.
|
---|
| 292 | @param location location of source of logging request.
|
---|
| 293 | */
|
---|
| 294 | void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 295 | /**
|
---|
| 296 | Log a message string with the ERROR level.
|
---|
| 297 |
|
---|
| 298 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 299 | enabled by comparing the level of this logger with the
|
---|
| 300 | ERROR level. If this logger is
|
---|
| 301 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 302 | registered appenders in this logger and also higher in the
|
---|
| 303 | hierarchy depending on the value of the additivity flag.
|
---|
| 304 |
|
---|
| 305 | @param msg the message string to log.
|
---|
| 306 | */
|
---|
| 307 | void error(const std::string& msg) const;
|
---|
| 308 | #if LOG4CXX_WCHAR_T_API
|
---|
| 309 | /**
|
---|
| 310 | Log a message string with the ERROR level.
|
---|
| 311 |
|
---|
| 312 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 313 | enabled by comparing the level of this logger with the
|
---|
| 314 | ERROR level. If this logger is
|
---|
| 315 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 316 | registered appenders in this logger and also higher in the
|
---|
| 317 | hierarchy depending on the value of the additivity flag.
|
---|
| 318 |
|
---|
| 319 | @param msg the message string to log.
|
---|
| 320 | */
|
---|
| 321 | void error(const std::wstring& msg) const;
|
---|
| 322 | /**
|
---|
| 323 | Log a message string with the ERROR level.
|
---|
| 324 |
|
---|
| 325 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 326 | enabled by comparing the level of this logger with the
|
---|
| 327 | ERROR level. If this logger is
|
---|
| 328 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 329 | registered appenders in this logger and also higher in the
|
---|
| 330 | hierarchy depending on the value of the additivity flag.
|
---|
| 331 |
|
---|
| 332 | @param msg the message string to log.
|
---|
| 333 | @param location location of source of logging request.
|
---|
| 334 | */
|
---|
| 335 | void error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 336 | #endif
|
---|
| 337 | #if LOG4CXX_UNICHAR_API
|
---|
| 338 | /**
|
---|
| 339 | Log a message string with the ERROR level.
|
---|
| 340 |
|
---|
| 341 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 342 | enabled by comparing the level of this logger with the
|
---|
| 343 | ERROR level. If this logger is
|
---|
| 344 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 345 | registered appenders in this logger and also higher in the
|
---|
| 346 | hierarchy depending on the value of the additivity flag.
|
---|
| 347 |
|
---|
| 348 | @param msg the message string to log.
|
---|
| 349 | @param location location of source of logging request.
|
---|
| 350 | */
|
---|
| 351 | void error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 352 | /**
|
---|
| 353 | Log a message string with the ERROR level.
|
---|
| 354 |
|
---|
| 355 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 356 | enabled by comparing the level of this logger with the
|
---|
| 357 | ERROR level. If this logger is
|
---|
| 358 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 359 | registered appenders in this logger and also higher in the
|
---|
| 360 | hierarchy depending on the value of the additivity flag.
|
---|
| 361 |
|
---|
| 362 | @param msg the message string to log.
|
---|
| 363 | */
|
---|
| 364 | void error(const std::basic_string<UniChar>& msg) const;
|
---|
| 365 | #endif
|
---|
| 366 | #if LOG4CXX_CFSTRING_API
|
---|
| 367 | /**
|
---|
| 368 | Log a message string with the ERROR level.
|
---|
| 369 |
|
---|
| 370 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 371 | enabled by comparing the level of this logger with the
|
---|
| 372 | ERROR level. If this logger is
|
---|
| 373 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 374 | registered appenders in this logger and also higher in the
|
---|
| 375 | hierarchy depending on the value of the additivity flag.
|
---|
| 376 |
|
---|
| 377 | @param msg the message string to log.
|
---|
| 378 | @param location location of source of logging request.
|
---|
| 379 | */
|
---|
| 380 | void error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 381 | /**
|
---|
| 382 | Log a message string with the ERROR level.
|
---|
| 383 |
|
---|
| 384 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 385 | enabled by comparing the level of this logger with the
|
---|
| 386 | ERROR level. If this logger is
|
---|
| 387 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 388 | registered appenders in this logger and also higher in the
|
---|
| 389 | hierarchy depending on the value of the additivity flag.
|
---|
| 390 |
|
---|
| 391 | @param msg the message string to log.
|
---|
| 392 | */
|
---|
| 393 | void error(const CFStringRef& msg) const;
|
---|
| 394 | #endif
|
---|
| 395 |
|
---|
| 396 | /**
|
---|
| 397 | Log a message string with the FATAL level.
|
---|
| 398 |
|
---|
| 399 | <p>This method first checks if this logger is <code>FATAL</code>
|
---|
| 400 | enabled by comparing the level of this logger with the
|
---|
| 401 | FATAL level. If this logger is
|
---|
| 402 | <code>FATAL</code> enabled, it proceeds to call all the
|
---|
| 403 | registered appenders in this logger and also higher in the
|
---|
| 404 | hierarchy depending on the value of the additivity flag.
|
---|
| 405 |
|
---|
| 406 | @param msg the message string to log.
|
---|
| 407 | @param location location of source of logging request.
|
---|
| 408 | */
|
---|
| 409 | void fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 410 | /**
|
---|
| 411 | Log a message string with the ERROR level.
|
---|
| 412 |
|
---|
| 413 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 414 | enabled by comparing the level of this logger with the
|
---|
| 415 | ERROR level. If this logger is
|
---|
| 416 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 417 | registered appenders in this logger and also higher in the
|
---|
| 418 | hierarchy depending on the value of the additivity flag.
|
---|
| 419 |
|
---|
| 420 | @param msg the message string to log.
|
---|
| 421 | */
|
---|
| 422 | void fatal(const std::string& msg) const;
|
---|
| 423 | #if LOG4CXX_WCHAR_T_API
|
---|
| 424 | /**
|
---|
| 425 | Log a message string with the ERROR level.
|
---|
| 426 |
|
---|
| 427 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 428 | enabled by comparing the level of this logger with the
|
---|
| 429 | ERROR level. If this logger is
|
---|
| 430 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 431 | registered appenders in this logger and also higher in the
|
---|
| 432 | hierarchy depending on the value of the additivity flag.
|
---|
| 433 |
|
---|
| 434 | @param msg the message string to log.
|
---|
| 435 | @param location location of source of logging request.
|
---|
| 436 | */
|
---|
| 437 | void fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 438 | /**
|
---|
| 439 | Log a message string with the ERROR level.
|
---|
| 440 |
|
---|
| 441 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 442 | enabled by comparing the level of this logger with the
|
---|
| 443 | ERROR level. If this logger is
|
---|
| 444 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 445 | registered appenders in this logger and also higher in the
|
---|
| 446 | hierarchy depending on the value of the additivity flag.
|
---|
| 447 |
|
---|
| 448 | @param msg the message string to log.
|
---|
| 449 | */
|
---|
| 450 | void fatal(const std::wstring& msg) const;
|
---|
| 451 | #endif
|
---|
| 452 | #if LOG4CXX_UNICHAR_API
|
---|
| 453 | /**
|
---|
| 454 | Log a message string with the ERROR level.
|
---|
| 455 |
|
---|
| 456 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 457 | enabled by comparing the level of this logger with the
|
---|
| 458 | ERROR level. If this logger is
|
---|
| 459 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 460 | registered appenders in this logger and also higher in the
|
---|
| 461 | hierarchy depending on the value of the additivity flag.
|
---|
| 462 |
|
---|
| 463 | @param msg the message string to log.
|
---|
| 464 | @param location location of source of logging request.
|
---|
| 465 | */
|
---|
| 466 | void fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 467 | /**
|
---|
| 468 | Log a message string with the ERROR level.
|
---|
| 469 |
|
---|
| 470 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 471 | enabled by comparing the level of this logger with the
|
---|
| 472 | ERROR level. If this logger is
|
---|
| 473 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 474 | registered appenders in this logger and also higher in the
|
---|
| 475 | hierarchy depending on the value of the additivity flag.
|
---|
| 476 |
|
---|
| 477 | @param msg the message string to log.
|
---|
| 478 | */
|
---|
| 479 | void fatal(const std::basic_string<UniChar>& msg) const;
|
---|
| 480 | #endif
|
---|
| 481 | #if LOG4CXX_CFSTRING_API
|
---|
| 482 | /**
|
---|
| 483 | Log a message string with the ERROR level.
|
---|
| 484 |
|
---|
| 485 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 486 | enabled by comparing the level of this logger with the
|
---|
| 487 | ERROR level. If this logger is
|
---|
| 488 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 489 | registered appenders in this logger and also higher in the
|
---|
| 490 | hierarchy depending on the value of the additivity flag.
|
---|
| 491 |
|
---|
| 492 | @param msg the message string to log.
|
---|
| 493 | @param location location of source of logging request.
|
---|
| 494 | */
|
---|
| 495 | void fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 496 | /**
|
---|
| 497 | Log a message string with the ERROR level.
|
---|
| 498 |
|
---|
| 499 | <p>This method first checks if this logger is <code>ERROR</code>
|
---|
| 500 | enabled by comparing the level of this logger with the
|
---|
| 501 | ERROR level. If this logger is
|
---|
| 502 | <code>ERROR</code> enabled, it proceeds to call all the
|
---|
| 503 | registered appenders in this logger and also higher in the
|
---|
| 504 | hierarchy depending on the value of the additivity flag.
|
---|
| 505 |
|
---|
| 506 | @param msg the message string to log.
|
---|
| 507 | */
|
---|
| 508 | void fatal(const CFStringRef& msg) const;
|
---|
| 509 | #endif
|
---|
| 510 |
|
---|
| 511 | /**
|
---|
| 512 | This method creates a new logging event and logs the event
|
---|
| 513 | without further checks.
|
---|
| 514 | @param level the level to log.
|
---|
| 515 | @param message message.
|
---|
| 516 | @param location location of source of logging request.
|
---|
| 517 | */
|
---|
| 518 | void forcedLog(const LevelPtr& level, const std::string& message,
|
---|
| 519 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 520 | /**
|
---|
| 521 | This method creates a new logging event and logs the event
|
---|
| 522 | without further checks.
|
---|
| 523 | @param level the level to log.
|
---|
| 524 | @param message message.
|
---|
| 525 | */
|
---|
| 526 | void forcedLog(const LevelPtr& level, const std::string& message) const;
|
---|
| 527 |
|
---|
| 528 | #if LOG4CXX_WCHAR_T_API
|
---|
| 529 | /**
|
---|
| 530 | This method creates a new logging event and logs the event
|
---|
| 531 | without further checks.
|
---|
| 532 | @param level the level to log.
|
---|
| 533 | @param message message.
|
---|
| 534 | @param location location of source of logging request.
|
---|
| 535 | */
|
---|
| 536 | void forcedLog(const LevelPtr& level, const std::wstring& message,
|
---|
| 537 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 538 | /**
|
---|
| 539 | This method creates a new logging event and logs the event
|
---|
| 540 | without further checks.
|
---|
| 541 | @param level the level to log.
|
---|
| 542 | @param message message.
|
---|
| 543 | */
|
---|
| 544 | void forcedLog(const LevelPtr& level, const std::wstring& message) const;
|
---|
| 545 | #endif
|
---|
| 546 | #if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
|
---|
| 547 | /**
|
---|
| 548 | This method creates a new logging event and logs the event
|
---|
| 549 | without further checks.
|
---|
| 550 | @param level the level to log.
|
---|
| 551 | @param message message.
|
---|
| 552 | @param location location of source of logging request.
|
---|
| 553 | */
|
---|
| 554 | void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
|
---|
| 555 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 556 | /**
|
---|
| 557 | This method creates a new logging event and logs the event
|
---|
| 558 | without further checks.
|
---|
| 559 | @param level the level to log.
|
---|
| 560 | @param message message.
|
---|
| 561 | */
|
---|
| 562 | void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
|
---|
| 563 | #endif
|
---|
| 564 | #if LOG4CXX_CFSTRING_API
|
---|
| 565 | /**
|
---|
| 566 | This method creates a new logging event and logs the event
|
---|
| 567 | without further checks.
|
---|
| 568 | @param level the level to log.
|
---|
| 569 | @param message message.
|
---|
| 570 | @param location location of source of logging request.
|
---|
| 571 | */
|
---|
| 572 | void forcedLog(const LevelPtr& level, const CFStringRef& message,
|
---|
| 573 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 574 | /**
|
---|
| 575 | This method creates a new logging event and logs the event
|
---|
| 576 | without further checks.
|
---|
| 577 | @param level the level to log.
|
---|
| 578 | @param message message.
|
---|
| 579 | */
|
---|
| 580 | void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
|
---|
| 581 | #endif
|
---|
| 582 | /**
|
---|
| 583 | This method creates a new logging event and logs the event
|
---|
| 584 | without further checks.
|
---|
| 585 | @param level the level to log.
|
---|
| 586 | @param message the message string to log.
|
---|
| 587 | @param location location of the logging statement.
|
---|
| 588 | */
|
---|
| 589 | void forcedLogLS(const LevelPtr& level, const LogString& message,
|
---|
| 590 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 591 |
|
---|
| 592 | /**
|
---|
| 593 | Get the additivity flag for this Logger instance.
|
---|
| 594 | */
|
---|
| 595 | bool getAdditivity() const;
|
---|
| 596 |
|
---|
| 597 | /**
|
---|
| 598 | Get the appenders contained in this logger as an AppenderList.
|
---|
| 599 | If no appenders can be found, then an empty AppenderList
|
---|
| 600 | is returned.
|
---|
| 601 | @return AppenderList An collection of the appenders in this logger.*/
|
---|
| 602 | AppenderList getAllAppenders() const;
|
---|
| 603 |
|
---|
| 604 | /**
|
---|
| 605 | Look for the appender named as <code>name</code>.
|
---|
| 606 | <p>Return the appender with that name if in the list. Return
|
---|
| 607 | <code>NULL</code> otherwise. */
|
---|
| 608 | AppenderPtr getAppender(const LogString& name) const;
|
---|
| 609 |
|
---|
| 610 | /**
|
---|
| 611 | Starting from this logger, search the logger hierarchy for a
|
---|
| 612 | non-null level and return it.
|
---|
| 613 |
|
---|
| 614 | <p>The Logger class is designed so that this method executes as
|
---|
| 615 | quickly as possible.
|
---|
| 616 |
|
---|
| 617 | @throws RuntimeException if all levels are null in the hierarchy
|
---|
| 618 | */
|
---|
| 619 | virtual const LevelPtr& getEffectiveLevel() const;
|
---|
| 620 |
|
---|
| 621 | /**
|
---|
| 622 | Return the the LoggerRepository where this
|
---|
| 623 | <code>Logger</code> is attached.
|
---|
| 624 | */
|
---|
| 625 | log4cxx::spi::LoggerRepositoryPtr getLoggerRepository() const;
|
---|
| 626 |
|
---|
| 627 |
|
---|
| 628 | /**
|
---|
| 629 | * Get the logger name.
|
---|
| 630 | * @return logger name as LogString.
|
---|
| 631 | */
|
---|
| 632 | const LogString getName() const { return name; }
|
---|
| 633 | /**
|
---|
| 634 | * Get logger name in current encoding.
|
---|
| 635 | * @param name buffer to which name is appended.
|
---|
| 636 | */
|
---|
| 637 | void getName(std::string& name) const;
|
---|
| 638 | #if LOG4CXX_WCHAR_T_API
|
---|
| 639 | /**
|
---|
| 640 | * Get logger name.
|
---|
| 641 | * @param name buffer to which name is appended.
|
---|
| 642 | */
|
---|
| 643 | void getName(std::wstring& name) const;
|
---|
| 644 | #endif
|
---|
| 645 | #if LOG4CXX_UNICHAR_API
|
---|
| 646 | /**
|
---|
| 647 | * Get logger name.
|
---|
| 648 | * @param name buffer to which name is appended.
|
---|
| 649 | */
|
---|
| 650 | void getName(std::basic_string<UniChar>& name) const;
|
---|
| 651 | #endif
|
---|
| 652 | #if LOG4CXX_CFSTRING_API
|
---|
| 653 | /**
|
---|
| 654 | * Get logger name.
|
---|
| 655 | * @param name buffer to which name is appended.
|
---|
| 656 | */
|
---|
| 657 | void getName(CFStringRef& name) const;
|
---|
| 658 | #endif
|
---|
| 659 |
|
---|
| 660 | /**
|
---|
| 661 | Returns the parent of this logger. Note that the parent of a
|
---|
| 662 | given logger may change during the lifetime of the logger.
|
---|
| 663 |
|
---|
| 664 | <p>The root logger will return <code>0</code>.
|
---|
| 665 | */
|
---|
| 666 | LoggerPtr getParent() const;
|
---|
| 667 |
|
---|
| 668 |
|
---|
| 669 | /**
|
---|
| 670 | Returns the assigned Level, if any, for this Logger.
|
---|
| 671 |
|
---|
| 672 | @return Level - the assigned Level, can be null.
|
---|
| 673 | */
|
---|
| 674 | LevelPtr getLevel() const;
|
---|
| 675 |
|
---|
| 676 | /**
|
---|
| 677 | * Retrieve a logger by name in current encoding.
|
---|
| 678 | * @param name logger name.
|
---|
| 679 | */
|
---|
| 680 | static LoggerPtr getLogger(const std::string& name);
|
---|
| 681 | /**
|
---|
| 682 | * Retrieve a logger by name in current encoding.
|
---|
| 683 | * @param name logger name.
|
---|
| 684 | */
|
---|
| 685 | static LoggerPtr getLogger(const char* const name);
|
---|
| 686 | #if LOG4CXX_WCHAR_T_API
|
---|
| 687 | /**
|
---|
| 688 | * Retrieve a logger by name.
|
---|
| 689 | * @param name logger name.
|
---|
| 690 | */
|
---|
| 691 | static LoggerPtr getLogger(const std::wstring& name);
|
---|
| 692 | /**
|
---|
| 693 | * Retrieve a logger by name.
|
---|
| 694 | * @param name logger name.
|
---|
| 695 | */
|
---|
| 696 | static LoggerPtr getLogger(const wchar_t* const name);
|
---|
| 697 | #endif
|
---|
| 698 | #if LOG4CXX_UNICHAR_API
|
---|
| 699 | /**
|
---|
| 700 | * Retrieve a logger by name.
|
---|
| 701 | * @param name logger name.
|
---|
| 702 | */
|
---|
| 703 | static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
|
---|
| 704 | #endif
|
---|
| 705 | #if LOG4CXX_CFSTRING_API
|
---|
| 706 | /**
|
---|
| 707 | * Retrieve a logger by name.
|
---|
| 708 | * @param name logger name.
|
---|
| 709 | */
|
---|
| 710 | static LoggerPtr getLogger(const CFStringRef& name);
|
---|
| 711 | #endif
|
---|
| 712 | /**
|
---|
| 713 | * Retrieve a logger by name in Unicode.
|
---|
| 714 | * @param name logger name.
|
---|
| 715 | */
|
---|
| 716 | static LoggerPtr getLoggerLS(const LogString& name);
|
---|
| 717 |
|
---|
| 718 | /**
|
---|
| 719 | Retrieve the root logger.
|
---|
| 720 | */
|
---|
| 721 | static LoggerPtr getRootLogger();
|
---|
| 722 |
|
---|
| 723 | /**
|
---|
| 724 | Like #getLogger except that the type of logger
|
---|
| 725 | instantiated depends on the type returned by the
|
---|
| 726 | LoggerFactory#makeNewLoggerInstance method of the
|
---|
| 727 | <code>factory</code> parameter.
|
---|
| 728 |
|
---|
| 729 | <p>This method is intended to be used by sub-classes.
|
---|
| 730 |
|
---|
| 731 | @param name The name of the logger to retrieve.
|
---|
| 732 |
|
---|
| 733 | @param factory A LoggerFactory implementation that will
|
---|
| 734 | actually create a new Instance.
|
---|
| 735 | */
|
---|
| 736 | static LoggerPtr getLoggerLS(const LogString& name,
|
---|
| 737 | const log4cxx::spi::LoggerFactoryPtr& factory);
|
---|
| 738 | /**
|
---|
| 739 | Like #getLogger except that the type of logger
|
---|
| 740 | instantiated depends on the type returned by the
|
---|
| 741 | LoggerFactory#makeNewLoggerInstance method of the
|
---|
| 742 | <code>factory</code> parameter.
|
---|
| 743 |
|
---|
| 744 | <p>This method is intended to be used by sub-classes.
|
---|
| 745 |
|
---|
| 746 | @param name The name of the logger to retrieve.
|
---|
| 747 |
|
---|
| 748 | @param factory A LoggerFactory implementation that will
|
---|
| 749 | actually create a new Instance.
|
---|
| 750 | */
|
---|
| 751 | static LoggerPtr getLogger(const std::string& name,
|
---|
| 752 | const log4cxx::spi::LoggerFactoryPtr& factory);
|
---|
| 753 | #if LOG4CXX_WCHAR_T_API
|
---|
| 754 | /**
|
---|
| 755 | Like #getLogger except that the type of logger
|
---|
| 756 | instantiated depends on the type returned by the
|
---|
| 757 | LoggerFactory#makeNewLoggerInstance method of the
|
---|
| 758 | <code>factory</code> parameter.
|
---|
| 759 |
|
---|
| 760 | <p>This method is intended to be used by sub-classes.
|
---|
| 761 |
|
---|
| 762 | @param name The name of the logger to retrieve.
|
---|
| 763 |
|
---|
| 764 | @param factory A LoggerFactory implementation that will
|
---|
| 765 | actually create a new Instance.
|
---|
| 766 | */
|
---|
| 767 | static LoggerPtr getLogger(const std::wstring& name,
|
---|
| 768 | const log4cxx::spi::LoggerFactoryPtr& factory);
|
---|
| 769 | #endif
|
---|
| 770 | #if LOG4CXX_UNICHAR_API
|
---|
| 771 | /**
|
---|
| 772 | Like #getLogger except that the type of logger
|
---|
| 773 | instantiated depends on the type returned by the
|
---|
| 774 | LoggerFactory#makeNewLoggerInstance method of the
|
---|
| 775 | <code>factory</code> parameter.
|
---|
| 776 |
|
---|
| 777 | <p>This method is intended to be used by sub-classes.
|
---|
| 778 |
|
---|
| 779 | @param name The name of the logger to retrieve.
|
---|
| 780 |
|
---|
| 781 | @param factory A LoggerFactory implementation that will
|
---|
| 782 | actually create a new Instance.
|
---|
| 783 | */
|
---|
| 784 | static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
|
---|
| 785 | const log4cxx::spi::LoggerFactoryPtr& factory);
|
---|
| 786 | #endif
|
---|
| 787 | #if LOG4CXX_CFSTRING_API
|
---|
| 788 | /**
|
---|
| 789 | Like #getLogger except that the type of logger
|
---|
| 790 | instantiated depends on the type returned by the
|
---|
| 791 | LoggerFactory#makeNewLoggerInstance method of the
|
---|
| 792 | <code>factory</code> parameter.
|
---|
| 793 |
|
---|
| 794 | <p>This method is intended to be used by sub-classes.
|
---|
| 795 |
|
---|
| 796 | @param name The name of the logger to retrieve.
|
---|
| 797 |
|
---|
| 798 | @param factory A LoggerFactory implementation that will
|
---|
| 799 | actually create a new Instance.
|
---|
| 800 | */
|
---|
| 801 | static LoggerPtr getLogger(const CFStringRef& name,
|
---|
| 802 | const log4cxx::spi::LoggerFactoryPtr& factory);
|
---|
| 803 | #endif
|
---|
| 804 |
|
---|
| 805 | /**
|
---|
| 806 | Return the <em>inherited</em> ResourceBundle for this logger.
|
---|
| 807 |
|
---|
| 808 |
|
---|
| 809 | This method walks the hierarchy to find the appropriate resource bundle.
|
---|
| 810 | It will return the resource bundle attached to the closest ancestor of
|
---|
| 811 | this logger, much like the way priorities are searched. In case there
|
---|
| 812 | is no bundle in the hierarchy then <code>NULL</code> is returned.
|
---|
| 813 | */
|
---|
| 814 | helpers::ResourceBundlePtr getResourceBundle() const;
|
---|
| 815 |
|
---|
| 816 | protected:
|
---|
| 817 | /**
|
---|
| 818 | Returns the string resource coresponding to <code>key</code> in this
|
---|
| 819 | logger's inherited resource bundle.
|
---|
| 820 |
|
---|
| 821 | If the resource cannot be found, then an {@link #error error} message
|
---|
| 822 | will be logged complaining about the missing resource.
|
---|
| 823 |
|
---|
| 824 | @see #getResourceBundle.
|
---|
| 825 | */
|
---|
| 826 | LogString getResourceBundleString(const LogString& key) const;
|
---|
| 827 |
|
---|
| 828 | public:
|
---|
| 829 | /**
|
---|
| 830 | Log a message string with the INFO level.
|
---|
| 831 |
|
---|
| 832 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 833 | enabled by comparing the level of this logger with the
|
---|
| 834 | INFO level. If this logger is
|
---|
| 835 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 836 | registered appenders in this logger and also higher in the
|
---|
| 837 | hierarchy depending on the value of the additivity flag.
|
---|
| 838 |
|
---|
| 839 | @param msg the message string to log.
|
---|
| 840 | @param location location of source of logging request.
|
---|
| 841 | */
|
---|
| 842 | void info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 843 | void info(const std::string& msg) const;
|
---|
| 844 | #if LOG4CXX_WCHAR_T_API
|
---|
| 845 | /**
|
---|
| 846 | Log a message string with the INFO level.
|
---|
| 847 |
|
---|
| 848 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 849 | enabled by comparing the level of this logger with the
|
---|
| 850 | INFO level. If this logger is
|
---|
| 851 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 852 | registered appenders in this logger and also higher in the
|
---|
| 853 | hierarchy depending on the value of the additivity flag.
|
---|
| 854 |
|
---|
| 855 | @param msg the message string to log.
|
---|
| 856 | @param location location of source of logging request.
|
---|
| 857 | */
|
---|
| 858 | void info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 859 | /**
|
---|
| 860 | Log a message string with the INFO level.
|
---|
| 861 |
|
---|
| 862 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 863 | enabled by comparing the level of this logger with the
|
---|
| 864 | INFO level. If this logger is
|
---|
| 865 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 866 | registered appenders in this logger and also higher in the
|
---|
| 867 | hierarchy depending on the value of the additivity flag.
|
---|
| 868 |
|
---|
| 869 | @param msg the message string to log.
|
---|
| 870 | */
|
---|
| 871 | void info(const std::wstring& msg) const;
|
---|
| 872 | #endif
|
---|
| 873 | #if LOG4CXX_UNICHAR_API
|
---|
| 874 | /**
|
---|
| 875 | Log a message string with the INFO level.
|
---|
| 876 |
|
---|
| 877 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 878 | enabled by comparing the level of this logger with the
|
---|
| 879 | INFO level. If this logger is
|
---|
| 880 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 881 | registered appenders in this logger and also higher in the
|
---|
| 882 | hierarchy depending on the value of the additivity flag.
|
---|
| 883 |
|
---|
| 884 | @param msg the message string to log.
|
---|
| 885 | @param location location of source of logging request.
|
---|
| 886 | */
|
---|
| 887 | void info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 888 | /**
|
---|
| 889 | Log a message string with the INFO level.
|
---|
| 890 |
|
---|
| 891 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 892 | enabled by comparing the level of this logger with the
|
---|
| 893 | INFO level. If this logger is
|
---|
| 894 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 895 | registered appenders in this logger and also higher in the
|
---|
| 896 | hierarchy depending on the value of the additivity flag.
|
---|
| 897 |
|
---|
| 898 | @param msg the message string to log.
|
---|
| 899 | */
|
---|
| 900 | void info(const std::basic_string<UniChar>& msg) const;
|
---|
| 901 | #endif
|
---|
| 902 | #if LOG4CXX_CFSTRING_API
|
---|
| 903 | /**
|
---|
| 904 | Log a message string with the INFO level.
|
---|
| 905 |
|
---|
| 906 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 907 | enabled by comparing the level of this logger with the
|
---|
| 908 | INFO level. If this logger is
|
---|
| 909 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 910 | registered appenders in this logger and also higher in the
|
---|
| 911 | hierarchy depending on the value of the additivity flag.
|
---|
| 912 |
|
---|
| 913 | @param msg the message string to log.
|
---|
| 914 | @param location location of source of logging request.
|
---|
| 915 | */
|
---|
| 916 | void info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 917 | /**
|
---|
| 918 | Log a message string with the INFO level.
|
---|
| 919 |
|
---|
| 920 | <p>This method first checks if this logger is <code>INFO</code>
|
---|
| 921 | enabled by comparing the level of this logger with the
|
---|
| 922 | INFO level. If this logger is
|
---|
| 923 | <code>INFO</code> enabled, it proceeds to call all the
|
---|
| 924 | registered appenders in this logger and also higher in the
|
---|
| 925 | hierarchy depending on the value of the additivity flag.
|
---|
| 926 |
|
---|
| 927 | @param msg the message string to log.
|
---|
| 928 | */
|
---|
| 929 | void info(const CFStringRef& msg) const;
|
---|
| 930 | #endif
|
---|
| 931 |
|
---|
| 932 | /**
|
---|
| 933 | Is the appender passed as parameter attached to this logger?
|
---|
| 934 | */
|
---|
| 935 | bool isAttached(const AppenderPtr& appender) const;
|
---|
| 936 |
|
---|
| 937 | /**
|
---|
| 938 | * Check whether this logger is enabled for the <code>DEBUG</code>
|
---|
| 939 | * Level.
|
---|
| 940 | *
|
---|
| 941 | * <p> This function is intended to lessen the computational cost of
|
---|
| 942 | * disabled log debug statements.
|
---|
| 943 | *
|
---|
| 944 | * <p> For some <code>logger</code> Logger object, when you write,
|
---|
| 945 | * <pre>
|
---|
| 946 | * logger->debug("debug message");
|
---|
| 947 | * </pre>
|
---|
| 948 | *
|
---|
| 949 | * <p>You incur the cost constructing the message, concatenation in
|
---|
| 950 | * this case, regardless of whether the message is logged or not.
|
---|
| 951 | *
|
---|
| 952 | * <p>If you are worried about speed, then you should write
|
---|
| 953 | * <pre>
|
---|
| 954 | * if(logger->isDebugEnabled()) {
|
---|
| 955 | * logger->debug("debug message");
|
---|
| 956 | * }
|
---|
| 957 | * </pre>
|
---|
| 958 | *
|
---|
| 959 | * <p>This way you will not incur the cost of parameter
|
---|
| 960 | * construction if debugging is disabled for <code>logger</code>. On
|
---|
| 961 | * the other hand, if the <code>logger</code> is debug enabled, you
|
---|
| 962 | * will incur the cost of evaluating whether the logger is debug
|
---|
| 963 | * enabled twice. Once in <code>isDebugEnabled</code> and once in
|
---|
| 964 | * the <code>debug</code>. This is an insignificant overhead
|
---|
| 965 | * since evaluating a logger takes about 1%% of the time it
|
---|
| 966 | * takes to actually log.
|
---|
| 967 | *
|
---|
| 968 | * @return bool - <code>true</code> if this logger is debug
|
---|
| 969 | * enabled, <code>false</code> otherwise.
|
---|
| 970 | * */
|
---|
| 971 | bool isDebugEnabled() const;
|
---|
| 972 |
|
---|
| 973 | /**
|
---|
| 974 | Check whether this logger is enabled for a given
|
---|
| 975 | Level passed as parameter.
|
---|
| 976 |
|
---|
| 977 | See also #isDebugEnabled.
|
---|
| 978 |
|
---|
| 979 | @return bool True if this logger is enabled for <code>level</code>.
|
---|
| 980 | */
|
---|
| 981 | bool isEnabledFor(const LevelPtr& level) const;
|
---|
| 982 |
|
---|
| 983 |
|
---|
| 984 | /**
|
---|
| 985 | Check whether this logger is enabled for the info Level.
|
---|
| 986 | See also #isDebugEnabled.
|
---|
| 987 |
|
---|
| 988 | @return bool - <code>true</code> if this logger is enabled
|
---|
| 989 | for level info, <code>false</code> otherwise.
|
---|
| 990 | */
|
---|
| 991 | bool isInfoEnabled() const;
|
---|
| 992 |
|
---|
| 993 | /**
|
---|
| 994 | Check whether this logger is enabled for the warn Level.
|
---|
| 995 | See also #isDebugEnabled.
|
---|
| 996 |
|
---|
| 997 | @return bool - <code>true</code> if this logger is enabled
|
---|
| 998 | for level warn, <code>false</code> otherwise.
|
---|
| 999 | */
|
---|
| 1000 | bool isWarnEnabled() const;
|
---|
| 1001 |
|
---|
| 1002 | /**
|
---|
| 1003 | Check whether this logger is enabled for the error Level.
|
---|
| 1004 | See also #isDebugEnabled.
|
---|
| 1005 |
|
---|
| 1006 | @return bool - <code>true</code> if this logger is enabled
|
---|
| 1007 | for level error, <code>false</code> otherwise.
|
---|
| 1008 | */
|
---|
| 1009 | bool isErrorEnabled() const;
|
---|
| 1010 |
|
---|
| 1011 | /**
|
---|
| 1012 | Check whether this logger is enabled for the fatal Level.
|
---|
| 1013 | See also #isDebugEnabled.
|
---|
| 1014 |
|
---|
| 1015 | @return bool - <code>true</code> if this logger is enabled
|
---|
| 1016 | for level fatal, <code>false</code> otherwise.
|
---|
| 1017 | */
|
---|
| 1018 | bool isFatalEnabled() const;
|
---|
| 1019 |
|
---|
| 1020 | /**
|
---|
| 1021 | Check whether this logger is enabled for the trace level.
|
---|
| 1022 | See also #isDebugEnabled.
|
---|
| 1023 |
|
---|
| 1024 | @return bool - <code>true</code> if this logger is enabled
|
---|
| 1025 | for level trace, <code>false</code> otherwise.
|
---|
| 1026 | */
|
---|
| 1027 | bool isTraceEnabled() const;
|
---|
| 1028 |
|
---|
| 1029 | /**
|
---|
| 1030 | Log a localized and parameterized message.
|
---|
| 1031 |
|
---|
| 1032 | First, the user supplied
|
---|
| 1033 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1034 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1035 | supplied string array <code>params</code>.
|
---|
| 1036 |
|
---|
| 1037 | @param level The level of the logging request.
|
---|
| 1038 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1039 | @param locationInfo The location info of the logging request.
|
---|
| 1040 | @param values The values for the placeholders <code>{0}</code>,
|
---|
| 1041 | <code>{1}</code> etc. within the pattern.
|
---|
| 1042 |
|
---|
| 1043 | @see #setResourceBundle
|
---|
| 1044 | */
|
---|
| 1045 | void l7dlog(const LevelPtr& level, const LogString& key,
|
---|
| 1046 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1047 | const std::vector<LogString>& values) const;
|
---|
| 1048 | /**
|
---|
| 1049 | Log a localized and parameterized message.
|
---|
| 1050 |
|
---|
| 1051 | First, the user supplied
|
---|
| 1052 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1053 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1054 | supplied string array <code>params</code>.
|
---|
| 1055 |
|
---|
| 1056 | @param level The level of the logging request.
|
---|
| 1057 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1058 | @param locationInfo The location info of the logging request.
|
---|
| 1059 |
|
---|
| 1060 | @see #setResourceBundle
|
---|
| 1061 | */
|
---|
| 1062 | void l7dlog(const LevelPtr& level, const std::string& key,
|
---|
| 1063 | const log4cxx::spi::LocationInfo& locationInfo) const;
|
---|
| 1064 | /**
|
---|
| 1065 | Log a localized and parameterized message.
|
---|
| 1066 |
|
---|
| 1067 | First, the user supplied
|
---|
| 1068 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1069 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1070 | supplied string array <code>params</code>.
|
---|
| 1071 |
|
---|
| 1072 | @param level The level of the logging request.
|
---|
| 1073 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1074 | @param locationInfo The location info of the logging request.
|
---|
| 1075 | @param val1 The first value for the placeholders within the pattern.
|
---|
| 1076 |
|
---|
| 1077 | @see #setResourceBundle
|
---|
| 1078 | */
|
---|
| 1079 | void l7dlog(const LevelPtr& level, const std::string& key,
|
---|
| 1080 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1081 | const std::string& val1) const;
|
---|
| 1082 | /**
|
---|
| 1083 | Log a localized and parameterized message.
|
---|
| 1084 |
|
---|
| 1085 | First, the user supplied
|
---|
| 1086 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1087 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1088 | supplied string array <code>params</code>.
|
---|
| 1089 |
|
---|
| 1090 | @param level The level of the logging request.
|
---|
| 1091 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1092 | @param locationInfo The location info of the logging request.
|
---|
| 1093 | @param val1 The first value for the placeholders within the pattern.
|
---|
| 1094 | @param val2 The second value for the placeholders within the pattern.
|
---|
| 1095 |
|
---|
| 1096 | @see #setResourceBundle
|
---|
| 1097 | */
|
---|
| 1098 | void l7dlog(const LevelPtr& level, const std::string& key,
|
---|
| 1099 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1100 | const std::string& val1, const std::string& val2) const;
|
---|
| 1101 | /**
|
---|
| 1102 | Log a localized and parameterized message.
|
---|
| 1103 |
|
---|
| 1104 | First, the user supplied
|
---|
| 1105 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1106 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1107 | supplied string array <code>params</code>.
|
---|
| 1108 |
|
---|
| 1109 | @param level The level of the logging request.
|
---|
| 1110 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1111 | @param locationInfo The location info of the logging request.
|
---|
| 1112 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1113 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1114 | @param val3 The value for the third placeholder within the pattern.
|
---|
| 1115 |
|
---|
| 1116 | @see #setResourceBundle
|
---|
| 1117 | */
|
---|
| 1118 | void l7dlog(const LevelPtr& level, const std::string& key,
|
---|
| 1119 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1120 | const std::string& val1, const std::string& val2, const std::string& val3) const;
|
---|
| 1121 |
|
---|
| 1122 | #if LOG4CXX_WCHAR_T_API
|
---|
| 1123 | /**
|
---|
| 1124 | Log a localized and parameterized message.
|
---|
| 1125 |
|
---|
| 1126 | First, the user supplied
|
---|
| 1127 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1128 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1129 | supplied string array <code>params</code>.
|
---|
| 1130 |
|
---|
| 1131 | @param level The level of the logging request.
|
---|
| 1132 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1133 | @param locationInfo The location info of the logging request.
|
---|
| 1134 |
|
---|
| 1135 | @see #setResourceBundle
|
---|
| 1136 | */
|
---|
| 1137 | void l7dlog(const LevelPtr& level, const std::wstring& key,
|
---|
| 1138 | const log4cxx::spi::LocationInfo& locationInfo) const;
|
---|
| 1139 | /**
|
---|
| 1140 | Log a localized and parameterized message.
|
---|
| 1141 |
|
---|
| 1142 | First, the user supplied
|
---|
| 1143 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1144 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1145 | supplied string array <code>params</code>.
|
---|
| 1146 |
|
---|
| 1147 | @param level The level of the logging request.
|
---|
| 1148 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1149 | @param locationInfo The location info of the logging request.
|
---|
| 1150 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1151 |
|
---|
| 1152 | @see #setResourceBundle
|
---|
| 1153 | */
|
---|
| 1154 | void l7dlog(const LevelPtr& level, const std::wstring& key,
|
---|
| 1155 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1156 | const std::wstring& val1) const;
|
---|
| 1157 | /**
|
---|
| 1158 | Log a localized and parameterized message.
|
---|
| 1159 |
|
---|
| 1160 | First, the user supplied
|
---|
| 1161 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1162 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1163 | supplied string array <code>params</code>.
|
---|
| 1164 |
|
---|
| 1165 | @param level The level of the logging request.
|
---|
| 1166 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1167 | @param locationInfo The location info of the logging request.
|
---|
| 1168 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1169 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1170 |
|
---|
| 1171 | @see #setResourceBundle
|
---|
| 1172 | */
|
---|
| 1173 | void l7dlog(const LevelPtr& level, const std::wstring& key,
|
---|
| 1174 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1175 | const std::wstring& val1, const std::wstring& val2) const;
|
---|
| 1176 | /**
|
---|
| 1177 | Log a localized and parameterized message.
|
---|
| 1178 |
|
---|
| 1179 | First, the user supplied
|
---|
| 1180 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1181 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1182 | supplied string array <code>params</code>.
|
---|
| 1183 |
|
---|
| 1184 | @param level The level of the logging request.
|
---|
| 1185 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1186 | @param locationInfo The location info of the logging request.
|
---|
| 1187 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1188 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1189 | @param val3 The value for the third placeholder within the pattern.
|
---|
| 1190 |
|
---|
| 1191 | @see #setResourceBundle
|
---|
| 1192 | */
|
---|
| 1193 | void l7dlog(const LevelPtr& level, const std::wstring& key,
|
---|
| 1194 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1195 | const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
|
---|
| 1196 | #endif
|
---|
| 1197 | #if LOG4CXX_UNICHAR_API
|
---|
| 1198 | /**
|
---|
| 1199 | Log a localized and parameterized message.
|
---|
| 1200 |
|
---|
| 1201 | First, the user supplied
|
---|
| 1202 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1203 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1204 | supplied string array <code>params</code>.
|
---|
| 1205 |
|
---|
| 1206 | @param level The level of the logging request.
|
---|
| 1207 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1208 | @param locationInfo The location info of the logging request.
|
---|
| 1209 |
|
---|
| 1210 | @see #setResourceBundle
|
---|
| 1211 | */
|
---|
| 1212 | void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
|
---|
| 1213 | const log4cxx::spi::LocationInfo& locationInfo) const;
|
---|
| 1214 | /**
|
---|
| 1215 | Log a localized and parameterized message.
|
---|
| 1216 |
|
---|
| 1217 | First, the user supplied
|
---|
| 1218 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1219 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1220 | supplied string array <code>params</code>.
|
---|
| 1221 |
|
---|
| 1222 | @param level The level of the logging request.
|
---|
| 1223 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1224 | @param locationInfo The location info of the logging request.
|
---|
| 1225 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1226 |
|
---|
| 1227 | @see #setResourceBundle
|
---|
| 1228 | */
|
---|
| 1229 | void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
|
---|
| 1230 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1231 | const std::basic_string<UniChar>& val1) const;
|
---|
| 1232 | /**
|
---|
| 1233 | Log a localized and parameterized message.
|
---|
| 1234 |
|
---|
| 1235 | First, the user supplied
|
---|
| 1236 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1237 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1238 | supplied string array <code>params</code>.
|
---|
| 1239 |
|
---|
| 1240 | @param level The level of the logging request.
|
---|
| 1241 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1242 | @param locationInfo The location info of the logging request.
|
---|
| 1243 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1244 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1245 |
|
---|
| 1246 | @see #setResourceBundle
|
---|
| 1247 | */
|
---|
| 1248 | void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
|
---|
| 1249 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1250 | const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
|
---|
| 1251 | /**
|
---|
| 1252 | Log a localized and parameterized message.
|
---|
| 1253 |
|
---|
| 1254 | First, the user supplied
|
---|
| 1255 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1256 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1257 | supplied string array <code>params</code>.
|
---|
| 1258 |
|
---|
| 1259 | @param level The level of the logging request.
|
---|
| 1260 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1261 | @param locationInfo The location info of the logging request.
|
---|
| 1262 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1263 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1264 | @param val3 The value for the third placeholder within the pattern.
|
---|
| 1265 |
|
---|
| 1266 | @see #setResourceBundle
|
---|
| 1267 | */
|
---|
| 1268 | void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
|
---|
| 1269 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1270 | const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
|
---|
| 1271 | const std::basic_string<UniChar>& val3) const;
|
---|
| 1272 | #endif
|
---|
| 1273 | #if LOG4CXX_CFSTRING_API
|
---|
| 1274 | /**
|
---|
| 1275 | Log a localized and parameterized message.
|
---|
| 1276 |
|
---|
| 1277 | First, the user supplied
|
---|
| 1278 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1279 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1280 | supplied string array <code>params</code>.
|
---|
| 1281 |
|
---|
| 1282 | @param level The level of the logging request.
|
---|
| 1283 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1284 | @param locationInfo The location info of the logging request.
|
---|
| 1285 |
|
---|
| 1286 | @see #setResourceBundle
|
---|
| 1287 | */
|
---|
| 1288 | void l7dlog(const LevelPtr& level, const CFStringRef& key,
|
---|
| 1289 | const log4cxx::spi::LocationInfo& locationInfo) const;
|
---|
| 1290 | /**
|
---|
| 1291 | Log a localized and parameterized message.
|
---|
| 1292 |
|
---|
| 1293 | First, the user supplied
|
---|
| 1294 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1295 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1296 | supplied string array <code>params</code>.
|
---|
| 1297 |
|
---|
| 1298 | @param level The level of the logging request.
|
---|
| 1299 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1300 | @param locationInfo The location info of the logging request.
|
---|
| 1301 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1302 |
|
---|
| 1303 | @see #setResourceBundle
|
---|
| 1304 | */
|
---|
| 1305 | void l7dlog(const LevelPtr& level, const CFStringRef& key,
|
---|
| 1306 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1307 | const CFStringRef& val1) const;
|
---|
| 1308 | /**
|
---|
| 1309 | Log a localized and parameterized message.
|
---|
| 1310 |
|
---|
| 1311 | First, the user supplied
|
---|
| 1312 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1313 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1314 | supplied string array <code>params</code>.
|
---|
| 1315 |
|
---|
| 1316 | @param level The level of the logging request.
|
---|
| 1317 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1318 | @param locationInfo The location info of the logging request.
|
---|
| 1319 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1320 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1321 |
|
---|
| 1322 | @see #setResourceBundle
|
---|
| 1323 | */
|
---|
| 1324 | void l7dlog(const LevelPtr& level, const CFStringRef& key,
|
---|
| 1325 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1326 | const CFStringRef& val1, const CFStringRef& val2) const;
|
---|
| 1327 | /**
|
---|
| 1328 | Log a localized and parameterized message.
|
---|
| 1329 |
|
---|
| 1330 | First, the user supplied
|
---|
| 1331 | <code>key</code> is searched in the resource bundle. Next, the resulting
|
---|
| 1332 | pattern is formatted using helpers::StringHelper::format method with the user
|
---|
| 1333 | supplied string array <code>params</code>.
|
---|
| 1334 |
|
---|
| 1335 | @param level The level of the logging request.
|
---|
| 1336 | @param key The key to be searched in the ResourceBundle.
|
---|
| 1337 | @param locationInfo The location info of the logging request.
|
---|
| 1338 | @param val1 The value for the first placeholder within the pattern.
|
---|
| 1339 | @param val2 The value for the second placeholder within the pattern.
|
---|
| 1340 | @param val3 The value for the third placeholder within the pattern.
|
---|
| 1341 |
|
---|
| 1342 | @see #setResourceBundle
|
---|
| 1343 | */
|
---|
| 1344 | void l7dlog(const LevelPtr& level, const CFStringRef& key,
|
---|
| 1345 | const log4cxx::spi::LocationInfo& locationInfo,
|
---|
| 1346 | const CFStringRef& val1, const CFStringRef& val2,
|
---|
| 1347 | const CFStringRef& val3) const;
|
---|
| 1348 | #endif
|
---|
| 1349 |
|
---|
| 1350 | /**
|
---|
| 1351 | This is the most generic printing method. It is intended to be
|
---|
| 1352 | invoked by <b>wrapper</b> classes.
|
---|
| 1353 |
|
---|
| 1354 | @param level The level of the logging request.
|
---|
| 1355 | @param message The message of the logging request.
|
---|
| 1356 | @param location The source file of the logging request, may be null. */
|
---|
| 1357 | void log(const LevelPtr& level, const std::string& message,
|
---|
| 1358 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1359 | /**
|
---|
| 1360 | This is the most generic printing method. It is intended to be
|
---|
| 1361 | invoked by <b>wrapper</b> classes.
|
---|
| 1362 |
|
---|
| 1363 | @param level The level of the logging request.
|
---|
| 1364 | @param message The message of the logging request.
|
---|
| 1365 | */
|
---|
| 1366 | void log(const LevelPtr& level, const std::string& message) const;
|
---|
| 1367 | #if LOG4CXX_WCHAR_T_API
|
---|
| 1368 | /**
|
---|
| 1369 | This is the most generic printing method. It is intended to be
|
---|
| 1370 | invoked by <b>wrapper</b> classes.
|
---|
| 1371 |
|
---|
| 1372 | @param level The level of the logging request.
|
---|
| 1373 | @param message The message of the logging request.
|
---|
| 1374 | @param location The source file of the logging request, may be null. */
|
---|
| 1375 | void log(const LevelPtr& level, const std::wstring& message,
|
---|
| 1376 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1377 | /**
|
---|
| 1378 | This is the most generic printing method. It is intended to be
|
---|
| 1379 | invoked by <b>wrapper</b> classes.
|
---|
| 1380 |
|
---|
| 1381 | @param level The level of the logging request.
|
---|
| 1382 | @param message The message of the logging request.
|
---|
| 1383 | */
|
---|
| 1384 | void log(const LevelPtr& level, const std::wstring& message) const;
|
---|
| 1385 | #endif
|
---|
| 1386 | #if LOG4CXX_UNICHAR_API
|
---|
| 1387 | /**
|
---|
| 1388 | This is the most generic printing method. It is intended to be
|
---|
| 1389 | invoked by <b>wrapper</b> classes.
|
---|
| 1390 |
|
---|
| 1391 | @param level The level of the logging request.
|
---|
| 1392 | @param message The message of the logging request.
|
---|
| 1393 | @param location The source file of the logging request, may be null. */
|
---|
| 1394 | void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
|
---|
| 1395 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1396 | /**
|
---|
| 1397 | This is the most generic printing method. It is intended to be
|
---|
| 1398 | invoked by <b>wrapper</b> classes.
|
---|
| 1399 |
|
---|
| 1400 | @param level The level of the logging request.
|
---|
| 1401 | @param message The message of the logging request.
|
---|
| 1402 | */
|
---|
| 1403 | void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
|
---|
| 1404 | #endif
|
---|
| 1405 | #if LOG4CXX_CFSTRING_API
|
---|
| 1406 | /**
|
---|
| 1407 | This is the most generic printing method. It is intended to be
|
---|
| 1408 | invoked by <b>wrapper</b> classes.
|
---|
| 1409 |
|
---|
| 1410 | @param level The level of the logging request.
|
---|
| 1411 | @param message The message of the logging request.
|
---|
| 1412 | @param location The source file of the logging request, may be null. */
|
---|
| 1413 | void log(const LevelPtr& level, const CFStringRef& message,
|
---|
| 1414 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1415 | /**
|
---|
| 1416 | This is the most generic printing method. It is intended to be
|
---|
| 1417 | invoked by <b>wrapper</b> classes.
|
---|
| 1418 |
|
---|
| 1419 | @param level The level of the logging request.
|
---|
| 1420 | @param message The message of the logging request.
|
---|
| 1421 | */
|
---|
| 1422 | void log(const LevelPtr& level, const CFStringRef& message) const;
|
---|
| 1423 | #endif
|
---|
| 1424 | /**
|
---|
| 1425 | This is the most generic printing method. It is intended to be
|
---|
| 1426 | invoked by <b>wrapper</b> classes.
|
---|
| 1427 |
|
---|
| 1428 | @param level The level of the logging request.
|
---|
| 1429 | @param message The message of the logging request.
|
---|
| 1430 | @param location The source file of the logging request, may be null. */
|
---|
| 1431 | void logLS(const LevelPtr& level, const LogString& message,
|
---|
| 1432 | const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1433 |
|
---|
| 1434 |
|
---|
| 1435 |
|
---|
| 1436 | /**
|
---|
| 1437 | Remove all previously added appenders from this logger
|
---|
| 1438 | instance.
|
---|
| 1439 | <p>This is useful when re-reading configuration information.
|
---|
| 1440 | */
|
---|
| 1441 | void removeAllAppenders();
|
---|
| 1442 |
|
---|
| 1443 | /**
|
---|
| 1444 | Remove the appender passed as parameter form the list of appenders.
|
---|
| 1445 | */
|
---|
| 1446 | void removeAppender(const AppenderPtr& appender);
|
---|
| 1447 |
|
---|
| 1448 | /**
|
---|
| 1449 | Remove the appender with the name passed as parameter form the
|
---|
| 1450 | list of appenders.
|
---|
| 1451 | */
|
---|
| 1452 | void removeAppender(const LogString& name);
|
---|
| 1453 |
|
---|
| 1454 | /**
|
---|
| 1455 | Set the additivity flag for this Logger instance.
|
---|
| 1456 | */
|
---|
| 1457 | void setAdditivity(bool additive);
|
---|
| 1458 |
|
---|
| 1459 | protected:
|
---|
| 1460 | friend class Hierarchy;
|
---|
| 1461 | /**
|
---|
| 1462 | Only the Hierarchy class can set the hierarchy of a logger.*/
|
---|
| 1463 | void setHierarchy(spi::LoggerRepository * repository);
|
---|
| 1464 |
|
---|
| 1465 | public:
|
---|
| 1466 | /**
|
---|
| 1467 | Set the level of this Logger.
|
---|
| 1468 |
|
---|
| 1469 | <p>As in <pre> logger->setLevel(Level::getDebug()); </pre>
|
---|
| 1470 |
|
---|
| 1471 | <p>Null values are admitted. */
|
---|
| 1472 | virtual void setLevel(const LevelPtr& level);
|
---|
| 1473 |
|
---|
| 1474 | /**
|
---|
| 1475 | Set the resource bundle to be used with localized logging methods.
|
---|
| 1476 | */
|
---|
| 1477 | inline void setResourceBundle(const helpers::ResourceBundlePtr& bundle)
|
---|
| 1478 | { resourceBundle = bundle; }
|
---|
| 1479 |
|
---|
| 1480 | #if LOG4CXX_WCHAR_T_API
|
---|
| 1481 | /**
|
---|
| 1482 | Log a message string with the WARN level.
|
---|
| 1483 |
|
---|
| 1484 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1485 | enabled by comparing the level of this logger with the
|
---|
| 1486 | WARN level. If this logger is
|
---|
| 1487 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1488 | registered appenders in this logger and also higher in the
|
---|
| 1489 | hierarchy depending on the value of the additivity flag.
|
---|
| 1490 |
|
---|
| 1491 | @param msg the message string to log.
|
---|
| 1492 | @param location location of source of logging request.
|
---|
| 1493 | */
|
---|
| 1494 | void warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1495 | /**
|
---|
| 1496 | Log a message string with the WARN level.
|
---|
| 1497 |
|
---|
| 1498 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1499 | enabled by comparing the level of this logger with the
|
---|
| 1500 | WARN level. If this logger is
|
---|
| 1501 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1502 | registered appenders in this logger and also higher in the
|
---|
| 1503 | hierarchy depending on the value of the additivity flag.
|
---|
| 1504 |
|
---|
| 1505 | @param msg the message string to log.
|
---|
| 1506 | */
|
---|
| 1507 | void warn(const std::wstring& msg) const;
|
---|
| 1508 | #endif
|
---|
| 1509 | #if LOG4CXX_UNICHAR_API
|
---|
| 1510 | /**
|
---|
| 1511 | Log a message string with the WARN level.
|
---|
| 1512 |
|
---|
| 1513 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1514 | enabled by comparing the level of this logger with the
|
---|
| 1515 | WARN level. If this logger is
|
---|
| 1516 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1517 | registered appenders in this logger and also higher in the
|
---|
| 1518 | hierarchy depending on the value of the additivity flag.
|
---|
| 1519 |
|
---|
| 1520 | @param msg the message string to log.
|
---|
| 1521 | @param location location of source of logging request.
|
---|
| 1522 | */
|
---|
| 1523 | void warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1524 | /**
|
---|
| 1525 | Log a message string with the WARN level.
|
---|
| 1526 |
|
---|
| 1527 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1528 | enabled by comparing the level of this logger with the
|
---|
| 1529 | WARN level. If this logger is
|
---|
| 1530 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1531 | registered appenders in this logger and also higher in the
|
---|
| 1532 | hierarchy depending on the value of the additivity flag.
|
---|
| 1533 |
|
---|
| 1534 | @param msg the message string to log.
|
---|
| 1535 | */
|
---|
| 1536 | void warn(const std::basic_string<UniChar>& msg) const;
|
---|
| 1537 | #endif
|
---|
| 1538 | #if LOG4CXX_CFSTRING_API
|
---|
| 1539 | /**
|
---|
| 1540 | Log a message string with the WARN level.
|
---|
| 1541 |
|
---|
| 1542 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1543 | enabled by comparing the level of this logger with the
|
---|
| 1544 | WARN level. If this logger is
|
---|
| 1545 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1546 | registered appenders in this logger and also higher in the
|
---|
| 1547 | hierarchy depending on the value of the additivity flag.
|
---|
| 1548 |
|
---|
| 1549 | @param msg the message string to log.
|
---|
| 1550 | @param location location of source of logging request.
|
---|
| 1551 | */
|
---|
| 1552 | void warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1553 | /**
|
---|
| 1554 | Log a message string with the WARN level.
|
---|
| 1555 |
|
---|
| 1556 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1557 | enabled by comparing the level of this logger with the
|
---|
| 1558 | WARN level. If this logger is
|
---|
| 1559 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1560 | registered appenders in this logger and also higher in the
|
---|
| 1561 | hierarchy depending on the value of the additivity flag.
|
---|
| 1562 |
|
---|
| 1563 | @param msg the message string to log.
|
---|
| 1564 | */
|
---|
| 1565 | void warn(const CFStringRef& msg) const;
|
---|
| 1566 | #endif
|
---|
| 1567 | /**
|
---|
| 1568 | Log a message string with the WARN level.
|
---|
| 1569 |
|
---|
| 1570 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1571 | enabled by comparing the level of this logger with the
|
---|
| 1572 | WARN level. If this logger is
|
---|
| 1573 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1574 | registered appenders in this logger and also higher in the
|
---|
| 1575 | hierarchy depending on the value of the additivity flag.
|
---|
| 1576 |
|
---|
| 1577 | @param msg the message string to log.
|
---|
| 1578 | @param location location of source of logging request.
|
---|
| 1579 | */
|
---|
| 1580 | void warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1581 | /**
|
---|
| 1582 | Log a message string with the WARN level.
|
---|
| 1583 |
|
---|
| 1584 | <p>This method first checks if this logger is <code>WARN</code>
|
---|
| 1585 | enabled by comparing the level of this logger with the
|
---|
| 1586 | WARN level. If this logger is
|
---|
| 1587 | <code>WARN</code> enabled, it proceeds to call all the
|
---|
| 1588 | registered appenders in this logger and also higher in the
|
---|
| 1589 | hierarchy depending on the value of the additivity flag.
|
---|
| 1590 |
|
---|
| 1591 | @param msg the message string to log.
|
---|
| 1592 | */
|
---|
| 1593 | void warn(const std::string& msg) const;
|
---|
| 1594 |
|
---|
| 1595 | #if LOG4CXX_WCHAR_T_API
|
---|
| 1596 | /**
|
---|
| 1597 | Log a message string with the TRACE level.
|
---|
| 1598 |
|
---|
| 1599 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1600 | enabled by comparing the level of this logger with the
|
---|
| 1601 | TRACE level. If this logger is
|
---|
| 1602 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1603 | registered appenders in this logger and also higher in the
|
---|
| 1604 | hierarchy depending on the value of the additivity flag.
|
---|
| 1605 |
|
---|
| 1606 | @param msg the message string to log.
|
---|
| 1607 | @param location location of source of logging request.
|
---|
| 1608 | */
|
---|
| 1609 | void trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1610 | /**
|
---|
| 1611 | Log a message string with the TRACE level.
|
---|
| 1612 |
|
---|
| 1613 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1614 | enabled by comparing the level of this logger with the
|
---|
| 1615 | TRACE level. If this logger is
|
---|
| 1616 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1617 | registered appenders in this logger and also higher in the
|
---|
| 1618 | hierarchy depending on the value of the additivity flag.
|
---|
| 1619 |
|
---|
| 1620 | @param msg the message string to log.
|
---|
| 1621 | */
|
---|
| 1622 | void trace(const std::wstring& msg) const;
|
---|
| 1623 | #endif
|
---|
| 1624 | #if LOG4CXX_UNICHAR_API
|
---|
| 1625 | /**
|
---|
| 1626 | Log a message string with the TRACE level.
|
---|
| 1627 |
|
---|
| 1628 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1629 | enabled by comparing the level of this logger with the
|
---|
| 1630 | TRACE level. If this logger is
|
---|
| 1631 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1632 | registered appenders in this logger and also higher in the
|
---|
| 1633 | hierarchy depending on the value of the additivity flag.
|
---|
| 1634 |
|
---|
| 1635 | @param msg the message string to log.
|
---|
| 1636 | @param location location of source of logging request.
|
---|
| 1637 | */
|
---|
| 1638 | void trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1639 | /**
|
---|
| 1640 | Log a message string with the TRACE level.
|
---|
| 1641 |
|
---|
| 1642 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1643 | enabled by comparing the level of this logger with the
|
---|
| 1644 | TRACE level. If this logger is
|
---|
| 1645 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1646 | registered appenders in this logger and also higher in the
|
---|
| 1647 | hierarchy depending on the value of the additivity flag.
|
---|
| 1648 |
|
---|
| 1649 | @param msg the message string to log.
|
---|
| 1650 | */
|
---|
| 1651 | void trace(const std::basic_string<UniChar>& msg) const;
|
---|
| 1652 | #endif
|
---|
| 1653 | #if LOG4CXX_CFSTRING_API
|
---|
| 1654 | /**
|
---|
| 1655 | Log a message string with the TRACE level.
|
---|
| 1656 |
|
---|
| 1657 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1658 | enabled by comparing the level of this logger with the
|
---|
| 1659 | TRACE level. If this logger is
|
---|
| 1660 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1661 | registered appenders in this logger and also higher in the
|
---|
| 1662 | hierarchy depending on the value of the additivity flag.
|
---|
| 1663 |
|
---|
| 1664 | @param msg the message string to log.
|
---|
| 1665 | @param location location of source of logging request.
|
---|
| 1666 | */
|
---|
| 1667 | void trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1668 | /**
|
---|
| 1669 | Log a message string with the TRACE level.
|
---|
| 1670 |
|
---|
| 1671 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1672 | enabled by comparing the level of this logger with the
|
---|
| 1673 | TRACE level. If this logger is
|
---|
| 1674 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1675 | registered appenders in this logger and also higher in the
|
---|
| 1676 | hierarchy depending on the value of the additivity flag.
|
---|
| 1677 |
|
---|
| 1678 | @param msg the message string to log.
|
---|
| 1679 | */
|
---|
| 1680 | void trace(const CFStringRef& msg) const;
|
---|
| 1681 | #endif
|
---|
| 1682 | /**
|
---|
| 1683 | Log a message string with the TRACE level.
|
---|
| 1684 |
|
---|
| 1685 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1686 | enabled by comparing the level of this logger with the
|
---|
| 1687 | TRACE level. If this logger is
|
---|
| 1688 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1689 | registered appenders in this logger and also higher in the
|
---|
| 1690 | hierarchy depending on the value of the additivity flag.
|
---|
| 1691 |
|
---|
| 1692 | @param msg the message string to log.
|
---|
| 1693 | @param location location of source of logging request.
|
---|
| 1694 | */
|
---|
| 1695 | void trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
|
---|
| 1696 | /**
|
---|
| 1697 | Log a message string with the TRACE level.
|
---|
| 1698 |
|
---|
| 1699 | <p>This method first checks if this logger is <code>TRACE</code>
|
---|
| 1700 | enabled by comparing the level of this logger with the
|
---|
| 1701 | TRACE level. If this logger is
|
---|
| 1702 | <code>TRACE</code> enabled, it proceeds to call all the
|
---|
| 1703 | registered appenders in this logger and also higher in the
|
---|
| 1704 | hierarchy depending on the value of the additivity flag.
|
---|
| 1705 |
|
---|
| 1706 | @param msg the message string to log.
|
---|
| 1707 | */
|
---|
| 1708 | void trace(const std::string& msg) const;
|
---|
| 1709 |
|
---|
| 1710 | inline const log4cxx::helpers::Mutex& getMutex() const { return mutex; }
|
---|
| 1711 |
|
---|
| 1712 | private:
|
---|
| 1713 | //
|
---|
| 1714 | // prevent copy and assignment
|
---|
| 1715 | Logger(const Logger&);
|
---|
| 1716 | Logger& operator=(const Logger&);
|
---|
| 1717 | log4cxx::helpers::Mutex mutex;
|
---|
| 1718 | friend class log4cxx::helpers::synchronized;
|
---|
| 1719 | };
|
---|
| 1720 | LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
|
---|
| 1721 |
|
---|
| 1722 | }
|
---|
| 1723 |
|
---|
| 1724 | /** @addtogroup LoggingMacros Logging macros
|
---|
| 1725 | @{
|
---|
| 1726 | */
|
---|
| 1727 |
|
---|
| 1728 | #if !defined(LOG4CXX_UNLIKELY)
|
---|
| 1729 | #if __GNUC__ >= 3
|
---|
| 1730 | /**
|
---|
| 1731 | Provides optimization hint to the compiler
|
---|
| 1732 | to optimize for the expression being false.
|
---|
| 1733 | @param expr boolean expression.
|
---|
| 1734 | @returns value of expression.
|
---|
| 1735 | */
|
---|
| 1736 | #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
|
---|
| 1737 | #else
|
---|
| 1738 | /**
|
---|
| 1739 | Provides optimization hint to the compiler
|
---|
| 1740 | to optimize for the expression being false.
|
---|
| 1741 | @param expr boolean expression.
|
---|
| 1742 | @returns value of expression.
|
---|
| 1743 | **/
|
---|
| 1744 | #define LOG4CXX_UNLIKELY(expr) expr
|
---|
| 1745 | #endif
|
---|
| 1746 | #endif
|
---|
| 1747 |
|
---|
| 1748 |
|
---|
| 1749 | /**
|
---|
| 1750 | Logs a message to a specified logger with a specified level.
|
---|
| 1751 |
|
---|
| 1752 | @param logger the logger to be used.
|
---|
| 1753 | @param level the level to log.
|
---|
| 1754 | @param message the message string to log.
|
---|
| 1755 | */
|
---|
| 1756 | #define LOG4CXX_LOG(logger, level, message) { \
|
---|
| 1757 | if (logger->isEnabledFor(level)) {\
|
---|
| 1758 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1759 | logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); } }
|
---|
| 1760 |
|
---|
| 1761 | /**
|
---|
| 1762 | Logs a message to a specified logger with a specified level.
|
---|
| 1763 |
|
---|
| 1764 | @param logger the logger to be used.
|
---|
| 1765 | @param level the level to log.
|
---|
| 1766 | @param message the message string to log in the internal encoding.
|
---|
| 1767 | */
|
---|
| 1768 | #define LOG4CXX_LOGLS(logger, level, message) { \
|
---|
| 1769 | if (logger->isEnabledFor(level)) {\
|
---|
| 1770 | ::log4cxx::helpers::LogCharMessageBuffer oss_; \
|
---|
| 1771 | logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); } }
|
---|
| 1772 |
|
---|
| 1773 | /**
|
---|
| 1774 | Logs a message to a specified logger with the DEBUG level.
|
---|
| 1775 |
|
---|
| 1776 | @param logger the logger to be used.
|
---|
| 1777 | @param message the message string to log.
|
---|
| 1778 | */
|
---|
| 1779 | #define LOG4CXX_DEBUG(logger, message) { \
|
---|
| 1780 | if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
|
---|
| 1781 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1782 | logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1783 |
|
---|
| 1784 | /**
|
---|
| 1785 | Logs a message to a specified logger with the TRACE level.
|
---|
| 1786 |
|
---|
| 1787 | @param logger the logger to be used.
|
---|
| 1788 | @param message the message string to log.
|
---|
| 1789 | */
|
---|
| 1790 | #define LOG4CXX_TRACE(logger, message) { \
|
---|
| 1791 | if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
|
---|
| 1792 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1793 | logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1794 |
|
---|
| 1795 |
|
---|
| 1796 | /**
|
---|
| 1797 | Logs a message to a specified logger with the INFO level.
|
---|
| 1798 |
|
---|
| 1799 | @param logger the logger to be used.
|
---|
| 1800 | @param message the message string to log.
|
---|
| 1801 | */
|
---|
| 1802 | #define LOG4CXX_INFO(logger, message) { \
|
---|
| 1803 | if (logger->isInfoEnabled()) {\
|
---|
| 1804 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1805 | logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1806 |
|
---|
| 1807 | /**
|
---|
| 1808 | Logs a message to a specified logger with the WARN level.
|
---|
| 1809 |
|
---|
| 1810 | @param logger the logger to be used.
|
---|
| 1811 | @param message the message string to log.
|
---|
| 1812 | */
|
---|
| 1813 | #define LOG4CXX_WARN(logger, message) { \
|
---|
| 1814 | if (logger->isWarnEnabled()) {\
|
---|
| 1815 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1816 | logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1817 |
|
---|
| 1818 | /**
|
---|
| 1819 | Logs a message to a specified logger with the ERROR level.
|
---|
| 1820 |
|
---|
| 1821 | @param logger the logger to be used.
|
---|
| 1822 | @param message the message string to log.
|
---|
| 1823 | */
|
---|
| 1824 | #define LOG4CXX_ERROR(logger, message) { \
|
---|
| 1825 | if (logger->isErrorEnabled()) {\
|
---|
| 1826 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1827 | logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1828 |
|
---|
| 1829 | /**
|
---|
| 1830 | Logs a error if the condition is not true.
|
---|
| 1831 |
|
---|
| 1832 | @param logger the logger to be used.
|
---|
| 1833 | @param condition condition
|
---|
| 1834 | @param message the message string to log.
|
---|
| 1835 | */
|
---|
| 1836 | #define LOG4CXX_ASSERT(logger, condition, message) { \
|
---|
| 1837 | if (!(condition) && logger->isErrorEnabled()) {\
|
---|
| 1838 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1839 | logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1840 |
|
---|
| 1841 |
|
---|
| 1842 | /**
|
---|
| 1843 | Logs a message to a specified logger with the FATAL level.
|
---|
| 1844 |
|
---|
| 1845 | @param logger the logger to be used.
|
---|
| 1846 | @param message the message string to log.
|
---|
| 1847 | */
|
---|
| 1848 | #define LOG4CXX_FATAL(logger, message) { \
|
---|
| 1849 | if (logger->isFatalEnabled()) {\
|
---|
| 1850 | ::log4cxx::helpers::MessageBuffer oss_; \
|
---|
| 1851 | logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }}
|
---|
| 1852 |
|
---|
| 1853 | /**
|
---|
| 1854 | Logs a localized message with no parameter.
|
---|
| 1855 |
|
---|
| 1856 | @param logger the logger to be used.
|
---|
| 1857 | @param level the level to log.
|
---|
| 1858 | @param key the key to be searched in the resourceBundle of the logger.
|
---|
| 1859 | */
|
---|
| 1860 | #define LOG4CXX_L7DLOG(logger, level, key) { \
|
---|
| 1861 | if (logger->isEnabledFor(level)) {\
|
---|
| 1862 | logger->l7dlog(level, key, LOG4CXX_LOCATION); }}
|
---|
| 1863 |
|
---|
| 1864 | /**
|
---|
| 1865 | Logs a localized message with one parameter.
|
---|
| 1866 |
|
---|
| 1867 | @param logger the logger to be used.
|
---|
| 1868 | @param level the level to log.
|
---|
| 1869 | @param key the key to be searched in the resourceBundle of the logger.
|
---|
| 1870 | @param p1 the unique parameter.
|
---|
| 1871 | */
|
---|
| 1872 | #define LOG4CXX_L7DLOG1(logger, level, key, p1) { \
|
---|
| 1873 | if (logger->isEnabledFor(level)) {\
|
---|
| 1874 | logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }}
|
---|
| 1875 |
|
---|
| 1876 | /**
|
---|
| 1877 | Logs a localized message with two parameters.
|
---|
| 1878 |
|
---|
| 1879 | @param logger the logger to be used.
|
---|
| 1880 | @param level the level to log.
|
---|
| 1881 | @param key the key to be searched in the resourceBundle of the logger.
|
---|
| 1882 | @param p1 the first parameter.
|
---|
| 1883 | @param p2 the second parameter.
|
---|
| 1884 | */
|
---|
| 1885 | #define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) { \
|
---|
| 1886 | if (logger->isEnabledFor(level)) {\
|
---|
| 1887 | logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }}
|
---|
| 1888 |
|
---|
| 1889 | /**
|
---|
| 1890 | Logs a localized message with three parameters.
|
---|
| 1891 |
|
---|
| 1892 | @param logger the logger to be used.
|
---|
| 1893 | @param level the level to log.
|
---|
| 1894 | @param key the key to be searched in the resourceBundle of the logger.
|
---|
| 1895 | @param p1 the first parameter.
|
---|
| 1896 | @param p2 the second parameter.
|
---|
| 1897 | @param p3 the third parameter.
|
---|
| 1898 | */
|
---|
| 1899 | #define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) { \
|
---|
| 1900 | if (logger->isEnabledFor(level)) {\
|
---|
| 1901 | logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }}
|
---|
| 1902 |
|
---|
| 1903 | /**@}*/
|
---|
| 1904 |
|
---|
| 1905 | #if defined(_MSC_VER)
|
---|
| 1906 | #pragma warning ( pop )
|
---|
| 1907 | #endif
|
---|
| 1908 |
|
---|
| 1909 | #include <log4cxx/spi/loggerrepository.h>
|
---|
| 1910 |
|
---|
| 1911 | #endif //_LOG4CXX_LOGGER_H
|
---|