1 #region Copyright & License 2 // 3 // Copyright 2001-2006 The Apache Software Foundation 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // 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 #endregion 18 19 using System; 20 using System.Reflection; 21 22 using log4net.Core; 23 24 namespace log4net 25 { 26 /// <summary> 27 /// The ILog interface is use by application to log messages into 28 /// the log4net framework. 29 /// </summary> 30 /// <remarks> 31 /// <para> 32 /// Use the <see cref="LogManager"/> to obtain logger instances 33 /// that implement this interface. The <see cref="LogManager.GetLogger(Assembly,Type)"/> 34 /// static method is used to get logger instances. 35 /// </para> 36 /// <para> 37 /// This class contains methods for logging at different levels and also 38 /// has properties for determining if those logging levels are 39 /// enabled in the current configuration. 40 /// </para> 41 /// <para> 42 /// This interface can be implemented in different ways. This documentation 43 /// specifies reasonable behavior that a caller can expect from the actual 44 /// implementation, however different implementations reserve the right to 45 /// do things differently. 46 /// </para> 47 /// </remarks> 48 /// <example>Simple example of logging messages 49 /// <code lang="C#"> 50 /// ILog log = LogManager.GetLogger("application-log"); 51 /// 52 /// log.Info("Application Start"); 53 /// log.Debug("This is a debug message"); 54 /// 55 /// if (log.IsDebugEnabled) 56 /// { 57 /// log.Debug("This is another debug message"); 58 /// } 59 /// </code> 60 /// </example> 61 /// <seealso cref="LogManager"/> 62 /// <seealso cref="LogManager.GetLogger(Assembly, Type)"/> 63 /// <author>Nicko Cadell</author> 64 /// <author>Gert Driesen</author> 65 public interface ILog : ILoggerWrapper 66 { 67 /// <overloads>Log a message object with the <see cref="Level.Debug"/> level.</overloads> 68 /// <summary> 69 /// Log a message object with the <see cref="Level.Debug"/> level. 70 /// </summary> 71 /// <param name="message">The message object to log.</param> 72 /// <remarks> 73 /// <para> 74 /// This method first checks if this logger is <c>DEBUG</c> 75 /// enabled by comparing the level of this logger with the 76 /// <see cref="Level.Debug"/> level. If this logger is 77 /// <c>DEBUG</c> enabled, then it converts the message object 78 /// (passed as parameter) to a string by invoking the appropriate 79 /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 80 /// proceeds to call all the registered appenders in this logger 81 /// and also higher in the hierarchy depending on the value of 82 /// the additivity flag. 83 /// </para> 84 /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 85 /// to this method will print the name of the <see cref="Exception"/> 86 /// but no stack trace. To print a stack trace use the 87 /// <see cref="Debug(object,Exception)"/> form instead. 88 /// </para> 89 /// </remarks> 90 /// <seealso cref="Debug(object,Exception)"/> 91 /// <seealso cref="IsDebugEnabled"/> Debug(object message)92 void Debug(object message); 93 94 /// <summary> 95 /// Log a message object with the <see cref="Level.Debug"/> level including 96 /// the stack trace of the <see cref="Exception"/> passed 97 /// as a parameter. 98 /// </summary> 99 /// <param name="message">The message object to log.</param> 100 /// <param name="exception">The exception to log, including its stack trace.</param> 101 /// <remarks> 102 /// <para> 103 /// See the <see cref="Debug(object)"/> form for more detailed information. 104 /// </para> 105 /// </remarks> 106 /// <seealso cref="Debug(object)"/> 107 /// <seealso cref="IsDebugEnabled"/> Debug(object message, Exception exception)108 void Debug(object message, Exception exception); 109 110 /// <overloads>Log a formatted string with the <see cref="Level.Debug"/> level.</overloads> 111 /// <summary> 112 /// Logs a formatted message string with the <see cref="Level.Debug"/> level. 113 /// </summary> 114 /// <param name="format">A String containing zero or more format items</param> 115 /// <param name="args">An Object array containing zero or more objects to format</param> 116 /// <remarks> 117 /// <para> 118 /// The message is formatted using the <c>String.Format</c> method. See 119 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 120 /// of the formatting. 121 /// </para> 122 /// <para> 123 /// This method does not take an <see cref="Exception"/> object to include in the 124 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> 125 /// methods instead. 126 /// </para> 127 /// </remarks> 128 /// <seealso cref="Debug(object)"/> 129 /// <seealso cref="IsDebugEnabled"/> DebugFormat(string format, params object[] args)130 void DebugFormat(string format, params object[] args); 131 132 /// <summary> 133 /// Logs a formatted message string with the <see cref="Level.Debug"/> level. 134 /// </summary> 135 /// <param name="format">A String containing zero or more format items</param> 136 /// <param name="arg0">An Object to format</param> 137 /// <remarks> 138 /// <para> 139 /// The message is formatted using the <c>String.Format</c> method. See 140 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 141 /// of the formatting. 142 /// </para> 143 /// <para> 144 /// This method does not take an <see cref="Exception"/> object to include in the 145 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> 146 /// methods instead. 147 /// </para> 148 /// </remarks> 149 /// <seealso cref="Debug(object)"/> 150 /// <seealso cref="IsDebugEnabled"/> DebugFormat(string format, object arg0)151 void DebugFormat(string format, object arg0); 152 153 /// <summary> 154 /// Logs a formatted message string with the <see cref="Level.Debug"/> level. 155 /// </summary> 156 /// <param name="format">A String containing zero or more format items</param> 157 /// <param name="arg0">An Object to format</param> 158 /// <param name="arg1">An Object to format</param> 159 /// <remarks> 160 /// <para> 161 /// The message is formatted using the <c>String.Format</c> method. See 162 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 163 /// of the formatting. 164 /// </para> 165 /// <para> 166 /// This method does not take an <see cref="Exception"/> object to include in the 167 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> 168 /// methods instead. 169 /// </para> 170 /// </remarks> 171 /// <seealso cref="Debug(object)"/> 172 /// <seealso cref="IsDebugEnabled"/> DebugFormat(string format, object arg0, object arg1)173 void DebugFormat(string format, object arg0, object arg1); 174 175 /// <summary> 176 /// Logs a formatted message string with the <see cref="Level.Debug"/> level. 177 /// </summary> 178 /// <param name="format">A String containing zero or more format items</param> 179 /// <param name="arg0">An Object to format</param> 180 /// <param name="arg1">An Object to format</param> 181 /// <param name="arg2">An Object to format</param> 182 /// <remarks> 183 /// <para> 184 /// The message is formatted using the <c>String.Format</c> method. See 185 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 186 /// of the formatting. 187 /// </para> 188 /// <para> 189 /// This method does not take an <see cref="Exception"/> object to include in the 190 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> 191 /// methods instead. 192 /// </para> 193 /// </remarks> 194 /// <seealso cref="Debug(object)"/> 195 /// <seealso cref="IsDebugEnabled"/> DebugFormat(string format, object arg0, object arg1, object arg2)196 void DebugFormat(string format, object arg0, object arg1, object arg2); 197 198 /// <summary> 199 /// Logs a formatted message string with the <see cref="Level.Debug"/> level. 200 /// </summary> 201 /// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param> 202 /// <param name="format">A String containing zero or more format items</param> 203 /// <param name="args">An Object array containing zero or more objects to format</param> 204 /// <remarks> 205 /// <para> 206 /// The message is formatted using the <c>String.Format</c> method. See 207 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 208 /// of the formatting. 209 /// </para> 210 /// <para> 211 /// This method does not take an <see cref="Exception"/> object to include in the 212 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> 213 /// methods instead. 214 /// </para> 215 /// </remarks> 216 /// <seealso cref="Debug(object)"/> 217 /// <seealso cref="IsDebugEnabled"/> DebugFormat(IFormatProvider provider, string format, params object[] args)218 void DebugFormat(IFormatProvider provider, string format, params object[] args); 219 220 /// <overloads>Log a message object with the <see cref="Level.Info"/> level.</overloads> 221 /// <summary> 222 /// Logs a message object with the <see cref="Level.Info"/> level. 223 /// </summary> 224 /// <remarks> 225 /// <para> 226 /// This method first checks if this logger is <c>INFO</c> 227 /// enabled by comparing the level of this logger with the 228 /// <see cref="Level.Info"/> level. If this logger is 229 /// <c>INFO</c> enabled, then it converts the message object 230 /// (passed as parameter) to a string by invoking the appropriate 231 /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 232 /// proceeds to call all the registered appenders in this logger 233 /// and also higher in the hierarchy depending on the value of the 234 /// additivity flag. 235 /// </para> 236 /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 237 /// to this method will print the name of the <see cref="Exception"/> 238 /// but no stack trace. To print a stack trace use the 239 /// <see cref="Info(object,Exception)"/> form instead. 240 /// </para> 241 /// </remarks> 242 /// <param name="message">The message object to log.</param> 243 /// <seealso cref="Info(object,Exception)"/> 244 /// <seealso cref="IsInfoEnabled"/> Info(object message)245 void Info(object message); 246 247 /// <summary> 248 /// Logs a message object with the <c>INFO</c> level including 249 /// the stack trace of the <see cref="Exception"/> passed 250 /// as a parameter. 251 /// </summary> 252 /// <param name="message">The message object to log.</param> 253 /// <param name="exception">The exception to log, including its stack trace.</param> 254 /// <remarks> 255 /// <para> 256 /// See the <see cref="Info(object)"/> form for more detailed information. 257 /// </para> 258 /// </remarks> 259 /// <seealso cref="Info(object)"/> 260 /// <seealso cref="IsInfoEnabled"/> Info(object message, Exception exception)261 void Info(object message, Exception exception); 262 263 /// <overloads>Log a formatted message string with the <see cref="Level.Info"/> level.</overloads> 264 /// <summary> 265 /// Logs a formatted message string with the <see cref="Level.Info"/> level. 266 /// </summary> 267 /// <param name="format">A String containing zero or more format items</param> 268 /// <param name="args">An Object array containing zero or more objects to format</param> 269 /// <remarks> 270 /// <para> 271 /// The message is formatted using the <c>String.Format</c> method. See 272 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 273 /// of the formatting. 274 /// </para> 275 /// <para> 276 /// This method does not take an <see cref="Exception"/> object to include in the 277 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object)"/> 278 /// methods instead. 279 /// </para> 280 /// </remarks> 281 /// <seealso cref="Info(object,Exception)"/> 282 /// <seealso cref="IsInfoEnabled"/> InfoFormat(string format, params object[] args)283 void InfoFormat(string format, params object[] args); 284 285 /// <summary> 286 /// Logs a formatted message string with the <see cref="Level.Info"/> level. 287 /// </summary> 288 /// <param name="format">A String containing zero or more format items</param> 289 /// <param name="arg0">An Object to format</param> 290 /// <remarks> 291 /// <para> 292 /// The message is formatted using the <c>String.Format</c> method. See 293 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 294 /// of the formatting. 295 /// </para> 296 /// <para> 297 /// This method does not take an <see cref="Exception"/> object to include in the 298 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> 299 /// methods instead. 300 /// </para> 301 /// </remarks> 302 /// <seealso cref="Info(object)"/> 303 /// <seealso cref="IsInfoEnabled"/> InfoFormat(string format, object arg0)304 void InfoFormat(string format, object arg0); 305 306 /// <summary> 307 /// Logs a formatted message string with the <see cref="Level.Info"/> level. 308 /// </summary> 309 /// <param name="format">A String containing zero or more format items</param> 310 /// <param name="arg0">An Object to format</param> 311 /// <param name="arg1">An Object to format</param> 312 /// <remarks> 313 /// <para> 314 /// The message is formatted using the <c>String.Format</c> method. See 315 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 316 /// of the formatting. 317 /// </para> 318 /// <para> 319 /// This method does not take an <see cref="Exception"/> object to include in the 320 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> 321 /// methods instead. 322 /// </para> 323 /// </remarks> 324 /// <seealso cref="Info(object)"/> 325 /// <seealso cref="IsInfoEnabled"/> InfoFormat(string format, object arg0, object arg1)326 void InfoFormat(string format, object arg0, object arg1); 327 328 /// <summary> 329 /// Logs a formatted message string with the <see cref="Level.Info"/> level. 330 /// </summary> 331 /// <param name="format">A String containing zero or more format items</param> 332 /// <param name="arg0">An Object to format</param> 333 /// <param name="arg1">An Object to format</param> 334 /// <param name="arg2">An Object to format</param> 335 /// <remarks> 336 /// <para> 337 /// The message is formatted using the <c>String.Format</c> method. See 338 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 339 /// of the formatting. 340 /// </para> 341 /// <para> 342 /// This method does not take an <see cref="Exception"/> object to include in the 343 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> 344 /// methods instead. 345 /// </para> 346 /// </remarks> 347 /// <seealso cref="Info(object)"/> 348 /// <seealso cref="IsInfoEnabled"/> InfoFormat(string format, object arg0, object arg1, object arg2)349 void InfoFormat(string format, object arg0, object arg1, object arg2); 350 351 /// <summary> 352 /// Logs a formatted message string with the <see cref="Level.Info"/> level. 353 /// </summary> 354 /// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param> 355 /// <param name="format">A String containing zero or more format items</param> 356 /// <param name="args">An Object array containing zero or more objects to format</param> 357 /// <remarks> 358 /// <para> 359 /// The message is formatted using the <c>String.Format</c> method. See 360 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 361 /// of the formatting. 362 /// </para> 363 /// <para> 364 /// This method does not take an <see cref="Exception"/> object to include in the 365 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object)"/> 366 /// methods instead. 367 /// </para> 368 /// </remarks> 369 /// <seealso cref="Info(object,Exception)"/> 370 /// <seealso cref="IsInfoEnabled"/> InfoFormat(IFormatProvider provider, string format, params object[] args)371 void InfoFormat(IFormatProvider provider, string format, params object[] args); 372 373 /// <overloads>Log a message object with the <see cref="Level.Warn"/> level.</overloads> 374 /// <summary> 375 /// Log a message object with the <see cref="Level.Warn"/> level. 376 /// </summary> 377 /// <remarks> 378 /// <para> 379 /// This method first checks if this logger is <c>WARN</c> 380 /// enabled by comparing the level of this logger with the 381 /// <see cref="Level.Warn"/> level. If this logger is 382 /// <c>WARN</c> enabled, then it converts the message object 383 /// (passed as parameter) to a string by invoking the appropriate 384 /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 385 /// proceeds to call all the registered appenders in this logger 386 /// and also higher in the hierarchy depending on the value of the 387 /// additivity flag. 388 /// </para> 389 /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 390 /// to this method will print the name of the <see cref="Exception"/> 391 /// but no stack trace. To print a stack trace use the 392 /// <see cref="Warn(object,Exception)"/> form instead. 393 /// </para> 394 /// </remarks> 395 /// <param name="message">The message object to log.</param> 396 /// <seealso cref="Warn(object,Exception)"/> 397 /// <seealso cref="IsWarnEnabled"/> Warn(object message)398 void Warn(object message); 399 400 /// <summary> 401 /// Log a message object with the <see cref="Level.Warn"/> level including 402 /// the stack trace of the <see cref="Exception"/> passed 403 /// as a parameter. 404 /// </summary> 405 /// <param name="message">The message object to log.</param> 406 /// <param name="exception">The exception to log, including its stack trace.</param> 407 /// <remarks> 408 /// <para> 409 /// See the <see cref="Warn(object)"/> form for more detailed information. 410 /// </para> 411 /// </remarks> 412 /// <seealso cref="Warn(object)"/> 413 /// <seealso cref="IsWarnEnabled"/> Warn(object message, Exception exception)414 void Warn(object message, Exception exception); 415 416 /// <overloads>Log a formatted message string with the <see cref="Level.Warn"/> level.</overloads> 417 /// <summary> 418 /// Logs a formatted message string with the <see cref="Level.Warn"/> level. 419 /// </summary> 420 /// <param name="format">A String containing zero or more format items</param> 421 /// <param name="args">An Object array containing zero or more objects to format</param> 422 /// <remarks> 423 /// <para> 424 /// The message is formatted using the <c>String.Format</c> method. See 425 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 426 /// of the formatting. 427 /// </para> 428 /// <para> 429 /// This method does not take an <see cref="Exception"/> object to include in the 430 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object)"/> 431 /// methods instead. 432 /// </para> 433 /// </remarks> 434 /// <seealso cref="Warn(object,Exception)"/> 435 /// <seealso cref="IsWarnEnabled"/> WarnFormat(string format, params object[] args)436 void WarnFormat(string format, params object[] args); 437 438 /// <summary> 439 /// Logs a formatted message string with the <see cref="Level.Warn"/> level. 440 /// </summary> 441 /// <param name="format">A String containing zero or more format items</param> 442 /// <param name="arg0">An Object to format</param> 443 /// <remarks> 444 /// <para> 445 /// The message is formatted using the <c>String.Format</c> method. See 446 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 447 /// of the formatting. 448 /// </para> 449 /// <para> 450 /// This method does not take an <see cref="Exception"/> object to include in the 451 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> 452 /// methods instead. 453 /// </para> 454 /// </remarks> 455 /// <seealso cref="Warn(object)"/> 456 /// <seealso cref="IsWarnEnabled"/> WarnFormat(string format, object arg0)457 void WarnFormat(string format, object arg0); 458 459 /// <summary> 460 /// Logs a formatted message string with the <see cref="Level.Warn"/> level. 461 /// </summary> 462 /// <param name="format">A String containing zero or more format items</param> 463 /// <param name="arg0">An Object to format</param> 464 /// <param name="arg1">An Object to format</param> 465 /// <remarks> 466 /// <para> 467 /// The message is formatted using the <c>String.Format</c> method. See 468 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 469 /// of the formatting. 470 /// </para> 471 /// <para> 472 /// This method does not take an <see cref="Exception"/> object to include in the 473 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> 474 /// methods instead. 475 /// </para> 476 /// </remarks> 477 /// <seealso cref="Warn(object)"/> 478 /// <seealso cref="IsWarnEnabled"/> WarnFormat(string format, object arg0, object arg1)479 void WarnFormat(string format, object arg0, object arg1); 480 481 /// <summary> 482 /// Logs a formatted message string with the <see cref="Level.Warn"/> level. 483 /// </summary> 484 /// <param name="format">A String containing zero or more format items</param> 485 /// <param name="arg0">An Object to format</param> 486 /// <param name="arg1">An Object to format</param> 487 /// <param name="arg2">An Object to format</param> 488 /// <remarks> 489 /// <para> 490 /// The message is formatted using the <c>String.Format</c> method. See 491 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 492 /// of the formatting. 493 /// </para> 494 /// <para> 495 /// This method does not take an <see cref="Exception"/> object to include in the 496 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> 497 /// methods instead. 498 /// </para> 499 /// </remarks> 500 /// <seealso cref="Warn(object)"/> 501 /// <seealso cref="IsWarnEnabled"/> WarnFormat(string format, object arg0, object arg1, object arg2)502 void WarnFormat(string format, object arg0, object arg1, object arg2); 503 504 /// <summary> 505 /// Logs a formatted message string with the <see cref="Level.Warn"/> level. 506 /// </summary> 507 /// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param> 508 /// <param name="format">A String containing zero or more format items</param> 509 /// <param name="args">An Object array containing zero or more objects to format</param> 510 /// <remarks> 511 /// <para> 512 /// The message is formatted using the <c>String.Format</c> method. See 513 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 514 /// of the formatting. 515 /// </para> 516 /// <para> 517 /// This method does not take an <see cref="Exception"/> object to include in the 518 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object)"/> 519 /// methods instead. 520 /// </para> 521 /// </remarks> 522 /// <seealso cref="Warn(object,Exception)"/> 523 /// <seealso cref="IsWarnEnabled"/> WarnFormat(IFormatProvider provider, string format, params object[] args)524 void WarnFormat(IFormatProvider provider, string format, params object[] args); 525 526 /// <overloads>Log a message object with the <see cref="Level.Error"/> level.</overloads> 527 /// <summary> 528 /// Logs a message object with the <see cref="Level.Error"/> level. 529 /// </summary> 530 /// <param name="message">The message object to log.</param> 531 /// <remarks> 532 /// <para> 533 /// This method first checks if this logger is <c>ERROR</c> 534 /// enabled by comparing the level of this logger with the 535 /// <see cref="Level.Error"/> level. If this logger is 536 /// <c>ERROR</c> enabled, then it converts the message object 537 /// (passed as parameter) to a string by invoking the appropriate 538 /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 539 /// proceeds to call all the registered appenders in this logger 540 /// and also higher in the hierarchy depending on the value of the 541 /// additivity flag. 542 /// </para> 543 /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 544 /// to this method will print the name of the <see cref="Exception"/> 545 /// but no stack trace. To print a stack trace use the 546 /// <see cref="Error(object,Exception)"/> form instead. 547 /// </para> 548 /// </remarks> 549 /// <seealso cref="Error(object,Exception)"/> 550 /// <seealso cref="IsErrorEnabled"/> Error(object message)551 void Error(object message); 552 553 /// <summary> 554 /// Log a message object with the <see cref="Level.Error"/> level including 555 /// the stack trace of the <see cref="Exception"/> passed 556 /// as a parameter. 557 /// </summary> 558 /// <param name="message">The message object to log.</param> 559 /// <param name="exception">The exception to log, including its stack trace.</param> 560 /// <remarks> 561 /// <para> 562 /// See the <see cref="Error(object)"/> form for more detailed information. 563 /// </para> 564 /// </remarks> 565 /// <seealso cref="Error(object)"/> 566 /// <seealso cref="IsErrorEnabled"/> Error(object message, Exception exception)567 void Error(object message, Exception exception); 568 569 /// <overloads>Log a formatted message string with the <see cref="Level.Error"/> level.</overloads> 570 /// <summary> 571 /// Logs a formatted message string with the <see cref="Level.Error"/> level. 572 /// </summary> 573 /// <param name="format">A String containing zero or more format items</param> 574 /// <param name="args">An Object array containing zero or more objects to format</param> 575 /// <remarks> 576 /// <para> 577 /// The message is formatted using the <c>String.Format</c> method. See 578 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 579 /// of the formatting. 580 /// </para> 581 /// <para> 582 /// This method does not take an <see cref="Exception"/> object to include in the 583 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object)"/> 584 /// methods instead. 585 /// </para> 586 /// </remarks> 587 /// <seealso cref="Error(object,Exception)"/> 588 /// <seealso cref="IsErrorEnabled"/> ErrorFormat(string format, params object[] args)589 void ErrorFormat(string format, params object[] args); 590 591 /// <summary> 592 /// Logs a formatted message string with the <see cref="Level.Error"/> level. 593 /// </summary> 594 /// <param name="format">A String containing zero or more format items</param> 595 /// <param name="arg0">An Object to format</param> 596 /// <remarks> 597 /// <para> 598 /// The message is formatted using the <c>String.Format</c> method. See 599 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 600 /// of the formatting. 601 /// </para> 602 /// <para> 603 /// This method does not take an <see cref="Exception"/> object to include in the 604 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> 605 /// methods instead. 606 /// </para> 607 /// </remarks> 608 /// <seealso cref="Error(object)"/> 609 /// <seealso cref="IsErrorEnabled"/> ErrorFormat(string format, object arg0)610 void ErrorFormat(string format, object arg0); 611 612 /// <summary> 613 /// Logs a formatted message string with the <see cref="Level.Error"/> level. 614 /// </summary> 615 /// <param name="format">A String containing zero or more format items</param> 616 /// <param name="arg0">An Object to format</param> 617 /// <param name="arg1">An Object to format</param> 618 /// <remarks> 619 /// <para> 620 /// The message is formatted using the <c>String.Format</c> method. See 621 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 622 /// of the formatting. 623 /// </para> 624 /// <para> 625 /// This method does not take an <see cref="Exception"/> object to include in the 626 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> 627 /// methods instead. 628 /// </para> 629 /// </remarks> 630 /// <seealso cref="Error(object)"/> 631 /// <seealso cref="IsErrorEnabled"/> ErrorFormat(string format, object arg0, object arg1)632 void ErrorFormat(string format, object arg0, object arg1); 633 634 /// <summary> 635 /// Logs a formatted message string with the <see cref="Level.Error"/> level. 636 /// </summary> 637 /// <param name="format">A String containing zero or more format items</param> 638 /// <param name="arg0">An Object to format</param> 639 /// <param name="arg1">An Object to format</param> 640 /// <param name="arg2">An Object to format</param> 641 /// <remarks> 642 /// <para> 643 /// The message is formatted using the <c>String.Format</c> method. See 644 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 645 /// of the formatting. 646 /// </para> 647 /// <para> 648 /// This method does not take an <see cref="Exception"/> object to include in the 649 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> 650 /// methods instead. 651 /// </para> 652 /// </remarks> 653 /// <seealso cref="Error(object)"/> 654 /// <seealso cref="IsErrorEnabled"/> ErrorFormat(string format, object arg0, object arg1, object arg2)655 void ErrorFormat(string format, object arg0, object arg1, object arg2); 656 657 /// <summary> 658 /// Logs a formatted message string with the <see cref="Level.Error"/> level. 659 /// </summary> 660 /// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param> 661 /// <param name="format">A String containing zero or more format items</param> 662 /// <param name="args">An Object array containing zero or more objects to format</param> 663 /// <remarks> 664 /// <para> 665 /// The message is formatted using the <c>String.Format</c> method. See 666 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 667 /// of the formatting. 668 /// </para> 669 /// <para> 670 /// This method does not take an <see cref="Exception"/> object to include in the 671 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object)"/> 672 /// methods instead. 673 /// </para> 674 /// </remarks> 675 /// <seealso cref="Error(object,Exception)"/> 676 /// <seealso cref="IsErrorEnabled"/> ErrorFormat(IFormatProvider provider, string format, params object[] args)677 void ErrorFormat(IFormatProvider provider, string format, params object[] args); 678 679 /// <overloads>Log a message object with the <see cref="Level.Fatal"/> level.</overloads> 680 /// <summary> 681 /// Log a message object with the <see cref="Level.Fatal"/> level. 682 /// </summary> 683 /// <remarks> 684 /// <para> 685 /// This method first checks if this logger is <c>FATAL</c> 686 /// enabled by comparing the level of this logger with the 687 /// <see cref="Level.Fatal"/> level. If this logger is 688 /// <c>FATAL</c> enabled, then it converts the message object 689 /// (passed as parameter) to a string by invoking the appropriate 690 /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 691 /// proceeds to call all the registered appenders in this logger 692 /// and also higher in the hierarchy depending on the value of the 693 /// additivity flag. 694 /// </para> 695 /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 696 /// to this method will print the name of the <see cref="Exception"/> 697 /// but no stack trace. To print a stack trace use the 698 /// <see cref="Fatal(object,Exception)"/> form instead. 699 /// </para> 700 /// </remarks> 701 /// <param name="message">The message object to log.</param> 702 /// <seealso cref="Fatal(object,Exception)"/> 703 /// <seealso cref="IsFatalEnabled"/> Fatal(object message)704 void Fatal(object message); 705 706 /// <summary> 707 /// Log a message object with the <see cref="Level.Fatal"/> level including 708 /// the stack trace of the <see cref="Exception"/> passed 709 /// as a parameter. 710 /// </summary> 711 /// <param name="message">The message object to log.</param> 712 /// <param name="exception">The exception to log, including its stack trace.</param> 713 /// <remarks> 714 /// <para> 715 /// See the <see cref="Fatal(object)"/> form for more detailed information. 716 /// </para> 717 /// </remarks> 718 /// <seealso cref="Fatal(object)"/> 719 /// <seealso cref="IsFatalEnabled"/> Fatal(object message, Exception exception)720 void Fatal(object message, Exception exception); 721 722 /// <overloads>Log a formatted message string with the <see cref="Level.Fatal"/> level.</overloads> 723 /// <summary> 724 /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. 725 /// </summary> 726 /// <param name="format">A String containing zero or more format items</param> 727 /// <param name="args">An Object array containing zero or more objects to format</param> 728 /// <remarks> 729 /// <para> 730 /// The message is formatted using the <c>String.Format</c> method. See 731 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 732 /// of the formatting. 733 /// </para> 734 /// <para> 735 /// This method does not take an <see cref="Exception"/> object to include in the 736 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object)"/> 737 /// methods instead. 738 /// </para> 739 /// </remarks> 740 /// <seealso cref="Fatal(object,Exception)"/> 741 /// <seealso cref="IsFatalEnabled"/> FatalFormat(string format, params object[] args)742 void FatalFormat(string format, params object[] args); 743 744 /// <summary> 745 /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. 746 /// </summary> 747 /// <param name="format">A String containing zero or more format items</param> 748 /// <param name="arg0">An Object to format</param> 749 /// <remarks> 750 /// <para> 751 /// The message is formatted using the <c>String.Format</c> method. See 752 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 753 /// of the formatting. 754 /// </para> 755 /// <para> 756 /// This method does not take an <see cref="Exception"/> object to include in the 757 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> 758 /// methods instead. 759 /// </para> 760 /// </remarks> 761 /// <seealso cref="Fatal(object)"/> 762 /// <seealso cref="IsFatalEnabled"/> FatalFormat(string format, object arg0)763 void FatalFormat(string format, object arg0); 764 765 /// <summary> 766 /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. 767 /// </summary> 768 /// <param name="format">A String containing zero or more format items</param> 769 /// <param name="arg0">An Object to format</param> 770 /// <param name="arg1">An Object to format</param> 771 /// <remarks> 772 /// <para> 773 /// The message is formatted using the <c>String.Format</c> method. See 774 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 775 /// of the formatting. 776 /// </para> 777 /// <para> 778 /// This method does not take an <see cref="Exception"/> object to include in the 779 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> 780 /// methods instead. 781 /// </para> 782 /// </remarks> 783 /// <seealso cref="Fatal(object)"/> 784 /// <seealso cref="IsFatalEnabled"/> FatalFormat(string format, object arg0, object arg1)785 void FatalFormat(string format, object arg0, object arg1); 786 787 /// <summary> 788 /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. 789 /// </summary> 790 /// <param name="format">A String containing zero or more format items</param> 791 /// <param name="arg0">An Object to format</param> 792 /// <param name="arg1">An Object to format</param> 793 /// <param name="arg2">An Object to format</param> 794 /// <remarks> 795 /// <para> 796 /// The message is formatted using the <c>String.Format</c> method. See 797 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 798 /// of the formatting. 799 /// </para> 800 /// <para> 801 /// This method does not take an <see cref="Exception"/> object to include in the 802 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> 803 /// methods instead. 804 /// </para> 805 /// </remarks> 806 /// <seealso cref="Fatal(object)"/> 807 /// <seealso cref="IsFatalEnabled"/> FatalFormat(string format, object arg0, object arg1, object arg2)808 void FatalFormat(string format, object arg0, object arg1, object arg2); 809 810 /// <summary> 811 /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. 812 /// </summary> 813 /// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param> 814 /// <param name="format">A String containing zero or more format items</param> 815 /// <param name="args">An Object array containing zero or more objects to format</param> 816 /// <remarks> 817 /// <para> 818 /// The message is formatted using the <c>String.Format</c> method. See 819 /// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior 820 /// of the formatting. 821 /// </para> 822 /// <para> 823 /// This method does not take an <see cref="Exception"/> object to include in the 824 /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object)"/> 825 /// methods instead. 826 /// </para> 827 /// </remarks> 828 /// <seealso cref="Fatal(object,Exception)"/> 829 /// <seealso cref="IsFatalEnabled"/> FatalFormat(IFormatProvider provider, string format, params object[] args)830 void FatalFormat(IFormatProvider provider, string format, params object[] args); 831 832 /// <summary> 833 /// Checks if this logger is enabled for the <see cref="Level.Debug"/> level. 834 /// </summary> 835 /// <value> 836 /// <c>true</c> if this logger is enabled for <see cref="Level.Debug"/> events, <c>false</c> otherwise. 837 /// </value> 838 /// <remarks> 839 /// <para> 840 /// This function is intended to lessen the computational cost of 841 /// disabled log debug statements. 842 /// </para> 843 /// <para> For some ILog interface <c>log</c>, when you write:</para> 844 /// <code lang="C#"> 845 /// log.Debug("This is entry number: " + i ); 846 /// </code> 847 /// <para> 848 /// You incur the cost constructing the message, string construction and concatenation in 849 /// this case, regardless of whether the message is logged or not. 850 /// </para> 851 /// <para> 852 /// If you are worried about speed (who isn't), then you should write: 853 /// </para> 854 /// <code lang="C#"> 855 /// if (log.IsDebugEnabled) 856 /// { 857 /// log.Debug("This is entry number: " + i ); 858 /// } 859 /// </code> 860 /// <para> 861 /// This way you will not incur the cost of parameter 862 /// construction if debugging is disabled for <c>log</c>. On 863 /// the other hand, if the <c>log</c> is debug enabled, you 864 /// will incur the cost of evaluating whether the logger is debug 865 /// enabled twice. Once in <see cref="IsDebugEnabled"/> and once in 866 /// the <see cref="Debug(object)"/>. This is an insignificant overhead 867 /// since evaluating a logger takes about 1% of the time it 868 /// takes to actually log. This is the preferred style of logging. 869 /// </para> 870 /// <para>Alternatively if your logger is available statically then the is debug 871 /// enabled state can be stored in a static variable like this: 872 /// </para> 873 /// <code lang="C#"> 874 /// private static readonly bool isDebugEnabled = log.IsDebugEnabled; 875 /// </code> 876 /// <para> 877 /// Then when you come to log you can write: 878 /// </para> 879 /// <code lang="C#"> 880 /// if (isDebugEnabled) 881 /// { 882 /// log.Debug("This is entry number: " + i ); 883 /// } 884 /// </code> 885 /// <para> 886 /// This way the debug enabled state is only queried once 887 /// when the class is loaded. Using a <c>private static readonly</c> 888 /// variable is the most efficient because it is a run time constant 889 /// and can be heavily optimized by the JIT compiler. 890 /// </para> 891 /// <para> 892 /// Of course if you use a static readonly variable to 893 /// hold the enabled state of the logger then you cannot 894 /// change the enabled state at runtime to vary the logging 895 /// that is produced. You have to decide if you need absolute 896 /// speed or runtime flexibility. 897 /// </para> 898 /// </remarks> 899 /// <seealso cref="Debug(object)"/> 900 /// <seealso cref="DebugFormat(IFormatProvider, string, object[])"/> 901 bool IsDebugEnabled { get; } 902 903 /// <summary> 904 /// Checks if this logger is enabled for the <see cref="Level.Info"/> level. 905 /// </summary> 906 /// <value> 907 /// <c>true</c> if this logger is enabled for <see cref="Level.Info"/> events, <c>false</c> otherwise. 908 /// </value> 909 /// <remarks> 910 /// For more information see <see cref="ILog.IsDebugEnabled"/>. 911 /// </remarks> 912 /// <seealso cref="Info(object)"/> 913 /// <seealso cref="InfoFormat(IFormatProvider, string, object[])"/> 914 /// <seealso cref="ILog.IsDebugEnabled"/> 915 bool IsInfoEnabled { get; } 916 917 /// <summary> 918 /// Checks if this logger is enabled for the <see cref="Level.Warn"/> level. 919 /// </summary> 920 /// <value> 921 /// <c>true</c> if this logger is enabled for <see cref="Level.Warn"/> events, <c>false</c> otherwise. 922 /// </value> 923 /// <remarks> 924 /// For more information see <see cref="ILog.IsDebugEnabled"/>. 925 /// </remarks> 926 /// <seealso cref="Warn(object)"/> 927 /// <seealso cref="WarnFormat(IFormatProvider, string, object[])"/> 928 /// <seealso cref="ILog.IsDebugEnabled"/> 929 bool IsWarnEnabled { get; } 930 931 /// <summary> 932 /// Checks if this logger is enabled for the <see cref="Level.Error"/> level. 933 /// </summary> 934 /// <value> 935 /// <c>true</c> if this logger is enabled for <see cref="Level.Error"/> events, <c>false</c> otherwise. 936 /// </value> 937 /// <remarks> 938 /// For more information see <see cref="ILog.IsDebugEnabled"/>. 939 /// </remarks> 940 /// <seealso cref="Error(object)"/> 941 /// <seealso cref="ErrorFormat(IFormatProvider, string, object[])"/> 942 /// <seealso cref="ILog.IsDebugEnabled"/> 943 bool IsErrorEnabled { get; } 944 945 /// <summary> 946 /// Checks if this logger is enabled for the <see cref="Level.Fatal"/> level. 947 /// </summary> 948 /// <value> 949 /// <c>true</c> if this logger is enabled for <see cref="Level.Fatal"/> events, <c>false</c> otherwise. 950 /// </value> 951 /// <remarks> 952 /// For more information see <see cref="ILog.IsDebugEnabled"/>. 953 /// </remarks> 954 /// <seealso cref="Fatal(object)"/> 955 /// <seealso cref="FatalFormat(IFormatProvider, string, object[])"/> 956 /// <seealso cref="ILog.IsDebugEnabled"/> 957 bool IsFatalEnabled { get; } 958 } 959 } 960