日志文件在WebLogic Server版本:10.3.0.0上创建,但不会写入日志

时间:2015-01-27 08:56:52

标签: logging log4j weblogic logfile

我正在部署应用程序ear,它的lib文件夹中有log4j jar。我将log4j.properties放在文件夹/ opt / beavas / vn_home中,我使用环境变量读取。

我按如下方式初始化log4j

Properties log4jProperties = new Properties();
inputStream = new FileInputStream("path to log4j.properties");
log4jProperties.load(inputStream);
PropertyConfigurator.configure(log4jProperties);

然后我用

    Logger.getLogger(clazz).log(LoggerUtilities.class.getName(), level, msg, t);

其中clazz是我从我的应用程序发送的类名,LoggerUtilities是初始化logger的常用类。

level- log level, msg- log meesage, t- Throwable object is any.

我的log4j.properties文件如下

    log4j.appender.vaservices=org.apache.log4j.RollingFileAppender
    log4j.appender.vaservices.file=/opt/beavas/logs/vas_new.log
    log4j.appender.vaservices.MaxFileSize=100MB
    log4j.appender.vaservices.MaxBackupIndex=100
    log4j.appender.vaservices.append=true
    log4j.appender.vaservices.layout=org.apache.log4j.PatternLayout
    log4j.appender.vaservices.layout.ConversionPattern=%d{ISO8601}|%-5p|%L|%t|%c|%-6m %n


    log4j.logger.com.tieto.vn.vas = DEBUG, vaservices
    log4j.logger.com.tieto.tix.core = DEBUG, vaservices
    log4j.logger.com.tieto.tix.imaging = DEBUG, vaservices

文件vas_new.log在应用程序更新时获取创建但不写入日志。如何解决?

1 个答案:

答案 0 :(得分:1)

在log4j.properties中添加一行,如下所示:

log4j.rootLogger = DEBUG, vaservices