Logging has been edited by Karan Singh Malhi (Aug 20, 2007).

(View changes)

Content:

Logging for Users

All logging in OpenEJB is done using the openejb.base/conf/logging.properties file. When you download and extract OpenEJB, you will not find this file under the openejb.base/conf directory. However, when you start the server, this file magically appears. So what does this give you as a user of OpenEJB? Here are some of the benefits:

  1. You do not have to author a logging.properties from scratch. You get one with sensible defaults.
  2. If you did modify the default file, and you wanted to revert back to the default file generated by OpenEJB, all you have to do is
    1. Delete or rename the file e.g. rename it to logging.properties.BAK .
    2. Restart the server

             OpenEJB will find that the logging.properties file is missing from the openejb.base/conf directory and it will automatically create a new one with the default configuration. The good thing is that if you modify the logging.properties file, OpenEJB will *NOT* over-write it.

The default logging configuration created by OpenEJB uses RollingFileAppender's. The log files are located under the openejb.base/logs directory. By default it writes to just two files , openejb.log and transaction.log 

Logging for contributors/committers

Here is a (modified) extract from another email from David Blevins 

//TODO -- Change the below text to reflect new Logging Framework 

Each module has a file called embedded.logging.properties. This file contains the definition of all Loggers, their appenders and warning levels. However, we do not use default.logging.conf first. The basic idea is that first we look for say conf/logging.conf in the openejb.base directory.  If we don't find it there, we look for default.logging.conf in the classpath.  If we did find default.logging.conf (which we should) and there is an openejb.base/conf/ directory then expand the default.logging.conf to openejb.base/conf/logging.conf where we expected to find the file in the first place.  If there was no openejb.base/conf/ directory, then it's safe to assume we're running embedded (in a test case perhaps) and just use the default.logging.conf and do no extra work.

We have default.logging.conf which we use this way as well as default.openejb.conf and now more recently users.properties and groups.properties.  We search on disk for the resource in openejb.base/conf/ if we don't find them we unpack the default one we stuffed in openejb-core jar and extract it to disk in the openejb.base/conf directory if there is one -- if there isn't one we just use the default file.

The basic ideas behind the pattern are that:
 1. If you've messed up your configuration, just delete or rename the respective files in your conf/ directory and new (working) ones will magically appear.
 2. When upgrading its nice that our zip file won't overwrite any existing files in conf/
 3. If you're running embedded you don't have to setup any directories or have any config files, we can run on defaults.

The ConfUtils.getConfResource utility to do that pattern generically , but so far we're only using it for the users.properties and groups.properties files.  We should be using it everywhere.  Having the code in multiple places has lead to some inconsistencies such as we expand the default.openejb.conf file to conf/openejb.xml (not even the same file extension).  We really don't need the "default" part in our file names and the lingering usage of the "conf" file extension is something that needs to go bye-bye -- we should use properties for properties files and xml for xml files, etc.

Reply via email to