Apache Commons Logging: Difference between revisions

Content deleted Content added
m Fix link to Java portal (via WP:JWB)
m Example: "Nonexistant" -> "Nonexistent", "non-existent" -> "nonexistent"
 
(17 intermediate revisions by 14 users not shown)
Line 1:
{{Short description|Logging model and program}}
{{Infobox software
| name = Apache Commons Logging
| logo =
| screenshot =
| caption =
| developer = [[Apache Software Foundation]]
| caption =
| released =
| developer = [[Apache Software Foundation]]
| latest release version = 1.3.4
| released =
| latest release versiondate = 1.2{{Start date and age|2024|08|16}}
| latest release date = {{release date|2015|07}}
| latest preview version =
| latest preview date =
| operating system = [[Cross-platform]]
| website repo = {{URL|https://commonsgithub.com/apache.org/proper/commons-logging/}}
| programming language = [[Java (programming language)|Java]]
| genre = [[Logging Tool]]
| license = [[Apache License]] 2.0]]
| website = {{URL|https://commons.apache.org/proper/commons-logging/}}
| website = {{URL|https://commons.apache.org/proper/commons-logging/}}
}}
 
'''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 [[Application programming interface|API]]s, log implementations, and [[Adapter pattern|wrapper]] implementations 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 = Integrating 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>
 
== JCL logLog 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 and the right column provides a brief description of each log level.
 
{| class="wikitable"
Line 44 ⟶ 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–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 98 ⟶ 100:
} catch (Exception e)
{
log.fatal(e.getMessage(), e);
}
 
Line 117 ⟶ 119:
try
{
Class.forName("com.cascadetg.NonexistantClassNonexistentClass");
} catch (Exception e)
{
log.warn("Can't find a non-existentnonexistent class!");
}
 
System.out.println();
Line 155 ⟶ 157:
System.out.println();
System.out.println("Log test complete.");
 
}
}
</sourcesyntaxhighlight><ref name=":ajc_120"/>
 
== See also ==
{{Portal|JavaComputer (programming language)|Free and open-source software}}
*[[log4j]]
*[[Chainsaw (log file viewer)]]
*{{GitHub|https://github.com/apache/commons-logging/commits?author=costinm}}
 
== References ==
{{Reflist}}
 
== External links ==
*{{Official website|https://commons.apache.org/proper/commons-logging/}}
 
{{Apache Software Foundation}}
 
[[Category:Apache Software Foundation|Commons Logging]]
Line 178 ⟶ 179:
[[Category:Log file formats]]
[[Category:Software using the Apache license]]
[[Category:Apache Commons|Logging]]