我試圖執行org.apache.commons.logging.Log
實現。我將2 lib jars
複製到domainhome/lib
文件夾根據http://docs.oracle.com/cd/E21764_01/web.1111/e13739/config_logs.htm#i1014785。Weblogic 10.3日誌執行
如果我在創建記錄器實例(使用LogFactory.getFactory().getInstance(this.getClass());
)之前使用System.setProperty(LogFactory.FACTORY_PROPERTY, "weblogic.logging.commons.LogFactoryImpl");
,它將起作用。但是我不想用這種方式在每個班上使用setProperty
。所以我操作我setDomainEnv.cmd
(見下文PLZ)如添加
-Dweblogic.logging.commons.LogFactoryImpl=org.apache.commons.logging.LogFactory
的說法,我還沒有遇到任何異常,當我通過這種方式啓動WebLogic但它並不WriteOut的任何記錄。 Plz幫我,我錯過了什麼? THX提前 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");
....}}
http://buttso.blogspot.de/2011/06/using-slf4j-with-weblogic- server.html – Cris