logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dean McCall" <dmcc...@allidex.com>
Subject RE: Initializing EJBs
Date Mon, 28 Oct 2002 20:55:44 GMT
We use a single configuration and rely on Log4j's ability to configure
different loggers.  Loggers are initialized in a class as follows:

protected Logger logger = Logger.getLogger(MyClass.class);

Classes/Components are then configured in the xml configuration file to have
different logging configuration based on the package and class name.

We use Log4j 1.2.7 and yes it is in the CLASSPATH at server startup.


 *  Copywrite Allidex, Inc.
package allidex.wl7.startup;

import java.io.FileInputStream;
import java.util.Hashtable;
import org.apache.log4j.*;
import org.apache.log4j.xml.*;
import weblogic.common.*;

 *  Automatically launched when the WebLogic Server starts up, and its
startup method will be called.
 *  The class is configured as a startup class.
 * @author     dmccall
public class Log4jConfig implements T3StartupDef
    /**  Constructor for the Log4jConfig object */
    public Log4jConfig()

     *  The startup method is called by the WebLogic Server at startup.
     *  This method retrieves the Log4j xml configuration file
     *  from the server configuration and reads the configuration using
     *  DOMConfigurator.
     * @param  argName                  virtual_name for the startupClass
     * @param  argHt                    name-value pairs supplied with the
startupArgs property
     * @return                          string sent to log file
     * @exception  java.lang.Exception  generic exception
    public String startup(String argName,
            Hashtable argHt)
        throws java.lang.Exception
        //  retrieve the log4j configuration file name
        //  from the hashtable provided by the server
        //  configuration
        System.out.print("configuration = ");
        String file_name = (String)argHt.get("configuration");

        //  read the configuration and watch for changes
        DOMConfigurator config = new DOMConfigurator();
        config.configureAndWatch(file_name, 3000);

        Logger logger = Logger.getLogger(Log4jConfig.class);
        logger.debug("Debug test message");
        logger.info("Info test message");
        logger.error("Error test message");

        return "Done configuring Log4j";

     *  Sets the services stub for the T3StartupDef object.
     * @param  argServices  reference to obtain access to services
    public void setServices(T3ServicesDef argServices)
        services = argServices;

    protected T3ServicesDef services;

-----Original Message-----
From: Lu, David [mailto:dlu@tiaa-cref.org]
Sent: Monday, October 28, 2002 12:32 PM
To: 'Log4J Users List'
Subject: RE: Initializing EJBs


Thanks for responding.

Our goal is for every application to have its own logging universe (own
logging repository).

Does your solution provide this?
Is log4j-version in your system CP?

I'd be interested in your class, regardless.

Thanks again!

-----Original Message-----
From: Dean McCall [mailto:dmccall@allidex.com]
Sent: Monday, October 28, 2002 2:27 PM
To: Log4J Users List
Subject: RE: Initializing EJBs


We use WebLogic and Log4j.  In WebLogic, you can configure a startup class
that loads when the J2EE server starts.  I developed a class that reads and
watches an xml configuration using the DOMConfigurator.  This configures
Log4j for any component that runs on the server, ie: ejb or servlet.

If you are interested in the class.  Let me know.


-----Original Message-----
From: Lu, David [mailto:dlu@tiaa-cref.org]
Sent: Monday, October 28, 2002 12:02 PM
To: 'Log4J Users List'
Subject: Initializing EJBs

I've been struggling to find an answer as to how to initialize EJBs.

In log4j documentation, Ceki's book and in TSS, there seems to be no answer
as where to put
DOMConfigure.configure() for EJBs.

We will be using one configuration file per application so that rules out
the default initialization procedure.

We also want to maintain separation of logging configuration so placing the
initialization procedure in a
WebLogic startup class is out of the question since that means log4j will be
in the system cp and therefore override
any log4j in each application archive.

Does anyone have a tested way of initializing EJB's using multiple
configuration files without using the default initialization procedure?

This message, including any attachments, contains confidential information
intended for a specific individual and purpose, and is protected by law.  If
you are not the intended recipient, please contact sender immediately by
reply e-mail and destroy all copies.  You are hereby notified that any
disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message