- 浏览: 38413 次
- 性别:
- 来自: 北京
最新评论
-
墨子宇:
遇到一样的问题了,我们用的服务器测试环境端口就是6000,ad ...
FLASH-swfupload、2156、端口限制 -
sunman5277:
我在部署weblogic集群时也遇到和你相同的问题,1个服务器 ...
LOG4J对单服务器多SERVER的集群服务的日志输出支持 -
johnhzjx:
haikuang 写道这个问题要怎么解决修改负载的端口。。
FLASH-swfupload、2156、端口限制 -
haikuang:
这个问题要怎么解决
FLASH-swfupload、2156、端口限制 -
johnhzjx:
增加一个BUG的修改.
function meizzToday ...
关于梅花雨日历控件
增加LOG4J对单服务器多SERVER的集群服务的日志输出支持
问题:在单台物理服务器上部署的集群中含有多个Server Application时,发布的应用只有一个 WAR包,对应的LOG4J的配置也仅有一个,多个Server Application同时将输出的日志文件写入到一个文件中,会造成日志的丢失,因此设计该方法是为了多个Server Application分别输出各自的日志文件.
思路:
1.log4j的配置文件支持System Property的环境变量的获取,如user home
2.通过ServletContext可以获取到集群中每个server name
3.在不同的server启动时将不同server name的加载到System Property
4.在配置文件中增加一个${WebAppClusterServer}的参数,拼合server_name+logfile_name
5.配置文件的定义:
**************************************************
*logpath=e:/${WebSphereAppHost}_
*log4j.appender.logfile.File=${logpath}test.log
**************************************************
这是思路,需要源码的可以EMAIL我
源码是基于org.springframework.util.Log4jConfigurer进行改造
问题:在单台物理服务器上部署的集群中含有多个Server Application时,发布的应用只有一个 WAR包,对应的LOG4J的配置也仅有一个,多个Server Application同时将输出的日志文件写入到一个文件中,会造成日志的丢失,因此设计该方法是为了多个Server Application分别输出各自的日志文件.
思路:
1.log4j的配置文件支持System Property的环境变量的获取,如user home
2.通过ServletContext可以获取到集群中每个server name
3.在不同的server启动时将不同server name的加载到System Property
4.在配置文件中增加一个${WebAppClusterServer}的参数,拼合server_name+logfile_name
5.配置文件的定义:
**************************************************
*logpath=e:/${WebSphereAppHost}_
*log4j.appender.logfile.File=${logpath}test.log
**************************************************
这是思路,需要源码的可以EMAIL我
源码是基于org.springframework.util.Log4jConfigurer进行改造
public class Log4jWebClusterConfig { /** Parameter specifying whether to expose the web app cluster property */ public static final String EXPOSE_WEB_APP_ClUSTER_PARAM = "log4jExposeWebAppCluster"; public static final String EXPOSE_WEB_APP_ClUSTER_ATTRIBUTE_PARAM = "log4jExposeWebAppClusterAttribute"; public static void initWebClusterConfig(ServletContext servletContext) throws IllegalArgumentException { String webappcluster = servletContext.getInitParameter(EXPOSE_WEB_APP_ClUSTER_PARAM); String webappclusterattribute = servletContext.getInitParameter(EXPOSE_WEB_APP_ClUSTER_ATTRIBUTE_PARAM); if (webappcluster != null) { if (webappclusterattribute == null) { throw new IllegalArgumentException( "log4jExposeWebAppClusterAttribute is null ! " + " If set property 'log4jExposeWebAppCluster'," + "'log4jExposeWebAppClusterAttribute' must not be null "); } String webappclusterattr = (String) servletContext.getAttribute(webappclusterattribute); if (webappclusterattr == null || webappclusterattr.equals("")) { throw new IllegalArgumentException( "Cannot get log4jExposeWebAppClusterAttribute=[" + webappclusterattribute + "]" + " please reconfirm log4jExposeWebAppClusterAttribute's value!"); } //only getAttribute for WebSphere,other WebContain need to reconfigure!! if (webappcluster.equals("WebSphere")) { System.setProperty("WebAppClusterServer", webappclusterattr); } servletContext.log( "Initialize Log4J For Web_App_Cluster=[" + webappcluster + "] Server=[" + webappclusterattr + "]"); } } // getServletContext().log("----getAttributeNames----"); // Enumeration vecKey = getServletContext().getAttributeNames(); // while (vecKey.hasMoreElements()) { // String strKey = (String) vecKey.nextElement(); // getServletContext().log("Key=[" + strKey + "] Value=[" + getServletContext().getAttribute(strKey) + "]"); // } // // getServletContext().log("----System.getProperties----"); // vecKey = propertiesInst.propertyNames(); // while (vecKey.hasMoreElements()) { // String strKey = (String) vecKey.nextElement(); // getServletContext().log("Key=[" + strKey + "] Value=[" + propertiesInst.getProperty(strKey) + "]"); // } // // // getServletContext().log("----getInitParameterNames----"); // vecKey = getServletContext().getInitParameterNames(); // while (vecKey.hasMoreElements()) { // String strKey = (String) vecKey.nextElement(); // getServletContext().log("Key=[" + strKey + "] Value=[" + getServletContext().getInitParameter(strKey) + "]"); // } // // getServletContext().log("getServletContextName="+getServletContext().getServletContextName()); }
public abstract class Log4jWebConfigurer { /** Parameter specifying the location of the Log4J config file */ public static final String CONFIG_LOCATION_PARAM = "log4jConfigLocation"; /** Parameter specifying the refresh interval for checking the Log4J config file */ public static final String REFRESH_INTERVAL_PARAM = "log4jRefreshInterval"; /** Parameter specifying whether to expose the web app root system property */ public static final String EXPOSE_WEB_APP_ROOT_PARAM = "log4jExposeWebAppRoot"; /** * Initialize Log4J, including setting the web app root system property. * @param servletContext the current ServletContext * @see WebUtils#setWebAppRootSystemProperty */ public static void initLogging(ServletContext servletContext) { // Expose the web app root system property. if (exposeWebAppRoot(servletContext)) { WebUtils.setWebAppRootSystemProperty(servletContext); } //Expose the web app cluster property. Log4jWebClusterConfig.initWebClusterConfig(servletContext); // Only perform custom Log4J initialization in case of a config file. String location = servletContext.getInitParameter(CONFIG_LOCATION_PARAM); if (location != null) { // Perform actual Log4J initialization; else rely on Log4J's default initialization. try { // Return a URL (e.g. "classpath:" or "file:") as-is; // consider a plain file path as relative to the web application root directory. if (!ResourceUtils.isUrl(location)) { // Resolve system property placeholders before resolving real path. location = SystemPropertyUtils.resolvePlaceholders(location); location = WebUtils.getRealPath(servletContext, location); } // Write log message to server log. servletContext.log("Initializing Log4J from [" + location + "]"); // Check whether refresh interval was specified. String intervalString = servletContext.getInitParameter(REFRESH_INTERVAL_PARAM); if (intervalString != null) { // Initialize with refresh interval, i.e. with Log4J's watchdog thread, // checking the file in the background. try { long refreshInterval = Long.parseLong(intervalString); Log4jConfigurer.initLogging(location, refreshInterval); } catch (NumberFormatException ex) { throw new IllegalArgumentException("Invalid 'log4jRefreshInterval' parameter: " + ex.getMessage()); } } else { // Initialize without refresh check, i.e. without Log4J's watchdog thread. Log4jConfigurer.initLogging(location); } } catch (FileNotFoundException ex) { throw new IllegalArgumentException("Invalid 'log4jConfigLocation' parameter: " + ex.getMessage()); } } } /** * Shut down Log4J, properly releasing all file locks * and resetting the web app root system property. * @param servletContext the current ServletContext * @see WebUtils#removeWebAppRootSystemProperty */ public static void shutdownLogging(ServletContext servletContext) { servletContext.log("Shutting down Log4J"); try { Log4jConfigurer.shutdownLogging(); } finally { // Remove the web app root system property. if (exposeWebAppRoot(servletContext)) { WebUtils.removeWebAppRootSystemProperty(servletContext); } } } /** * Return whether to expose the web app root system property, * checking the corresponding ServletContext init parameter. * @see #EXPOSE_WEB_APP_ROOT_PARAM */ private static boolean exposeWebAppRoot(ServletContext servletContext) { String exposeWebAppRootParam = servletContext.getInitParameter(EXPOSE_WEB_APP_ROOT_PARAM); return (exposeWebAppRootParam == null || Boolean.valueOf(exposeWebAppRootParam).booleanValue()); } }
<context-param> <param-name>log4jExposeWebAppCluster</param-name> <param-value>WebSphere</param-value> </context-param> <context-param> <param-name>log4jExposeWebAppClusterAttribute</param-name> <param-value>com.ibm.websphere.servlet.application.host</param-value> </context-param> <servlet> <servlet-name>Log4jConfigServlet</servlet-name> <display-name>Log4jConfigServlet</display-name> <servlet-class>com.xxxxx.log4j.web.Log4jConfigServlet</servlet-class> <load-on-startup>4</load-on-startup> </servlet>
发表评论
-
TSM的解决
2013-12-02 19:29 617TSM解决-VM-外接设备.. -
T400+WIN7屏幕无法调节亮度的解决方法
2012-06-15 08:38 5298T400装了WIN7后,一直感觉不错~一次培训切换了成省电模式 ... -
基于OFFICE COM的程序池
2011-07-28 15:10 705采用该方式可以控制WORD的进程数,加快调用的速度。但是验证中 ... -
FLASH-swfupload、2156、端口限制
2010-11-09 20:41 3489近期在做一个swfupload的过程中,发现一个很异常的问题, ... -
解决WOW.ALI病毒的方法之一
2008-10-03 00:18 1033前几天无缘无故中了一个病毒WOW.ALI.具体的症状我就不细说 ... -
ibatis中提示MalformedInputException错误
2008-09-12 09:46 1113Spring集成IBATIS在启动时报以下错误: Caus ... -
使用jxls时报java.lang.NullPointerException
2008-08-14 16:41 2541模板对于处理以下方法是可能会报错.直接将list put到re ... -
js修改clone对象的参数
2007-09-11 13:54 2468<!DOCTYPE HTML PUBLIC &a ... -
sqlite与JAVA结合 FOR WINDOWS
2007-07-23 18:18 2592sqlite与JAVA结合 FOR WINDOWS.a.必需拥 ... -
spring的一个小问题(或则是一些)
2006-06-20 00:26 852今天在配置一个SPRING应用.发现页面一直不认${}表达式. ... -
CAS应用笔记
2006-07-02 14:40 909败了-_-..居然不能写代码...那改附件好了....换了存放 ... -
2007的LOGG4J学习笔记
2007-01-02 22:41 16602006年的时候也有记录了一些LOG4J的笔记,现在在去年的基 ... -
WebSphere 5.0.1 JDBC连接池配置(简)
2007-01-02 22:44 3036环境-管理 WebSphere 变量 选择应 ... -
关于梅花雨日历控件
2007-03-07 12:42 1313function meizzNextY(intYears)&a ...
相关推荐
故障日志记录和 SNMP 警报发送 访问系统事件日志 (System Event Log ,SEL) 和传感器状况 控制包括开机和关机 独立于系统电源或工作状态的支持 模拟KVM 通过远程连接服务器的BMC端口,来实现对服务器的操作和控制,就...
高性能在线记录日志系统(支持集群管理) 初始数据库:日志系统在设计初就考虑到了方便部署的方案。可分为三步。 第一步:配置好数据库连接信息(db.DB.config.xml),只须一个空的数据库即可。 第二步:运行日志服务...
远程服务器运行matlab代码GI数学建模 作者:林: 工程科学系奥克兰大学创建日期:2020年11月1日上次修改时间:2020年11月3日 该文件夹包含用于项目37:了解微观时空活动的所有脚本,代码和数据。 在继续任何工作之前...
有需要全部机器一同执行的业务场景:如使用广播执行模式清理集群日志。 有需要分布式处理的业务场景:比如需要更新一大批数据,单机执行耗时非常长,可以使用Map/MapReduce处理器完成任务的分发,调动整个集群加速...
JBoss 的目录结构说明 目录 描述 bin 启动和关闭 JBoss 的脚本( run.bat 为 windows 系统下的启动脚本,shutdown.bat 为 windows ...server/default/log JBoss 的日志文件。 server/default/tmp JBoss 的临时文件。
3、一次性启动多工人进程支持,可以通过程序api一次性启动和管理“ParkServer/工头/工人”多个进程,并附带良好的日志输出功能,用于代替写批处理脚本方式,方便部署和运行。 4、增加了相应指南和demo。 本软件...
值范围: 任何单字节字符, '+', '-', ', '>' 除外。 默认值: 从 NLS_TERRITORY 中获得 nls_sort: 说明: 指定 ORDER BY 查询的比较顺序。对于二进制排序, ORDER BY 查询的比较顺序是以数值为基础的。对于语言排序, 则...
<artifactId>log4j-slf4j-impl Redis二次封装的这个项目主要实现了自动延期的功能,可以在配置的时候设置某些缓存是否需要自动延期<默认为ture>,自动延期的将会在获取的时候重置 过期时间来达到自动延期功能。...
Log4J | 日志组件 | [http://logging.apache.org/log4j/1.2/](http://logging.apache.org/log4j/1.2/) Swagger2 | 接口测试框架 | [http://swagger.io/](http://swagger.io/) sequence | 分布式高效ID生产 | ...
Maven和Ant的更多支持 Jetty Maven插件(Plugin) Jetty Jspc Maven插件(Plugin) Maven web应用工程原型 Ant Jetty插件(Plugin) 使用集成开发环境(IDEs) 在Eclipse中使用Jetty 在IntelliJ中使用Jetty 在...
支持的Tomcat 服务器版本: 5.0, 5.5, 6.0. 当然还有一个地方需要设置, 请在 conf/tomcat-users.xml 中添加 manager 账户, probe 需要这个账户才能正确登录使用. 如果不知道怎么做, 你可以把文件内容改成这样即可...
│ 第80节:多线程consumer访问集群.avi │ 第81节:集群下的消息回流功能.avi │ 第82节:容错的链接和动态网络连接.avi │ 第83节:ActiveMQ的集群.avi │ 第84节:Destination高级特性一.avi │ 第85节:...