- 浏览: 541015 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (278)
- freemarker (6)
- flex应用 (12)
- Ext应用 (11)
- 软件 (16)
- java (61)
- 报表 (6)
- 框架基础 (6)
- 登录页面素材 (7)
- oracle (1)
- cas (10)
- lucene (6)
- linux (11)
- 视频 (10)
- springmvc (3)
- 视频服务器相关 (12)
- 开发工具 (7)
- IOS (20)
- 网站相关 (4)
- Java 任务调度系统带图形界面的 (1)
- maven (2)
- android (29)
- hadoop (3)
- SpagoBI (3)
- docx4j (4)
- 多线程 (2)
- storm (2)
- mobile 框架 (3)
- scala (1)
- socket (1)
- saiku (1)
最新评论
-
ZXCLTN:
1.streams目录,在里面放些flv,mp3之类的文件,这 ...
red5 整合到tomcat中(二) -
ZXCLTN:
写的没偷没尾的,还不如提供整个项目下载
red5 整合到tomcat中(二) -
01jiangwei01:
测试方法1:测试50个线 ...
hibernate 乐观锁 测试 -
01jiangwei01:
测试方法1:测试50个线程,同时并发访问。目标:只有一个通过, ...
hibernate 乐观锁 测试 -
xiaobadi:
你每次登陆都是跳到http://localhost:8081/ ...
cas 系统实例 服务端配置(二) 自定义登录
# This is the configuring for logging displayed in the Application Server
#log4j.rootCategory=INFO, stdout,common-all,common-warn,common-error
log4j.rootLogger=INFO, stdout
############## appender options ###################
#org.apache.log4j.ConsoleAppender,
#org.apache.log4j.FileAppender,
#org.apache.log4j.DailyRollingFileAppender,
#org.apache.log4j.RollingFileAppender,
#org.apache.log4j.WriterAppender,
###################################
############## layout options ###################
# org.apache.log4j.HTMLLayout,
# org.apache.log4j.PatternLayout,
# org.apache.log4j.SimpleLayout,
# org.apache.log4j.TTCCLayout
###################################
############## ###################
# %m code infomation
# %p DEBUG,INFO,WARN,ERROR,FATAL
# %r cost milisecond from start to print
# %d{yyy MMM dd HH:mm:ss , SSS}
# %n enter
# %l line
###################################
################################
# common appenders
################################
#stdout configure
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold=INFO
log4j.appender.stdout.Encoding=GBK
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-all file appender
log4j.appender.common-all=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-all.file=/renshi/logs/common-all.log
log4j.appender.common-all.layout=org.apache.log4j.PatternLayout
log4j.appender.common-all.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-warn file appender
log4j.appender.common-warn=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-warn.file=/renshi/logs/common-warn.log
log4j.appender.common-warn.layout=org.apache.log4j.PatternLayout
log4j.appender.common-warn.threshold=WARN
log4j.appender.common-warn.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-error file appender
log4j.appender.common-error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-error.file=/renshi/logs/common-error.log
log4j.appender.common-error.layout=org.apache.log4j.PatternLayout
log4j.appender.common-error.threshold=ERROR
log4j.appender.common-error.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-dao file appender
log4j.appender.common-dao=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-dao.file=/renshi/logs/common-dao.log
log4j.appender.common-dao.layout=org.apache.log4j.PatternLayout
log4j.appender.common-dao.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-web file appender
log4j.appender.common-web=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-web.file=/renshi/logs/common-web.log
log4j.appender.common-web.layout=org.apache.log4j.PatternLayout
log4j.appender.common-web.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-pageNotFound file appender
log4j.appender.common-pageNotFound=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-pageNotFound.file=/renshi/logs/common-pageNotFound.log
log4j.appender.common-pageNotFound.layout=org.apache.log4j.PatternLayout
log4j.appender.common-pageNotFound.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
################################
# project appenders
################################
#project-dao file appender
log4j.appender.project-dao=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-dao.file=/renshi/logs/project-dao.log
log4j.appender.project-dao.layout=org.apache.log4j.PatternLayout
log4j.appender.project-dao.threshold=INFO
log4j.appender.project-dao.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#project-web file appender
log4j.appender.project-web=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-web.file=/renshi/logs/project-web.log
log4j.appender.project-web.layout=org.apache.log4j.PatternLayout
log4j.appender.project-web.threshold=INFO
log4j.appender.project-web.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#project-service file appender
log4j.appender.project-service=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-service.file=/renshi/logs/project-service.log
log4j.appender.project-service.layout=org.apache.log4j.PatternLayout
log4j.appender.project-service.threshold=INFO
log4j.appender.project-service.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
################################
# open source framework loggers
################################
#spring
log4j.logger.org.springframework=INFO
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=DEBUG,common-dao
# debug log for ibatis2.3
#log4j.logger.java.sql.Connection=DEBUG,common-dao
#log4j.logger.java.sql.Statement=INFO,common-dao
#log4j.logger.java.sql.PreparedStatement=INFO,common-dao
#log4j.logger.java.sql.ResultSet=INFO,common-dao
# debug log for ibatis3
log4j.logger.java.sql.Connection=DEBUG,common-dao
log4j.logger.java.sql.Statement=DEBUG,common-dao
log4j.logger.java.sql.PreparedStatement=DEBUG,common-dao
log4j.logger.java.sql.ResultSet=INFO,common-dao
# hibernate: Changing the log level to DEBUG will display SQL Hibernate generated
log4j.logger.org.hibernate=INFO,common-dao
log4j.logger.org.hibernate.SQL=ERROR
log4j.logger.org.hibernate.cache=ERROR
log4j.logger.net.sf.ehcache=ERROR
#springmvc pageNotFound
log4j.logger.org.springframework.web.servlet.PageNotFound=INFO,common-pageNotFound
#HibernateValidator
log4j.logger.org.apache.commons.validator.ValidatorResources=INFO
#log4jdbc, see: http://code.google.com/p/rapid-framework/wiki/log4jdbc for details
log4j.logger.jdbc.sqlonly=OFF
log4j.logger.jdbc.sqltiming=INFO,common-dao
log4j.logger.jdbc.audit=OFF
log4j.logger.jdbc.resultset=OFF
log4j.logger.jdbc.connection=OFF
################################
# project loggers
################################
log4j.logger.com.company.project.dao=INFO,project-dao
log4j.logger.com.company.project.service=INFO,project-service
log4j.logger.com.company.project.web=INFO,project-web
2.类中引用
public class Log4jTest{
private static Logger logger = Logger.getLogger("Log4jTest");//参数一般为类名
public static int chu(int num1,int num2){
try{
return num1/num2;
}catch(Exception ex){
logger.error("操作错误",ex);
//logger.error("操作错误");
return 0;
}
}
}
#log4j.rootCategory=INFO, stdout,common-all,common-warn,common-error
log4j.rootLogger=INFO, stdout
############## appender options ###################
#org.apache.log4j.ConsoleAppender,
#org.apache.log4j.FileAppender,
#org.apache.log4j.DailyRollingFileAppender,
#org.apache.log4j.RollingFileAppender,
#org.apache.log4j.WriterAppender,
###################################
############## layout options ###################
# org.apache.log4j.HTMLLayout,
# org.apache.log4j.PatternLayout,
# org.apache.log4j.SimpleLayout,
# org.apache.log4j.TTCCLayout
###################################
############## ###################
# %m code infomation
# %p DEBUG,INFO,WARN,ERROR,FATAL
# %r cost milisecond from start to print
# %d{yyy MMM dd HH:mm:ss , SSS}
# %n enter
# %l line
###################################
################################
# common appenders
################################
#stdout configure
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold=INFO
log4j.appender.stdout.Encoding=GBK
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-all file appender
log4j.appender.common-all=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-all.file=/renshi/logs/common-all.log
log4j.appender.common-all.layout=org.apache.log4j.PatternLayout
log4j.appender.common-all.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-warn file appender
log4j.appender.common-warn=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-warn.file=/renshi/logs/common-warn.log
log4j.appender.common-warn.layout=org.apache.log4j.PatternLayout
log4j.appender.common-warn.threshold=WARN
log4j.appender.common-warn.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-error file appender
log4j.appender.common-error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-error.file=/renshi/logs/common-error.log
log4j.appender.common-error.layout=org.apache.log4j.PatternLayout
log4j.appender.common-error.threshold=ERROR
log4j.appender.common-error.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-dao file appender
log4j.appender.common-dao=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-dao.file=/renshi/logs/common-dao.log
log4j.appender.common-dao.layout=org.apache.log4j.PatternLayout
log4j.appender.common-dao.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-web file appender
log4j.appender.common-web=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-web.file=/renshi/logs/common-web.log
log4j.appender.common-web.layout=org.apache.log4j.PatternLayout
log4j.appender.common-web.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#common-pageNotFound file appender
log4j.appender.common-pageNotFound=org.apache.log4j.DailyRollingFileAppender
log4j.appender.common-pageNotFound.file=/renshi/logs/common-pageNotFound.log
log4j.appender.common-pageNotFound.layout=org.apache.log4j.PatternLayout
log4j.appender.common-pageNotFound.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
################################
# project appenders
################################
#project-dao file appender
log4j.appender.project-dao=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-dao.file=/renshi/logs/project-dao.log
log4j.appender.project-dao.layout=org.apache.log4j.PatternLayout
log4j.appender.project-dao.threshold=INFO
log4j.appender.project-dao.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#project-web file appender
log4j.appender.project-web=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-web.file=/renshi/logs/project-web.log
log4j.appender.project-web.layout=org.apache.log4j.PatternLayout
log4j.appender.project-web.threshold=INFO
log4j.appender.project-web.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
#project-service file appender
log4j.appender.project-service=org.apache.log4j.DailyRollingFileAppender
log4j.appender.project-service.file=/renshi/logs/project-service.log
log4j.appender.project-service.layout=org.apache.log4j.PatternLayout
log4j.appender.project-service.threshold=INFO
log4j.appender.project-service.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
################################
# open source framework loggers
################################
#spring
log4j.logger.org.springframework=INFO
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=DEBUG,common-dao
# debug log for ibatis2.3
#log4j.logger.java.sql.Connection=DEBUG,common-dao
#log4j.logger.java.sql.Statement=INFO,common-dao
#log4j.logger.java.sql.PreparedStatement=INFO,common-dao
#log4j.logger.java.sql.ResultSet=INFO,common-dao
# debug log for ibatis3
log4j.logger.java.sql.Connection=DEBUG,common-dao
log4j.logger.java.sql.Statement=DEBUG,common-dao
log4j.logger.java.sql.PreparedStatement=DEBUG,common-dao
log4j.logger.java.sql.ResultSet=INFO,common-dao
# hibernate: Changing the log level to DEBUG will display SQL Hibernate generated
log4j.logger.org.hibernate=INFO,common-dao
log4j.logger.org.hibernate.SQL=ERROR
log4j.logger.org.hibernate.cache=ERROR
log4j.logger.net.sf.ehcache=ERROR
#springmvc pageNotFound
log4j.logger.org.springframework.web.servlet.PageNotFound=INFO,common-pageNotFound
#HibernateValidator
log4j.logger.org.apache.commons.validator.ValidatorResources=INFO
#log4jdbc, see: http://code.google.com/p/rapid-framework/wiki/log4jdbc for details
log4j.logger.jdbc.sqlonly=OFF
log4j.logger.jdbc.sqltiming=INFO,common-dao
log4j.logger.jdbc.audit=OFF
log4j.logger.jdbc.resultset=OFF
log4j.logger.jdbc.connection=OFF
################################
# project loggers
################################
log4j.logger.com.company.project.dao=INFO,project-dao
log4j.logger.com.company.project.service=INFO,project-service
log4j.logger.com.company.project.web=INFO,project-web
引用
2.类中引用
public class Log4jTest{
private static Logger logger = Logger.getLogger("Log4jTest");//参数一般为类名
public static int chu(int num1,int num2){
try{
return num1/num2;
}catch(Exception ex){
logger.error("操作错误",ex);
//logger.error("操作错误");
return 0;
}
}
}
发表评论
-
AESUtils
2018-01-17 14:13 505import java.io.UnsupportedEnc ... -
lbs比较两点坐标
2018-01-16 09:56 0int distance = (int) (S2LatLng. ... -
java ftp上传文件
2017-12-25 10:43 598工具类: import org.apache.c ... -
redis应用方法
2017-11-30 11:47 5531:统计一段时间内,某 ... -
风控系统1
2017-10-12 18:40 641... -
可以保持session的java代码片段
2017-07-12 21:04 652import java.io.File; impor ... -
ubuntu 搭建开发环境
2015-06-16 15:39 0jdk 可以参看其他网站; export JAVA_HO ... -
主线程等待10秒钟,无应答返回(一)
2015-06-05 15:26 2506场景需求: 其他应用向我们的应用A发来请求,如果应用 ... -
drools书籍
2015-03-13 18:23 962附件中有drools书籍 -
一个Tomcat支持不同的域名访问各自不同程序的配置方法
2015-03-11 09:56 554更多信息可以参考网址:http://329937021.i ... -
netty5 包简读
2015-02-13 18:16 0io.netty.bootstrap; 启动器i ... -
netty5 入门翻译
2015-02-12 18:01 859翻译网页网址:http://n ... -
spring-jms
2015-01-12 11:45 712这里写篇文章记录一下jms持久化到mysqlde 使用方 ... -
git 命令大全
2014-11-12 10:03 710git 学习网址http://git-scm.com/bo ... -
groovy eclipse 插件
2014-10-06 16:58 734eclipse version 4.4.0 groovy ... -
docx4j word 工具类及测试类
2014-10-02 22:14 1544import java.io.ByteArrayInputS ... -
docx4j 替换文本
2014-09-29 11:25 1468采用docx4j 替换word模板内容,并输出进行保存 ... -
docx4j 动态生成表格 (一 )
2014-09-28 19:18 1813使用docx4j模板动态制作表格代码实现过程(一 ),模 ... -
java 开发的各种例子
2014-08-13 17:55 641springmvc + springsecurity 实 ... -
tomcat 根项目部署方式
2014-07-08 09:50 577<Host name="admin.yid ...
相关推荐
### Log4j配置与加载方法详解 Log4j是一款由Apache出品的日志记录工具,它提供了灵活的日志级别控制和多样化的日志输出方式,广泛应用于Java应用的开发中。本文将深入解析log4j的配置与加载机制,帮助开发者更好地...
log4j 配置及使用 Log4j 是什么? Log4j 是一个 Java 语言的日志记录工具,可以帮助开发人员调试和分析程序,了解程序的运行情况。Log4j 官方网站为 http://jakarta.apache.org/log4j。 Log4j 的概念 Log4j 中有...
Log4j2 结合 Slf4j 配置使用 Log4j2 是一个功能强大且广泛使用的日志记录工具,它提供了灵活的日志记录机制和高性能的日志记录能力。Slf4j 则是一个简单的日志记录门面,提供了统一的日志记录接口。今天,我们将...
2. **配置全局 Log4j 属性文件**:在任意位置创建 `log4j.properties` 文件,并设置全局的日志级别、输出格式及存储路径等。通常会将该文件放置在 Tomcat 的 `conf` 目录下。 ```properties log4j.rootLogger=...
### log4j配置与使用方法 #### 一、log4j简介 log4j是Apache的一个开源项目,通过使用log4j,开发者能够控制日志信息的生成、等级以及输出的目的地。它允许用户根据不同的环境调整日志的级别,从而帮助开发者在...
log4j 详细配置 log4j 详细配置 log4j 详细配置 log4j 详细配置
Log4j 是一个功能强大且广泛使用的日志记录工具,特别是在 SSM(Spring、Spring MVC、Mybatis)整合项目中,合理地配置 Log4j 对项目的日志记录和输出至关重要。本文将详细介绍 SSM 整合中的 Log4j 配置详情,帮助...
log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档log4j配置文档
3. **配置SpringBoot**:在`application.properties`中指定Log4j配置文件位置。 ```properties logging.config=classpath:log4j.properties ``` ### SpringBoot与Log4j2 Log4j2作为Log4j的升级版,提供更好的性能...
### log4j实用配置扩展 #### 一、log4j简介与重要性 Log4j是一种广泛使用的开源日志框架,由Apache软件基金会维护。...对于任何涉及大量数据处理或复杂逻辑的应用程序而言,正确配置并使用log4j都是非常重要的。
Log4j配置说明.rarLog4j配置说明.rarLog4j配置说明.rarLog4j配置说明.rar,Log4j配置,Log4j Log4j配置说明.rarLog4j配置说明.rarLog4j配置说明.rarLog4j配置说明.rar,Log4j配置,Log4j
压缩包中的"**log4j配置说明及所需jar包**"包含了Log4j的库文件,包括`log4j.jar`和其他可能的依赖。确保将这些JAR包添加到项目的类路径(Classpath)中,这样你的程序才能正确识别并使用Log4j。 **四、代码示例** ...
### log4j配置详解 #### 一、log4j简介 Log4j 是一个开源的日志记录工具,它允许开发者自定义日志级别并能够输出丰富的日志信息。本篇文章将详细解读 log4j 的基本配置及使用方法,非常适合初学者理解和掌握。 ##...
这篇文档将详细介绍Log4J的配置与使用方法。 首先,Log4J的配置文件是整个日志系统的核心,它定义了日志输出的级别、目标以及格式。配置文件可以采用键值对(key=value)或者XML格式。例如,`log4j.rootLogger`定义...
下面我们将从配置文件类型、核心JAR包、文件渲染和Log调用四个方面来比较Log4j和Log4j2的区别。 配置文件类型 Log4j通过一个.properties文件作为主配置文件,而Log4j2则弃用了这种方式,采用的是.xml、.json或者....
接下来,`log4j配置说明.txt`文件通常会提供更详细的解释和示例,包括如何配置不同的appender(如FileAppender、RollingFileAppender等),如何定义不同logger的级别,以及如何使用自定义的error handler和filter。...
下面我们将学习 Log4j2 配置模板的使用和配置。 引入 Log4j2 依赖 在使用 Log4j2 之前,需要在 Maven 项目中引入 Log4j2 的依赖。我们可以在 pom.xml 文件中添加以下依赖项: ```xml <groupId>org.spring...
### Log4J 全能配置文件详解 #### 一、概述 Log4J是一款非常流行的Java日志框架,被广泛应用于各种规模的应用程序中。它提供了灵活的日志记录机制,可以将日志输出到不同的目的地,如控制台、文件、数据库等,并且...