如何在WebSphere 7中设置log4j.configuration系统变量? [英] how to set log4j.configuration system variable in WebSphere 7?

查看:158
本文介绍了如何在WebSphere 7中设置log4j.configuration系统变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java EE 5 Web应用程序,它将作为EAR文件部署到WebSphere 7.

I have a Java EE 5 web app I'm deploying to WebSphere 7 as an EAR file.

我希望log4j配置位于EAR文件外部,因此我可以在需要时调整日志内容,而无需重建和重新部署EAR文件.

I want my log4j configuration to be external to the EAR file so I can tweak log content when needed without needing to rebuild and redeploy the EAR file.

我的理解是,我可以通过设置一个 系统变量"称为log4j.configuration. (例如log4j.configuration = c:/log4j.properties)

My understanding is I can specify the location of my log4j.properties file by setting a "system variable" called log4j.configuration. (ex. log4j.configuration=c:/log4j.properties)

我的问题是,如何在WebSphere 7管理控制台中设置此系统变量?

My question is, how do I set this system variable in the WebSphere 7 admin console?

浏览时,我看到有Environment > WebSphere Variables,但这看起来不对,因为这将为整个服务器设置一个变量.我想我只想为我的应用程序EAR文件设置系统变量.

Browsing around I see there is Environment > WebSphere Variables, but that doesn't look right because that would be setting a variable for the entire server. I'm guessing I want to set a system variable just for my application EAR file.

任何帮助或建议,我们将不胜感激!

Any help or suggestions is greatly appreciated!

Rob

推荐答案

log4j.configuration属性是Java虚拟机系统属性.您可以通过将其添加到应用程序服务器的通用JVM参数列表的末尾来加载此属性.这是通过在WebSphere控制台中导航以下内容来完成的:

The log4j.configuration property is a Java Virtual Machine system property. You can load this property by adding it to the end of your application server's list of generic JVM arguments. This is done in the WebSphere Console by navigating through the following:

Servers > Application servers > [app server name] > Process definition > Java Virtual Machine

在通用JVM参数下,添加以下内容:

Under Generic JVM arguments, add the following:

-Dlog4j.configuration=file:C:/log4j.properties

单击此页面底部的Apply,然后保存更改.这将需要重新启动应用程序服务器才能生效.

Click Apply at the bottom of this page, and save your changes. This will require a restart of the application server to take effect.

这篇关于如何在WebSphere 7中设置log4j.configuration系统变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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