Changes for page Wonder Logging

Last modified by Maik Musall on 2021/12/13 12:44

From version 16.2
edited by Maik Musall
on 2021/12/13 12:44
Change comment: Changed document parent to [xwiki:documentation.Home.How-tos.WebHome].
To version 11.1
edited by Johann Werner
on 2014/01/14 11:13
Change comment: remove link in header

Summary

Details

Page properties
Parent
... ... @@ -1,1 +1,0 @@
1 -documentation.Home.How-tos.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.mmusall
1 +XWiki.jw
Content
... ... @@ -62,8 +62,10 @@
62 62  }
63 63  {{/code}}
64 64  
65 -(% class="Apple-style-span" style="white-space: pre-wrap;" %) (%%)Of course you still can use parameters as long as the exception is the last param:
65 +(% class="Apple-style-span" style="white-space: pre-wrap;" %)
66 66  
67 +Of course you still can use parameters as long as the exception is the last param:
68 +
67 67  {{code language="java"}}
68 68  try {
69 69   …
... ... @@ -72,19 +72,6 @@
72 72  }
73 73  {{/code}}
74 74  
75 -=== Best Practices ===
76 -
77 -Logging normally takes not part of the public API of a class and thus should be kept internally. So your class should neither use class-external logger objects nor provide own logger objects to other classes but declare them in private variables instead. Best practice is to create a logger that way:
78 -
79 -{{code language="java"}}
80 -class MyClass {
81 - private static final Logger log = LoggerFactory.getLogger(MyClass.class);
82 - …
83 -}
84 -{{/code}}
85 -
86 -If you want to use a logger associated to another class you can pass that class to the getLogger method. Logger objects are cached so you won't create multiple instances of logger objects for the same class.
87 -
88 88  === More SLF4J info ===
89 89  
90 90  (% class="Apple-style-span" style="white-space: pre-wrap;" %)For more info regarding SLF4J look at the introductory [[user manual>>url:http://www.slf4j.org/manual.html||shape="rect"]] or head to their [[documentation page>>url:http://www.slf4j.org/docs.html||shape="rect"]].
... ... @@ -171,11 +171,3 @@
171 171  
172 172  The plan is to migrate all logging to use the SLF4J classes and afterwards to remove any SLF4J plugin from Wonder. That is Wonder won't be logging anything out of the box. If you use Wonder you will have to add the SLF4J plugin that //you// want to your project. By this you can control yourself if you want to log via log4j, commons logging, LOGBack or any other available framework.
173 173  Wonder could provide some optional logging framework that includes basic configuration and libraries for beginners to setup a simple log setup if they should not be wanting to take this step yet.
174 -
175 -\\
176 -
177 -== Using slf4j without log4j ==
178 -
179 -In light of [[CVE-2021-44228>>url:https://nvd.nist.gov/vuln/detail/CVE-2021-44228||shape="rect"]], it makes sense to completely substitute log4j with something else, which can be done by using [[log4j-over-slf4j>>url:http://www.slf4j.org/legacy.html#log4j-over-slf4j||shape="rect"]].
180 -
181 -\\