特定应用程序使用JULI登录tomcat 7? [英] Application specific log in tomcat 7 using JULI?

查看:126
本文介绍了特定应用程序使用JULI登录tomcat 7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tomcat 7中使用java系统日志记录,但没有日志记录语句写入日志。我已将此文件添加到WEB-INF / classes中。创建了日志文件new-xyz-test(所以我至少有一些配置权限),但它是空的 - 没有日志语句打印到它。

I'm using java system logging in tomcat 7, but no logging statements get written to the log. I've added this file to my WEB-INF/classes. The log file "new-xyz-test" gets created (so I have at least some of the config right) but its empty - no log statements get printed to it.

handlers=java.util.logging.ConsoleHandler, org.apache.juli.FileHandler

org.apache.juli.FileHandler.level=ALL
org.apache.juli.FileHandler.directory=${catalina.base}/logs
org.apache.juli.FileHandler.prefix=new-xyz-test-

java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

com.xyz.level=ALL
com.xyz.handlers=org.apache.juli.FileHandler


推荐答案

到在您需要的Web应用程序中配置JULI,在 WEB-INF / classes 目录中有一个 logging.properties 文件。如果使用默认处理程序,则可能会丢失邮件。您需要在文件中为处理程序指定前缀。

To configure JULI in the web applications you need have a logging.properties file in the WEB-INF/classes directory. If you use the default handlers, you may lose messages. You need to specify a prefix for the handler in your file.

handlers=1FILE.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers=java.util.logging.ConsoleHandler

1FILE.org.apache.juli.FileHandler.level=FINEST
1FILE.org.apache.juli.FileHandler.directory=/app-logs
1FILE.org.apache.juli.FileHandler.prefix=file-1

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

com.xyz.level=INFO
com.xyz.handlers=1FILE.org.apache.juli.FileHandler

com.abc.level=INFO
com.abc.handlers=java.util.logging.ConsoleHandler

A
处理程序前缀(例如 1FILE。)以数字开头,然后有一个任意字符串,以句点(。)结尾。

A handler prefix (e.g. 1FILE.) starts with a number, then has an arbitrary string, and ends with a period (.).

如果您没有从 startup.sh startup.bat 运行Tomcat,则需要指定:

If you are not running the Tomcat from the startup.sh or startup.bat, you need to specify:


  1. Tomcat的常规 logging.properties 的位置(在 conf Tomcat目录)

  2. 经理 org.apache.juli.ClassLoaderLogManager 。这很重要,因为允许您为每个Web应用程序配置
    不同的loggin选项。默认情况下,JVM进程只能有一个配置文件。),

  1. The location of the general logging.properties for Tomcat (in the conf directory of Tomcat)
  2. The manager org.apache.juli.ClassLoaderLogManager. This is important because allows you to configure for each web application different loggin options. By default, a JVM process can only have a single configuration file.) ,

类似于下一个(我正在使用eclipse) :

Similar to the next (I'm using eclipse):

-Djava.util.logging.config.file="C:\Users\Paul\workspaces\utils\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

默认情况下, java.util.logging 阅读包含在JDK或JRE中的文件,例如:

By default, java.util.logging read the file that is included in the JDK or JRE, e.g.:

"C:\Software\jdk1.7.0_17\jre\lib\logging.properties"




  • 在Eclipse中设置Tomcat堆大小(JVM堆) ,关于如何在VM中添加参数

  • 这篇关于特定应用程序使用JULI登录tomcat 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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