还有Logger log = Logger.getLogger(Class clazz)参数中的这个类是什么意思?

解决方案 »

  1.   

    就是传一个Class对象进去,Class(不是class)也是一个类
    比如你可以这样用
    public class Hello {
    Logger log = Logger.getLogger(Hello.class) ;
    }
      

  2.   

    还有一个问题是为什么在log4j.properties中不能写中文注释呢?如:"###这是注释###"这时将不能保存文件提示说不是iso-8859-1请大家指点。
      

  3.   

    就是 类名.class 就是一个 Class对象 ; 
    Class c = String.class ;
      

  4.   

    你把log4j.properties这属性文件的编码改为GBK就可以保存中文了。
      

  5.   

    log4j.properties这属性文件的编码要在哪里可以修改呢?
      

  6.   

    用编辑器打开,应该都可以找到修改编码的选项的
    比如EDITPLUS: 文档 - 》 文件编码------------------------------------------------
    看一下,下面这两个文档说明:
    public static Logger getLogger(Class clazz)
    Shorthand for getLogger(clazz.getName()).
    参数
    clazz - The name of clazz will be used as the name of the logger to retrieve. See getLogger(String) for more detailed information.public static Logger getLogger(String name)
    Retrieve a logger named according to the value of the name parameter. If the named logger already exists, then the existing instance will be returned. Otherwise, a new instance is created.
    By default, loggers do not have a set level but inherit it from their neareast ancestor with a set level. This is one of the central features of log4j.参数
    name(名称) - The name of the logger to retrieve.就是单例模式的意思
      

  7.   

    晕 我也想问 传个Class 或者传个String
     是要完成什么功能? ..