maven配置开发

1.项目中使用Log4j对其日志进行配置管理,采取的方式一种是通过properties文件设置,另一种方式就是通过设置xml文件的配置。

  使用场景:

    编程模型:log.err();log.debug();and so on

    物理存储:一个项目每天定时产生一个日志文件

           一个项目每天定时产生多个日志文件,日志文件针对特殊的业务类(可以明确监控到一个具体的类上面,有些场景可能对特殊的类需要单独建立日志文件)

2.maven的使用场景:

  使用场景:

    1.项目里面的jar的管理,全部基于pom文件进行管理,不用手工拷贝jar文件,仅仅拷贝pom文件即可。

    2.搭建公司自己的maven的jar仓库,定期更新即可。

    3.利用maven的profile特性,配置参数,其他的配置文件比如spring配置文件,可以使用${}的方式引用profile文件里面的属性,配置多个profile参数环境,比如

     production、bete、development等,打包时候选择具体的profile环境即可。

    4.项目的多模块拆分,方便管理。

3.Git的使用场景:

    使用场景:

      1.项目多人协作,类似SVN的功能 

      2.与SVN不同的是,本地有一套本地仓库,可以commit,compare,show history等(与开发人员比较有好处)

      3.分支管理与合并合理(此处对于项目经理可以仔细研究) 

      4.服务端的图形界面,可以明确的看出软件工程师的代码贡献率

======================================================

<Configuration status="INFO">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
</Console>
<RollingFile name="LOG-MAIN" fileName="${logpath}/main.log"
filePattern="${logpath}/main-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-DNHANDLER" fileName="${logpath}/dnHandler.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-CIDR4DNSLOADER" fileName="${logpath}/cidr4DNSLoader.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-DNSERVICEIMPL" fileName="${logpath}/dnServiceImpl.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
</Appenders>

<Loggers>
<Root level="${loglevel}">
<AppenderRef ref="STDOUT"/>
<AppenderRef ref="LOG-MAIN"/>
</Root>
<logger name="com.bat.app.pat.httpdns.handler.DnHandler" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-DNHANDLER"/>
</logger>
<logger name="com.bat.app.pat.httpdns.data.Cidr4DNSLoader" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-CIDR4DNSLOADER"/>
</logger>
<logger name="com.bat.app.pat.httpdns.service.imp.DnServiceImpl" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-DNSERVICEIMPL"/>
</logger>
</Loggers>
</Configuration>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bat.app.server</groupId>
<artifactId>xvde</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>xvde Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<org.springframework.version>3.2.8.RELEASE</org.springframework.version>
</properties>
<dependencies>

<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.bat.ump</groupId>
<artifactId>profiler</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.bat</groupId>
<artifactId>erp-sso</artifactId>
<version>1.0.5</version>
<exclusions>
<exclusion>
<artifactId>bat-common-struts</artifactId>
<groupId>com.bat.common</groupId>
</exclusion>
<exclusion>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</exclusion>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<artifactId>spring-batbc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-tx</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-web</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-core</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-test</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-webmvc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>commons-httpclient</artifactId>
<groupId>commons-httpclient</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>com.bat.ump</groupId>
<artifactId>jannotation</artifactId>
<version>2.1.0</version>
</dependency>

</dependencies>
<build>
<finalName>xvde</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<archiveClasses>false</archiveClasses>
</configuration>
</plugin>
</plugins>
</build>

<profiles>

<profile>
<id>development</id>
<properties>
<xvde.hrm.cookieKey>18B6697222B1A0925D40FAA00B353F2DF4359D2099</xvde.hrm.cookieKey>
<xvde.hrm.cookieName>erp1.bat.com</xvde.hrm.cookieName>
<jimUrl>xx://1803528818953446384/1</jimUrl>
<log.path>d:/Logs/xvde.m.bat.com</log.path>
<log.level>INFO</log.level>
<xvde.isDev>true</xvde.isDev>
<xvde.batbc.driver>com.mysql.batbc.Driver</xvde.batbc.driver>
<xvde.batbc.url>batbc:mysql://122.168.124.65:3306/xvde?autoReconnect=true</xvde.batbc.url>
<xvde.batbc.username>root</xvde.batbc.username>
<xvde.batbc.password>root@dev</xvde.batbc.password>
<webapp.domain.name>tempxvde.m.bat.com</webapp.domain.name>
<webapp.hrm.login.auth.key>8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099</webapp.hrm.login.auth.key>
</properties>
</profile>

<profile>
<id>test</id>
<properties>
<xvde.hrm.cookieKey>8B6697227CBCA902B1A0A00B353F2DF4359D2099</xvde.hrm.cookieKey>
<xvde.hrm.cookieName>erp1.bat.com</xvde.hrm.cookieName>
<jimUrl>xxx://1803528818953446384/1</jimUrl>
<log.path>/export/Logs/xvde.m.bat.com</log.path>
<log.level>INFO</log.level>
<xvde.isDev>true</xvde.isDev>
<xvde.batbc.driver>com.mysql.batbc.Driver</xvde.batbc.driver>
<xvde.batbc.url>batbc:mysql://192.168.11144.65:3306/xvde?autoReconnect=true</xvde.batbc.url>
<xvde.batbc.username>xvde</xvde.batbc.username>
<xvde.batbc.password>123456</xvde.batbc.password>
<webapp.domain.name>tempxvde.m.bat.com</webapp.domain.name>
<webapp.hrm.login.auth.key>8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099</webapp.hrm.login.auth.key>
</properties>
</profile>

<profile>
<id>beta</id>
<properties>
<xvde.hrm.cookieKey>C602924B0D1090D931E3771FE1810</xvde.hrm.cookieKey>
<xvde.hrm.cookieName>erp1.bat.com</xvde.hrm.cookieName>
<jimUrl>xx://2876103252179/379</jimUrl>
<log.path>/export/Logs/xvde.m.bat.com</log.path>
<log.level>ERROR</log.level>
<xvde.isDev>false</xvde.isDev>
<xvde.batbc.driver>com.mysql.batbc.Driver</xvde.batbc.driver>
<xvde.batbc.url>batbc:mysql://1amombabym.mysql.batdb.com:3358/xvde?autoReconnect=true</xvde.batbc.url>
<xvde.batbc.username>xvde_rw</xvde.batbc.username>
<xvde.batbc.password>LtwuR_p64j2ibcfOsN8zETWomKC3Yyq</xvde.batbc.password>
<webapp.domain.name>xvde.m.bat.com</webapp.domain.name
</properties>
</profile>

<profile>
<id>production</id>
<properties>
<xvde.hrm.cookieKey>C602924B0D1090D931E3771D74ABBF9733A8C3545CFE1810</xvde.hrm.cookieKey>
<xvde.hrm.cookieName>erp1.bat.com</xvde.hrm.cookieName>
<jimUrl>xxx://2876103256754832179/379</jimUrl>
<log.path>/export/Logs/xvde.m.bat.com</log.path>
<log.level>ERROR</log.level>
<xvde.isDev>false</xvde.isDev>
<xvde.batbc.driver>com.mysql.batbc.Driver</xvde.batbc.driver>
<xvde.batbc.url>batbc:mysql://amombabym.mysql.batdb.com:3358/xvde?autoReconnect=true</xvde.batbc.url>
<xvde.batbc.username>xvde_rw</xvde.batbc.username>
<webapp.domain.name>xvde.m.bat.com</webapp.domain.name>

</properties>
</profile>
</profiles>
</project>

================================================================

log4j

<Configuration status="INFO">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
</Console>
<RollingFile name="LOG-MAIN" fileName="${logpath}/main.log"
filePattern="${logpath}/main-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-DNHANDLER" fileName="${logpath}/dnHandler.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-CIDLOADER" fileName="${logpath}/cidSLoader.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
<RollingFile name="LOG-DNSERVICEIMPL" fileName="${logpath}/dnServiceImpl.log"
filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
<PatternLayout
pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<ThresholdFilter level="INFO"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="${loglevel}">
<AppenderRef ref="STDOUT"/>
<AppenderRef ref="LOG-MAIN"/>
</Root>
<logger name="com.bat.app.pat.httpdns.handler.DnHandler" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-DNHANDLER"/>
</logger>
<logger name="com.bat.app.pat.httpdns.data.CidSLoader" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-CIDR4DNSLOADER"/>
</logger>
<logger name="com.bat.app.pat.httpdns.service.imp.DnServiceImpl" level="${loglevel}" additivity="false">
<AppenderRef ref="LOG-DNSERVICEIMPL"/>
</logger>
</Loggers>
</Configuration>

上一篇:修改HTMLTestRunner模板


下一篇:【BZOJ2160】拉拉队排练(回文树)