通过JVM参数配置log4j? [英] log4j configuration via JVM argument(s)?

查看:773
本文介绍了通过JVM参数配置log4j?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须设置/传递哪些变量作为JVM的参数才能使log4j正常运行?正确地说,我的意思是不要抱怨并打印到控制台。我能看到一个典型的例子吗?

What variables do I have to set/pass as arguments to the JVM to get log4j to run properly? And by properly I mean not complain and print to the console. Can I see a typical example?

注意:我需要避免在应用程序中创建log4j.properties文件。

Note: I need to avoid creating a log4j.properties file in the application.

推荐答案

您是否有log4j配置文件?只需使用

Do you have a log4j configuration file ? Just reference it using

-Dlog4j.configuration={path to file}

其中{path to file}应该以为前缀文件:

where {path to file} should be prefixed with file:

这篇关于通过JVM参数配置log4j?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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