<< how can I use Acegi Security with WebLogic or websphere? | 首页 | JMeter FAQ >>

log4j在集群cluster环境下运行

log4j在集群cluster环境下运行,需要将log4j.properties文件脱离应用,将每个集群节点分别指定对应的log4j.properties。在启动服务器JVM的时候加入参数:

-Dlog4j.configuration=file:/home/bea/log4j1.properties
这样可以在一台物理服务器机器上配置多个集群服务器实例。

启动Weblogic脚本start.sh:

#!/bin/sh
nohup sh startWebLogic.sh > start.log &

export LOG4J_CONFIG_FILE=/home/bea/psmis_log/log4j_psmisServer1.properties
nohup sh startManagedWebLogic.sh psmisServer1 http://88.148.2.77:7001 > startServer1.log &

export LOG4J_CONFIG_FILE=/home/bea/psmis_log/log4j_psmisServer2.properties
nohup sh startManagedWebLogic.sh psmisServer2 http://88.148.2.77:7001 > startServer2.log &

 

在websphere的web 控制台可以直接设置-Dlog4j.configuration=file:/D:/home/bea/log4j1.properties

启动Websphere的脚本startwas.sh

#!/bin/sh
banner "start Was..."
/bin/sh /was/WebSphere/DeploymentManager/bin/startManager.sh
/bin/sh /was/WebSphere/AppServer/bin/startNode.sh
/bin/sh /was/WebSphere/AppServer/bin/startServer.sh sg615Aserver

/bin/sh /was/IBMHttpServer/bin/apachectl start
banner "ok"

附Weblogic的集群代理HttpClusterServlet配置web.xml:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
 <servlet>
  <servlet-name>HttpClusterServlet</servlet-name>
  <servlet-class> 
   weblogic.servlet.proxy.HttpClusterServlet
  </servlet-class>
  <init-param>
   <param-name>WebLogicCluster</param-name>
   <param-value>
    10.16.92.7:7082|10.16.92.7:7084|10.16.92.7:7086
   </param-value>
  </init-param>
  <init-param>
   <param-name>DebugConfigInfo</param-name>
   <param-value>OFF</param-value>
  </init-param>
  <init-param>
   <param-name>Debug</param-name>
   <param-value>OFF</param-value>
  </init-param>
  <init-param>
   <param-name>verbose</param-name>
   <param-value>true</param-value>
  </init-param>
 </servlet>

 <servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>/</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.jsp</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.htm</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
  <servlet-name>HttpClusterServlet</servlet-name>
  <url-pattern>*.html</url-pattern>
 </servlet-mapping>
</web-app>

附Weblogic的集群代理HttpClusterServlet配置weblogic.xml,为解决用GBK编码开发传递中文的问题:

<?xml version="1.0" encoding="UTF-8"?>

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
 <charset-params>
  <input-charset>
   <resource-path>/*</resource-path>
   <java-charset-name>GBK</java-charset-name>
  </input-charset>
  </charset-params>
  <context-root>/</context-root>
</weblogic-web-app>

 

 

标签 : ,



发表评论 发送引用通报