Discussions

EJB programming & troubleshooting: how to configure log4j for EJB

  1. how to configure log4j for EJB (8 messages)

    I'm using Borland JBuilderX and Weblogic8.1 to develop EJBs, and I want to use log4j in EJBs, but I don't know how to configure it.

    any help appreciated!

    Threaded Messages (8)

  2. how to configure log4j for EJB[ Go to top ]

    I'm using Borland JBuilderX and Weblogic8.1 to develop EJBs, and I want to use log4j in EJBs, but I don't know how to configure it.any help appreciated!
    Well, I don't see any problem in doing do. You need to have log4j.jar and configure the appenders you want to use in log4.properties. Rest everything is done by the framework.
  3. how to configure log4j for EJB[ Go to top ]

    In WebLogic 8.1:

    If deployment is in EAR files, put the log4j config file (I use the XML version) in the App-inf/classes folder and put log4j jar file in app-inf/lib folder.
  4. Thank you!![ Go to top ]

    Thank you very much for your suggesstion. I am able to configure log4j in my .ear file (which has 3 subsystems and each subsystem should be configured differently).

    -Sreenivasa Majji.
  5. Problems...[ Go to top ]

    I seem to be having difficulty trying to accomplish what seems to be a very simple task: loading log4j configuration from a file using an EJB. I am using org.apache.commons.logging.

    I am using Weblogic 8.1 SP2 (both the WLW and the Server). I have log4j-1.2.8.jar in APP-INF/lib and I have my log4j.properties in APP-INF/classes.

    In my EJB I have the following imports and log initialization:

    import org.apache.commons.logging.LogFactory;
    import org.apache.commons.logging.Log;
    import org.apache.log4j.BasicConfigurator;
    import org.apache.log4j.PropertyConfigurator;

    public class MyEJB extends GenericSessionBean implements Session Bean {

    private static final Log log = LogFactory.getLog(MyEJB.class);

    I then invoke log statements in the normal way, i.e.

    log.info("Is the log working?");

    I can make it work by using either BasicConfigurator.configure() or PropertyConfigurator.configure(props) with a Properties object built at runtime in ejbCreate(), however, for the life of me, I can't get it to load the configuration from the log4j.properties file! Any suggestions welcome...

    Thanks
  6. Solved...[ Go to top ]

    Ok, I've got it now. A server-level configuration was overriding my own. After making the necessary adjustments, I can now load properties from APP-INF/classes.
  7. facing same proble[ Go to top ]

    Hi,
    i am facing same proble.
  8. facing same proble[ Go to top ]

    Hi,
    i am facing same proble.
    will you please tell me how did you solved this?
    or else will you mail me to
    purushottam_hegde@yahoo.com
  9. Could you please tell me what configuration you have done for logging the messages to file.