| | | | Browse by category |
Question
Can I access and configure the logging traces logged by JViews?
Answer
Yes, you can access and configure them. See details below.
Access
Yes. You can have access to all logs issued by JViews by creating a logger for the ilog.views package. Like this:
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("ilog.views");
Configuration
-
Programmatically
You can customize the Logger class programmatically using the java.util.logging.Logger as illustrated below:.
java.util.logging.Logger logger =
java.util.logging.Logger.getLogger("ilog.views");
logger.setLevel(java.util.logging.Level.SEVERE);
-
File
You can also customize the logging properties of your application via a logging properties file. You can specify the logging level for the ilog.views logger. It could be similar to this:
ilog.views.level=SEVERE
The valid logging levels are: ALL, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST and OFF, as defined in the
java.util.logging.Level.
Besides configuring the logger, your configuration file provides you with the ability to configure other aspects of the logging facility such as: global logging level, the log handler class, log handler specific properties, and so on.
In order to enforce the use of your logging configuration file you need to specify its absolute path and name in the java.util.logging.config.file system property.
For example:
java -Djava.util.logging.config.file=c:my-projectsjviewssample_logging.properties MyApplication
If you do not specify the absolute path, the logging properties file will be searched under its default location which is inside the JDK, under JAVA_HOME/jre/lib/logging.properties. In which case you would need to change this file in order to have any logging changes take effect.
Note: Logging is only supported on JDK 1.4 and later.