webyildirim
webyildirim

Reputation: 617

Weblogic 10.3 logging implementation

I m trying to implement org.apache.commons.logging.Log implementation. I copied 2 lib jars into domainhome/lib folder acc to http://docs.oracle.com/cd/E21764_01/web.1111/e13739/config_logs.htm#i1014785.

If i use System.setProperty(LogFactory.FACTORY_PROPERTY, "weblogic.logging.commons.LogFactoryImpl"); before creating logger instance (by using LogFactory.getFactory().getInstance(this.getClass());) it works. But i do not want to use setProperty on every class by this way. So i manipulated my setDomainEnv.cmd (see below plz) as adding

-Dweblogic.logging.commons.LogFactoryImpl=org.apache.commons.logging.LogFactory

argument, i have not faced any exception when i start weblogic by that way but it does not writeout any log. Plz help me that what i missed? Thx in advance Brgds

setDomainEnv.cmd
...
set EXTRA_JAVA_PROPERTIES=-Dweblogic.logging.commons.LogFactoryImpl=org.apache.commons.logging.LogFactory %EXTRA_JAVA_PROPERTIES%
...



MainManagerBean.class
@Stateless(name="MainManager", mappedName = "MainManager")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Interceptors(value = { PerformanceMonitor.class, ProfileInterceptor.class })
public class MainManagerBean implements MainManager, MainManagerLocal
{
    private Log logger =LogFactory.getFactory().getInstance(this.getClass());


    @PersistenceContext(unitName = "EJBModel")
    private EntityManager manager;


    @Resource
    SessionContext ctx;


    @PostConstruct
    public void initialized()
    {
        //System.setProperty(LogFactory.FACTORY_PROPERTY, "weblogic.logging.commons.LogFactoryImpl");
        //  logger= LogFactory.getFactory().getInstance(this.getClass());
        logger.debug("MainManagerBean is initialized");
        logger.info("MainManagerBean is initialized");
        logger.trace("MainManagerBean is initialized");
....}}

Upvotes: 0

Views: 2146

Answers (1)

Display Name is missing
Display Name is missing

Reputation: 6227

You have the log factory property reversed. You show it as:

-Dweblogic.logging.commons.LogFactoryImpl=org.apache.commons.logging.LogFactory

When it should be:

-Dorg.apache.commons.logging.LogFactory=weblogic.logging.commons.LogFactoryImpl

http://docs.oracle.com/cd/E11036_01/wlevs20/config_server/logging.html

Upvotes: 1

Related Questions