Logger

Package: org.zkoss.util.logging.Log

The logger used by ZK is based on the standard logger, java.util.Logger. However, we wrap it as org.zkoss.util.logging.Log to make it more efficient. The typical use is as follows.

import org.zkoss.util.logging.Log;
class MyClass {
    private static final Log log = Log.lookup(MyClass.class);    
    public void f(Object v) {    
        if (log.debugable()) log.debug("Value is "+v);        
    }    
}

Since ZK uses the standard logger to log message, you could control what to log by configuring the logging of the Web server you are using. How to configure the logging of the Web server varies from one server to another. Please consult the manuals. Or, you might use the logging configuration mechanism provided by ZK as described below.

Note: By default, all ZK log instances are mapped to the same Java logger named org.zkoss to have the better performance. If you want to control the log level up to individual class, you have to invoke the following statement to turn on the hierarchy support.

Log.setHierarchy(true);

Note: The hierarchy support is enabled automatically, if you configure the log level with WEB-INF/zk.xml as described in the following section.