java util logging.properties:如何记录到两个不同的文件 [英] java util logging.properties: How to log to two different files

查看:149
本文介绍了java util logging.properties:如何记录到两个不同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个logging.properties放在tomcat的WEB-INF / classes目录中

I am placing a logging.properties in the WEB-INF/classes dir of tomcat

我想记录到两个不同的文件。例如:org.pkg1转到一个文件,org.pkg2转到一个单独的文件。

I would like to log to two different files. For example: org.pkg1 goes to one file and org.pkg2 goes to a separate file.

我可以配置一个文件,但不能配置两个。那有可能吗?

I can get one file configured, but not two. Is that possible?

推荐答案

我终于想通了。在tomcat中,它们扩展了java util logging(JULI)以启用此功能。这是我放在WEB-INF目录中的logging.properties文件,它终于完成了我的目标......:

I finally figured this out. In tomcat they extend java util logging ("JULI") to enable this functionality. Here's a logging.properties file that I put in the WEB-INF directory that finally accomplished what I was after......:

handlers=1console.java.util.logging.ConsoleHandler, 2jsp.org.apache.juli.FileHandler, 3financials.org.apache.juli.FileHandler
.handlers=1a.java.util.logging.ConsoleHandler

jsp.level=ALL
jsp.handlers=2jsp.org.apache.juli.FileHandler
org.apache.jasper.level = FINE
org.apache.jasper.handlers=2jsp.org.apache.juli.FileHandler
org.apache.jsp.level = FINE
org.apache.jsp.handlers=2jsp.org.apache.juli.FileHandler

com.paypal.level=ALL
com.paypal.handlers=3financials.org.apache.juli.FileHandler

3financials.org.apache.juli.FileHandler.level=ALL
3financials.org.apache.juli.FileHandler.directory=${catalina.base}/logs
3financials.org.apache.juli.FileHandler.prefix=financials.

2jsp.org.apache.juli.FileHandler.level=ALL
2jsp.org.apache.juli.FileHandler.directory=${catalina.base}/logs
2jsp.org.apache.juli.FileHandler.prefix=jsp.

1console.java.util.logging.ConsoleHandler.level=FINE
1console.java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

这篇关于java util logging.properties:如何记录到两个不同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆