ILog.cs 41 KB

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