Apache Commons Logging: Difference between revisions

Content deleted Content added
Created page with '{{Infobox software | name = Apache Commons Logging | logo = | screenshot = | caption = | developer...'
 
m Example: "Nonexistant" -> "Nonexistent", "non-existent" -> "nonexistent"
 
(29 intermediate revisions by 20 users not shown)
Line 1:
{{Short description|Logging model and program}}
{{Infobox software
| name = Apache Commons Logging
| logo = =
| screenshot = =
| caption = =
| developer = [[Apache Software Foundation]]
| released =
| latest release version = 1.23.4
| latest release date = {{releaseStart date and age|2024|201508|0716}}
| latest preview version =
| latest preview date = =
| operating system = [[Cross-platform]]
| repo = {{URL|https://github.com/apache/commons-logging}}
| programming language = [[Java (programming language)|Java]]
| genre = [[Logging Tool]]
| license = [[Apache License]] 2.0]]
| website = http{{URL|https://commons.apache.org/proper/commons-logging/}}
}}
 
{{lowercase|title=log4j}}
'''Apache Commons Logging''' (previously known as '''Jakarta Commons- Logging''' (or '''JCL)''') is a [[Java platform|Java]]-based [[data logging|logging]] utility and a programming model for logging and for other toolkits. It provides APIs[[Application programming interface|API]]s, log implementations, and [[Adapter pattern|wrapper]] implemetationsimplementations over some other tools.<ref name=":ac">{{Cite web|url = http://commons.apache.org/proper/commons-logging/|title = commons logging|access-date = |accessdate = 12 February 2016|website = Apache.org|publisher = Apache|last = |first = }}</ref><ref name=":ijcliwas_2">{{Cite book|title = IntergratingIntegrating Jakarta Commons Logging with IBM WebSphere Application Server V5|url=http://www-01.ibm.com/support/docview.wss?uid=swg27004610&aid=1|last = Zavala|first = D.A.|last2 = Lau| first2 = Y.C.| publisher = IBM corporation|year = 2004|___location = |volume = |pages = 2}}</ref><ref name=":ac_c">{{Cite web|url = http://commons.apache.org/proper/commons-logging/guide.html|title = contents|access-date = |accessdate = 12 February 2016|website = Apache.org|publisher = Apache|last = |first = }}</ref>
 
== Log4j 1 Log level ==
The following table defines the log levels and messages in JCLApache Commons Logging, in decreasing order of severity. The left column lists the log level designation in Jandand the right column provides a brief description of each log level.
 
{| class="wikitable"
Line 43 ⟶ 46:
| '''trace'''
| Most detailed information. Expect these to be written to logs only.
|}<ref name=":ac_c"/><ref name=":ajc_120">{{Cite book|title = Apache Jakarta Commons - Reusable Java Components|last = Iverson|first = W.|publisher = Pearson Education, Inc.|year = 2005|___location = Crawfordsville, Indiana, USA|volume = |pages = 120-122120–122}}</ref>
 
== Configuration ==
Two basic abstractions, Log and LogFactory, are used in JCLApache Commons Logging.<ref name=":ac_c"/>
 
== Example ==
Sample code may look like as follows:
<sourcesyntaxhighlight lang="Java">
package com.cascadetg.ch09;
 
Line 59 ⟶ 63:
{
// Note that you pass in an instance of this class to the
// log generator. This allows you to find the messages
// generated by this class.
private static Log log = LogFactory.getLog(LogGenerator.class);
Line 96 ⟶ 100:
} catch (Exception e)
{
log.fatal(e.getMessage(), e);
}
 
Line 115 ⟶ 119:
try
{
Class.forName("com.cascadetg.NonexistantClassNonexistentClass");
} catch (Exception e)
{
log.warn("Can't find a non-existantnonexistent class!");
}
 
System.out.println();
Line 153 ⟶ 157:
System.out.println();
System.out.println("Log test complete.");
 
}
}
</sourcesyntaxhighlight><ref name=":ajc_120"/>
 
== See also ==
{{Portal|JavaComputer programming|Free and open-source software}}
*[[log4j]]
*[[Chainsaw (log file viewer)]]
* {{GitHub|https://github.com/apache/commons-logging/commits?author=costinm} }
 
== References ==
{{Reflist}}
 
== External links ==
{{Apache}}
*{{Official website|https://commons.apache.org/proper/commons-logging/}}
 
{{Apache Software Foundation}}
 
[[Category:Apache Software Foundation|Commons Logging]]
[[Category:Free software programmed in Java (programming language)]]
[[Category:Log file formats]]
[[Category:Software using the Apache license]]
[[Category:Apache Commons|Logging]]