日志架构(七)日志中心WWW_JAVA组件API

1.概述
1.概述
    本组件的引用,不依赖任何第三方JAR包,无入侵性。
    在使用日志中心2.0的时候,首先要申请system.id(系统表示)与log.id(日志格式)。
    在使用了日志中心以后,提测及上线验证,都需要写上日志负责人,做上线后的验证。
    产品的功能性描述中,要体现出日志中心的功能。
2.配置文件logcenter.properties
#唯一系统标识,需要到日志中心申请
system.id=b9a33c708c27efe97c825e318ac77c24
#是否由过滤器发送日志
sendlog=true
#日志中心地址
logcenter.url=http://log.xxxx.com/

2.过滤器配置
1.pom
pom.xml中<dependencies>节点增加引用
	<!-- logcenter -->
	<dependency>
		<groupId>com.xxxx.lc.component</groupId>
		<artifactId>lc-component-core</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</dependency>


2.properties
配置文件logcenter.properties
内容如下
#唯一系统标识,需要到日志中心申请
system.id=b9a33c708c27efe97c825e318ac77c24
#是否由过滤器发送日志
sendlog=true
#日志中心地址,线上地址 http://appdev.xxxx.com/
logcenter.url=http://appdev.xxxx.com/log/

3. web.xml
web.xml中增加配置日志中心过滤器,根据不同的日志项目,可以配置不同的过滤器,weidget使用了LandingFilter过滤器,他的作用是:
自动发送日志(可配);
帮助业务系统组装通用日志参数,为前端日志行为做数据准备

Path参数,可以配置
1) classpath:xxx/xxx/logcenter.properties
2) /WEB-INF/conf/logcenter.properties
	<!-- 日志中心 -->
	<filter>
		<description>日志中心过滤器</description>
		<filter-name>LogFilter</filter-name>
		<filter-class>com.panguso.lc.component.core.filter.LandingFilter</filter-class>
		<init-param>
			<description>日志中心配置文件路径</description>
			<param-name>path</param-name>
			<param-value>/WEB-INF/conf/logcenter.properties</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<!-- 需要记录日志的URL应用 -->
		<filter-name>LogFilter</filter-name>
		<url-pattern>/landing/*</url-pattern>
	</filter-mapping>


3.隐藏域标签
放在第一行
<%@ taglib prefix="log" uri="http://www.panguso.com/jsp/jstl/logcenter"%>
放在body节点下
<log:logdata />

猜你喜欢

转载自phl.iteye.com/blog/2017844