This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit bde2bcbed98f9fb16ec5e59de591c534178ed683 Author: Robert Middleton <[email protected]> AuthorDate: Sun Jun 27 22:26:01 2021 -0400 Added configuration sample for location --- src/site/markdown/configuration-samples.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/site/markdown/configuration-samples.md b/src/site/markdown/configuration-samples.md index 413b003..e11a338 100644 --- a/src/site/markdown/configuration-samples.md +++ b/src/site/markdown/configuration-samples.md @@ -21,7 +21,7 @@ Configuration Samples {#configuration-samples} limitations under the License. --> -The following snippets show various ways of configuring log4cxx. +The following snippets show various ways of configuring Log4cxx. [TOC] @@ -74,9 +74,30 @@ followed by the level(5 character width), followed by the logger name 0 INFO root Hello there! ~~~ +## Pattern 4 {#pattern4} + +If you have no idea where a log message is coming from, it's possible to print +out more information about the place the log statement is coming from. For example, +we can get the filename, class name, method name, and line number in one log +message. This utilises the %%F(file name), %%C(class name), %%M(method name), %%L(line number) +patterns to output more information: + +~~~ +(%F:%C[%M]:%L) %m%n +~~~ + +Possible output: +~~~ +(/home/robert/log4cxx-test-programs/fooclass.cpp:FooClass[FooClass]:9) Constructor running +(/home/robert/log4cxx-test-programs/fooclass.cpp:FooClass[doFoo]:13) Doing foo +~~~ + +Note that unlike Java logging, the location information is free(as it utilizes +macros to determine this information at compile-time). + # XML Files {#xmlfiles} -One way of configuring log4cxx is with XML files. The following are some examples +One way of configuring Log4cxx is with XML files. The following are some examples on various ways of using an XML file to configure the logging. ## XML Example 1 {#xml-example-1}
