FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

日志打印 · apple006/java-code@e83b49f · GitHub

Repository navigation

Commit e83b49f

Browse files
committed
日志打印
1 parent 9f39ad0 commit e83b49f

9 files changed

Lines changed: 60 additions & 1 deletion

File tree

‎basicKnowledge/.classpath‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<classpathentry kind="lib" path="lib/apache/commons-jxpath-1.3.jar"/>
1717
<classpathentry kind="lib" path="lib/apache/commons-lang-2.6.jar"/>
1818
<classpathentry kind="lib" path="lib/apache/commons-lang3-3.1.jar"/>
19-
<classpathentry kind="lib" path="lib/apache/commons-logging-1.1.1.jar"/>
19+
<classpathentry kind="lib" path="lib/apache/commons-logging-1.1.1.jar" sourcepath="libsrc/apache/commons-logging-1.1.1-sources.jar"/>
2020
<classpathentry kind="lib" path="lib/apache/commons-logging-adapters-1.1.1.jar"/>
2121
<classpathentry kind="lib" path="lib/apache/commons-logging-api-1.1.1.jar"/>
2222
<classpathentry kind="lib" path="lib/mq/commons-cli-1.1.jar"/>
@@ -47,5 +47,6 @@
4747
<classpathentry kind="lib" path="lib/spring/spring-web-3.2.2.RELEASE.jar"/>
4848
<classpathentry kind="lib" path="lib/spring/spring-webmvc-3.2.2.RELEASE.jar"/>
4949
<classpathentry kind="lib" path="lib/spring/spring-webmvc-portlet-3.2.2.RELEASE.jar"/>
50+
<classpathentry kind="lib" path="lib/apache/log4j/log4j-1.2.17.jar"/>
5051
<classpathentry kind="output" path="bin"/>
5152
</classpath>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding//src/common-logging.properties=UTF-8
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# commons-logging.properties 文件配置信息
2+
3+
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
4+
# Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
5+
6+
# 利用log4j为输出介质
7+
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
8+
9+
# JDK5 Logger
10+
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
log4j.rootLogger=info, stdout
2+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
3+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
4+
# Pattern to output the caller's file name and line number.
5+
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
478 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.xdc.basic.example.apache.commons.logging;
2+
3+
import org.apache.commons.logging.Log;
4+
import org.apache.commons.logging.LogFactory;
5+
6+
public class LogTest
7+
{
8+
private static Log log = LogFactory.getLog(LogTest.class);
9+
10+
public static void main(String[] args)
11+
{
12+
log.isFatalEnabled(); // true
13+
log.isErrorEnabled(); // true
14+
log.isWarnEnabled(); // true
15+
log.isInfoEnabled(); // true
16+
log.isDebugEnabled(); // false
17+
log.isTraceEnabled(); // false
18+
19+
log.fatal("fatal");
20+
log.error("error");
21+
log.warn("warn");
22+
log.info("info");
23+
log.debug("debug");
24+
log.trace("trace");
25+
}
26+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# commons-logging.properties 文件配置信息
2+
3+
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
4+
# Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
5+
6+
# 利用log4j为输出介质
7+
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
8+
9+
# JDK5 Logger
10+
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
log4j.rootLogger=info, stdout
2+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
3+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
4+
# Pattern to output the caller's file name and line number.
5+
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL