锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
]]>
浣跨敤FrontPage鍙互寰堟柟渚跨殑棰勮vm鏂囦歡錛岃姊佸宄扮殑銆?font color="#ff0000">Velocity涔媁eb瀹炶返銆嬩竴鏂囷細http://www.javayou.com/showlog.jspe?log_id=528錛屽叾涓繖鏍瘋閬擄細“
鎵撳紑FrontPage錛堟垨鍏朵粬綾諱技宸ュ叿錛夌綉欏電紪杈戝櫒錛岀偣鍑?quot;宸ュ叿錛嶉夐」錛嶉厤緗紪杈戝櫒"錛屼笂闈㈠垪鍑轟簡FrontPage鑳芥墦寮鐨勬枃浠訛紝鐐瑰嚮娣誨姞錛屽~鍏ユ枃浠剁被鍨嬶細vm錛岀紪杈戝櫒鍚嶇О錛欶rontPage錛屽懡浠わ細C:\Program Files\Microsoft Office\Office\frontpg.exe錛團rontPage榪愯鐨勫畬鏁磋礬寰勶紝鍙粠宸叉湁鐨勬枃浠剁被鍨嬩腑Copy鍑哄畬鏁磋礬寰勶級錛岀偣鍑繪墦寮鐣岄潰鐨勭‘瀹氬悗錛屾垜浠粠FrontPage鐨勬枃浠惰彍鍗曚腑閫夋嫨鎵撳紑鏂囦歡錛岄夋嫨涓婇潰鏂板緩鐨剆ample.vm錛屾庝箞鏍鳳紝緙栬緫銆侀瑙堝拰淇敼閮戒竴鐩簡鐒跺惂錛堝涓嬪浘錛夛紝鍗充嬌涓嶆竻妤歏TL鐨勶紝涔熷彲浠ラ氳繃綆鍗曠殑鎵嬪唽鏌ヨ鐭ラ亾錛堜竴鑸兘涓嶄細鐢ㄥ埌鍚э級錛岃繖鏍峰浜庣綉欏佃璁″笀銆佸紑鍙戜漢鍛樺拰緇存姢浜哄憳鏉ヨ錛岄兘鏄緢瀹規槗鐨勪簨銆傝屽鏋滀綘浣跨敤浜嗕竴浜涘紑鍙戝伐鍏鳳紝濡侸builder鍒欏湪tools錛峱roference鐨勭紪杈戠被鍨嬮噷錛屽湪Html妗e鍔?vm鐨勬敮鎸侊紝鍒欏氨鍙互榪涜緙栬緫鍜岀敤html棰勮鍣ㄩ瑙堜簡錛屽叾浠栫殑寮鍙戝伐鍏瘋嚜宸辨懜绱㈠惂銆?font color="#000000"> ”
鐒惰屽湪DreamWeaver涓垜鎬庝箞鏍鋒敼閰嶇疆涔熶笉琛屻備簬鏄敤google澶х涓婄綉姹傚姪錛岀粓浜庡彂鐜頒簡榪欎釜濂戒笢瑗匡細DreamWeaver鐨刅elocity鎻掍歡錛?a >http://velocity.gilluminate.com/錛屼綔鑰呮瘮鎴戝己澶氫簡錛岃嚜宸卞姩鎵嬶紝涓拌。瓚抽鍟婏紝鍛靛懙銆備笅杞藉悗鐢ㄧ敤DreamWeaver鐨勬彃浠剁鐞嗗櫒瀹夎錛屽錛屽氨鏄偅涓猇elocitySuite.mxp鏂囦歡銆?/font>
榪欐牱涓鏉ワ紝DreamWeaver鍦ㄧ紪杈憊m鏃惰兘鎻愪緵鐨勫姛鑳藉氨澶уぇ瓚呰繃鍏朵粬html緙栬緫鍣ㄤ簡銆傜埥鍟娿?/p>
涓嶈繃浣滆呰繕璇翠簡鍑犱釜娉ㄦ剰鐐癸紝濡傛灉浣犲湪浣跨敤榪囩▼涓寰楁湁闂錛屽彲浠ュ幓浠栫殑涓婚〉http://velocity.gilluminate.com/鐪嬬湅銆傝繖閲屽氨涓嶅啀澶氳█浜嗐?br />
鍘熸枃浣滆咃細澶╂墠 Kylin欏圭洰灝忕粍
log4j綆浠?br />綆鍗曠殑璇磍og4j灝辨槸甯姪寮鍙戜漢鍛樿繘琛屾棩蹇楄緭鍑虹鐞嗙殑API綾誨簱銆傚畠鏈閲嶈鐨勭壒鐐瑰氨import org.apache.log4j.*;
public class LogTest {
static Logger logger = Logger.getLogger(LogTest.class.getName());
public static void main(String[] args) {
PropertyConfigurator.configure ( “.\\src\log4j.properties”)錛?br />logger.debug("Debug ...");
logger.info("Info ...");
logger.warn("Warn ...");
logger.error("Error ...");
}
}
紼嬪簭璇存槑錛?br />鈶?static Logger logger = Logger.getLogger(LogTest.class.getName());灝辨槸鍒涘緩涓涓睘浜嶭ogTest綾葷殑Logger瀵硅薄錛屽垱寤烘椂瑕佸憡鐭ogger浣犲綋鍓嶇殑Class鏄粈涔堛?br />鈶?font size="2"> PropertyConfigurator.configure ( “log4j.properties”)灝辨槸璇翠嬌鐢ㄥ綋鍓嶅伐紼嬬洰褰曚笅鐨剆rc鏂囦歡澶逛腑鐨刲og4j.properties鏂囦歡浣滀負閰嶇疆鏂囦歡銆傝嫢灝唋og4j.properties鏀懼湪宸ョ▼鏍圭洰褰曚笅涔熷彲涓嶅啓姝ゅ彞錛岀▼搴忎細鑷姩鎵懼埌閰嶇疆鏂囦歡銆?br />鈶?logger.debug灝辨槸杈撳嚭debug鐨勪俊鎭紝logger.info灝辨槸杈撳嚭鎻愮ず淇℃伅錛宭ogger.warn灝辨槸鏄劇ず璀﹀憡淇℃伅錛宭ogger.error灝辨槸鏄劇ず閿欒淇℃伅銆?br />涓嬮潰鏄厤緗枃浠秎og4j.properties鐨勫唴瀹癸細
log4j.rootCategory=DEBUG, stdout錛孯
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log.txt
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy MMM dd HH:mm:ss} %-5p %c - %m%n
紼嬪簭璇存槑錛?br />鈶?log4j.rootCategory=DEBUG, stdout錛孯
灝辨槸璇存垜瑕佹樉紺烘墍鏈変紭鍏堟潈絳夋柤鍜岄珮浜嶥ebug鐨勪俊鎭?br />"stdout"錛?rdquo;R”琛ㄧず鎴戝畾涔変簡涓や釜杈撳嚭绔?闅忎究浠涔堝悕瀛楅兘濂?銆?br />鈶′笅闈㈢殑涓夎璇磗tdout杈撳嚭绔叾瀹炴槸鏍囧噯杈撳嚭Console錛屼篃灝辨槸灞忓箷銆傝緭鍑虹殑鏍煎紡鏄疨atternLayout銆傝漿鎹㈡柟寮忔槸%5p (%F:%L) - %m%n錛屽嵆鍓嶄簲鏍肩敤鏉ユ樉紺轟紭鍏堟潈錛屽啀鏄劇ず褰撳墠鐨勬枃浠跺悕錛屽姞褰撳墠鐨勮鏁般傛渶鍚庢槸logger.debug()鎴杔ogger.info()鎴杔ogger.warn()鎴杔ogger.error()閲岀殑淇℃伅銆?n琛ㄧず鍥炶濺絀鴻銆?br />鈶㈠啀鍔犱笂涓嬮潰鍏鍒檒og淇℃伅涓嶅厜鏄劇ず鍦ㄥ睆騫曚笂錛岃屼笖灝嗚淇濆瓨鍦ㄤ竴涓彨"log.txt"鐨勬枃浠墮噷錛屾枃浠舵渶澶т負100KB銆傚鏋滄枃浠跺ぇ灝忚秴榪?00KB錛屾枃浠朵細琚浠芥垚"log.txt.1"錛屾柊鐨?quot;log.txt"緇х畫璁板綍log淇℃伅銆?br />鎺ヤ笅鏉ユ垜浠彲浠ユ敼鍙榣og4j.properties錛岃屼笉闇閲嶆柊緙栬瘧灝卞彲浠ユ帶鍒秎og淇℃伅鏄惁鏄劇ず銆乴og淇℃伅鐨勮緭鍑虹綾誨瀷銆佽緭鍑烘柟寮忋佽緭鍑烘牸寮忥紝絳夌瓑銆備婦渚嬪涓嬶細
鈶犲湪log4j.properties鏂囦歡閲屾妸"log4j.rootCategory=DEBUG,stdout,R"鏀瑰啓鎴?quot;log4j.rootCategory=OFF, stdout,R"錛岃繖鏍鋒墍鏈夌殑log淇℃伅閮戒笉浼氭樉紺轟簡錛涜В鍐充簡鏈枃寮濮嬫彁鍑虹殑闂銆?br />鈶″湪log4j.properties鏂囦歡閲屾妸"log4j.rootCategory=DEBUG,stdout,R"鏀瑰啓鎴?quot;log4j.rootCategory=INFO, stdout,R"錛岃繖鏍峰彧鏄劇ずINFO, WARN, ERROR鐨刲og淇℃伅錛岃孌EBUG淇℃伅涓嶄細琚樉紺猴紱
鍦╳eb紼嬪簭涓嬌鐢╨og4j娉ㄦ剰闂
1銆?nbsp; 鐢變簬jsp鎴杝ervlet鍦ㄦ墽琛岀姸鎬佹椂娌℃湁褰撳墠璺緞姒傚康錛屾墍鏈変嬌鐢≒ropertyConfigurator.configure錛圫tring錛夎鍙ユ壘log4j.properties鏂囦歡鏃惰緇欏嚭鐩稿浜庡綋鍓峧sp鎴杝ervlet鐨勮礬寰勮漿鍖栨垚涓轟竴涓粷瀵圭殑鏂囦歡緋葷粺璺緞銆傛柟娉曟槸浣跨敤servletcontext.getrealpath(string)璇彞銆備緥錛?br />//寰楀埌褰撳墠jsp璺緞
String prefix = getServletContext().getRealPath("/");
//璇誨彇log4j.properties
PropertyConfigurator.configure(prefix+"\\WEB-INF\\log4j.properties");
2銆佺浉搴旂殑log4j.properties璁劇疆鏌愪釜灞炴ф椂涔熻鍦ㄧ▼搴忎腑璁劇疆緇濆璺緞銆備緥錛?br />log4j.appender.R.File灞炴ц緗棩蹇楁枃浠跺瓨鏀句綅緗傛垜浠彲浠ョ敤璇誨啓.properties閰嶇疆鏂囦歡鐨勬柟娉曡繘琛岀伒媧昏緗?br />
log4e浣跨敤璇存槑
鍦ㄤ簡瑙d簡log4j鐨勫姛鑳藉悗錛屾垜浠偗瀹氫細鎴戜滑鐨勭▼搴忎腑緙栧啓涓浜汱og4j鏃ュ織璁板綍銆傚浜庝嬌鐢‥clipse鐨勭▼搴忓憳Log4e灝嗘槸鎴戜滑鏈寰楀姏鐨刲og4j鏃ュ織緙栧啓鍔╂墜錛岀幇鍦ㄥ紑濮婰og4e涔嬫梾銆?br />Log4e鏄竴涓厤璐圭殑Eclipse Plugin錛屽畠鍙府鍔╀綘鍦ㄤ綘鐨凧ava宸ョ▼涓揩閫熷姞鍏og錛?鎴戜滑鍙互鍦?a >http://log4e.jayefem.de/index.php/Download緗戠珯涓婁笅杞絃og4e鏈鏂扮増鏈備笅杞藉悗灝嗙浉搴旀枃浠跺す鎷瘋礉鍒癊clipse鐨勬彃浠剁洰褰曚笅錛岄噸鏂癊clipse錛屽湪棣栭夐」涓細澶氬嚭涓涓?span>Log4e閫夐」銆?br />Log4e鍙互鏈夊涓彃鍏og涓轟竴涓柟娉曘佺被錛屽綋鐒朵篃鍙互鍦ㄥ綋鍓嶄綅緗彃鍏og錛屽悓鏃跺叾涔熷彲浠ユ妸Sysout.out.println()鐨勮漿鎹負log錛涙墍鏈夌殑榪欎竴鍒囧彧闇瑕佷綘鐐圭偣榧犳爣鎴栬呮寜涓嬈″揩鎹烽敭銆?font size="2">
Log4e鐨勫疄渚嬪弬鐓?a >http://log4e.jayefem.de
鍘熸枃鏉ヨ嚜浜?a >http://log4e.jayefem.de/index.php/Log4E:FAQ
If you are already familiar with your logging framework you might want to skip this section.
This chapter gives you a slight idea of how to make the initial setup of your logger. This is NOT supported by Log4E at the moment and was not the intended use at the beginning of this project.
Log4E does not ship any logging framework which means that you have to download and install it for yourself!
Examples are available for Log4j, Commons Logging, JDK 1.4 Logging (again: you have to do this for yourself).
.../MyEclipseProject/ .../MyEclipseProject/src/log4j.properties .../MyEclipseProject/src/com/mycompany/myapp/...
3. Edit the 'log4j.properties' to declare your own categories, log levels and appenders (which means the output like standard out or a log file).
log4j.properties example:
####################################################################### # Categories and levels ####################################################################### log4j.rootCategory=ERROR, FileApp, ConApp log4j.category.de.jayefem=DEBUG ####################################################################### # Appenders ####################################################################### # ConApp is set to be a ConsoleAppender. log4j.appender.ConApp=org.apache.log4j.ConsoleAppender # ConApp uses PatternLayout. log4j.appender.ConApp.layout=org.apache.log4j.PatternLayout # Define Pattern log4j.appender.ConApp.layout.ConversionPattern=%d [%t] %-5p %c - %m%n # FileApp log4j.appender.FileApp=org.apache.log4j.RollingFileAppender log4j.appender.FileApp.File=D:/proj/Devel/Java/de.jayefem.log4e/log/log4e.log log4j.appender.FileApp.MaxFileSize=500KB # Keep one backup file log4j.appender.FileApp.MaxBackupIndex=1 log4j.appender.FileApp.layout=org.apache.log4j.PatternLayout log4j.appender.FileApp.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
"de.jayefem", "ConApp", "FileApp" and the path to the logfile are selfdefined. All other words are keywords of Log4j.
4. That's all. Have fun.
Note that there are much more possibilities to configure Log4j. Check http://logging.apache.org/ for more.
Jakarta Commons Logging Framework is a wrapper for all common logging frameworks. If you want to use it, you have to install it AND the underlying logging framework. To install the Commons Logging download it from http://jakarta.apache.org/commons/logging/ and put the commons-logging.jar in your lib directory.
The Commons Logging Frameworks uses Log4j by default. When Log4j isn't found in classpath and JDK 1.4 or higher is being used, the JDK 1.4 logger will be used. If none of the above applies, Commons Logging will fall back to the internal SimpleLog.
It is also possible to specify the logging framework directly:
1. Create a new file 'commons-logging.properties' and put it in your classpath. To be more concrete: Put it in your source directory, the file will be copied by Eclipse automatically to your build directory.
For example:
.../MyEclipseProject/ .../MyEclipseProject/src/commons-logging.properties .../MyEclipseProject/src/com/mycompany/myapp/...2. Edit the 'commons-logging.properties'.
# #org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl # SimpleLog #org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog # JDK 1.4 logger #org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger # Avalon Toolkit #org.apache.commons.logging.Log=org.apache.commons.logging.impl.LogKitLogger # Log4j org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
1. Create a new file 'simplelog.properties' and put it in your classpath. To be more concrete: Put it in your source directory, the file will be copied by Eclipse automatically to your build directory.
For example:
.../MyEclipseProject/ .../MyEclipseProject/src/simplelog.properties .../MyEclipseProject/src/com/mycompany/myapp/...2. Edit the 'simplelog.properties' to declare your own categories and log levels.
# Default logging detail level for all instances of SimpleLog. Must be one of # ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, # defaults to "info". org.apache.commons.logging.simplelog.defaultlog=warn # Logging detail level for a SimpleLog instance named "xxxxx". Must be one of # ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, the # default logging detail level is used. org.apache.commons.logging.simplelog.log.de.jayefem.log4e=debug # Set to true if you want the Log instance name to be included in output # messages. Defaults to false. org.apache.commons.logging.simplelog.showlogname=false # Set to true if you want the last componet of the name to be included in # output messages. Defaults to true. org.apache.commons.logging.simplelog.showShortLogname=true # Set to true if you want the current date and time to be included in output # messages. Default is false. org.apache.commons.logging.simplelog.showdatetime=true
See http://jakarta.apache.org/commons/logging/ for more.
logging.properties example:
# handlers handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler # general level .level=INFO # file handler java.util.logging.FileHandler.pattern = %h/java%u.log java.util.logging.FileHandler.limit = 50000 java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter # console handler java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter test.de.jayefem.log4e.logkits.JDK1_4_Logging.level = FINEST
Since I am not an expert of JDK 1.4 logging there might be better ways to configure the logging framework. Suggestions are welcome.
See http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html for more information.
鏈榪戝彂鐜癢eblogic涔熸槸鐢ㄧ殑log4j錛屽懙鍛點?/p>