1. log4j的配置
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.appender.dailyrolling=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyrolling.File=../logs/flextable.log
log4j.appender.dailyrolling.DatePattern='.'yyyyMMdd-HH
log4j.appender.dailyrolling.layout=org.apache.log4j.PatternLayout
log4j.appender.dailyrolling.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout,A1
#添加jms appender
log4j.appender.A1=org.apache.log4j.net.JMSAppender
#log4j.appender.A1.providerURL=127.0.0.1:7676
log4j.appender.A1.providerURL=iiop://192.168.1.15:3700/
log4j.appender.A1.userName=admin
log4j.appender.A1.password=admin
log4j.appender.A1.topicConnectionFactoryBindingName=jms/ConnectionFactory
log4j.appender.A1.topicBindingName=jms/SampleTopic
#log4j.appender.A1.initialContextFactoryName=com.sun.enterprise.naming.SerialInitContextFactory
log4j.appender.A1.initialContextFactoryName=com.sun.appserv.naming.S1ASCtxFactory
#log4j.logger.com.opensymphony.xwork.interceptor=debug
#log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug
### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=info
### log just the SQL
#log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=debug
### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug
### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug
### log transaction activity
#log4j.logger.org.hibernate.transaction=debug
### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
log4j.logger.com.test=info
2. glassfish的配置 (JNDI)
1).配置jms server (远程的 openMQ )
设置jms host 如图:
b. jms server配置
c。设置jms resource
3. 测试:
package com.test;
import org.apache.log4j.Logger;
/**
*
* @author zhangshuping
*/
public class Test {
protected static Logger log = Logger.getLogger(Test.class);
public static void main(String[] args) {
log.info("test ann !");
}
}
posted on 2009-05-14 14:45
冰是没有未来的,因为它的永恒 阅读(730)
评论(0) 编辑 收藏 所属分类:
java