当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: 原文出处:http://www.vipan.com/译者:醉了~白E-MAIL:ENVELOP@163.COM中文标题:LOG4J快速入门及参考资料正文:第一部分,快速入门 首先,需要去下载LOG4J这个软件并解压缩出其中的log4j.jar.在你的应用程序的classpath中包含该JA...
 

 

    摘要: struts采用mvc体系框架,将view与model部分分开,赋予web应用开发以新的内涵。但是,使用struts技术后,大大小小的文件数目激增。给管理及维护带来了不小的挑战。一方面要享受struts的开发效率,另一方面也要考虑到易于维护。 在struts中,有两个突出的关键词:结构和层次。一定要做到:结构严谨、层次分明。如果抓不住这两点,你的开发一定是很失败的。 虽然大大小小的文件......
 ·设置代理服务器    »显示摘要«
    摘要: //使用jvm参数设置这个属性,例如:-dproxyserverhost=10.1.22.175 -dproxyserverport=1080 if(system.getproperty("proxyserverhost")!=null) { props.put("socksproxyhost",system.getproperty("proxyserverhost")); } if(......


[译作]LOG4J快速入门及参考资料

原文出处:http://www.vipan.com/

e-mail:envelop@163.com 【程序编程相关:JNLP文件模板

译者:醉了~白 【推荐阅读:Castor学习笔记(一)

正文: 【扩展信息:准备开放我的工作流客户端开源程序

中文标题:log4j快速入门及参考资料

第一部分,快速入门

  首先,需要去下载log4j这个软件并解压缩出其中的log4j.jar.在你的应用程序的classpath中包含该jar文件,你也可以简单地将这个文件拷贝到jdk的%java_home%\lib\ext目录下.

  在作完以上工作后,你可以将下面的代码保存到名为testlogging.java中:

##############################

import org.apache.log4j.*;

// how to use log4j

public class testlogging {

    // initialize a logging category.  here, we get the root category

    //static category cat = category.getroot();

    // or, get a custom category

    static category cat = category.getinstance(testlogging.class.getname());

    // from here on, log away!  methods are: cat.debug(your_message_string),

    // cat.info(...), cat.warn(...), cat.error(...), cat.fatal(...)

    public static void main(string args[]) {

        // try a few logging methods

        cat.debug("start of main()");

        cat.info("just testing a log message with priority set to info");

        cat.warn("just testing a log message with priority set to warn");

        cat.error("just testing a log message with priority set to error");

        cat.fatal("just testing a log message with priority set to fatal");

        // alternate but inconvenient form

        cat.log(priority.debug, "calling init()");

        new testlogging().init();

    }

    public void init() {

        java.util.properties prop = system.getproperties();

        java.util.enumeration enum = prop.propertynames();

        cat.info("***system environment as seen by java***");

        cat.debug("***format: property = value***");


...   下一页
 ·对象序列化的安全性    »显示摘要«
    摘要: 在进行对象序列化时,要想保证安全性,可以: 1。把敏感数据字段设为transient 2。不要使用保存和还原对象的默认机制。 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE