简体   繁体   English

Glassfish LOG4J loggin不同的应用程序

[英]Glassfish LOG4J loggin diferent applications

I have many applications (war, ejb) in same glassfish server, the applications have different log4j configuration 我在同一个glassfish服务器中有许多应用程序(war,ejb),这些应用程序具有不同的log4j配置

app1.war -> log4j.properties app1.war-> log4j.properties

log4j.rootLogger=info, infcore
log4j.appender.infcore=org.apache.log4j.RollingFileAppender
log4j.appender.infcore.File=/var/log/app1info.log
log4j.appender.infcore.MaxFileSize=20000KB
log4j.appender.infcore.MaxBackupIndex=20
log4j.appender.infcore.layout=org.apache.log4j.PatternLayout
log4j.appender.infcore.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%5p] [%t] %c %x - %m%n

app2.jar -> log4j.properties app2.jar-> log4j.properties

log4j.rootLogger=info, infoejb
log4j.appender.infoejb=org.apache.log4j.RollingFileAppender
log4j.appender.infoejb.File=/var/log/ejbinfo.log
log4j.appender.infoejb.MaxFileSize=20000KB
log4j.appender.infoejb.MaxBackupIndex=20
log4j.appender.infoejb.layout=org.apache.log4j.PatternLayout
log4j.appender.infoejb.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%5p] [%t] %c %x - %m%n

app3.war -> log4j.properties app3.war-> log4j.properties

log4j.rootLogger=info, infoapp2
log4j.appender.infoapp2=org.apache.log4j.RollingFileAppender
log4j.appender.infoapp2.File=/var/log/infoapp2.log
log4j.appender.infoapp2.MaxFileSize=20000KB
log4j.appender.infoapp2.MaxBackupIndex=20
log4j.appender.infoapp2.layout=org.apache.log4j.PatternLayout
log4j.appender.infoapp2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%5p] [%t] %c %x - %m%n

I call logger: 我称记录器为:

protected static final Logger LOG = Logger.getLogger(JAXSecurutyValidation.class);

The problem is that the information is recorded in only one file the ejb, the others files are not created. 问题在于该信息仅记录在ejb的一个文件中,而其他文件则未创建。

How can I fix it? 我该如何解决?

SOLVED I find the solution, is very simple update to glasfish 5 and all works fine, thanks. 解决了我找到的解决方案,它是对glasfish 5的非常简单的更新,一切正常,谢谢。

Maybe this can help you: 也许这可以帮助您:

String log4jfile = "log4 file path";
PropertyConfigurator.configure(log4jfile);

You can call each log4j file for each application. 您可以为每个应用程序调用每个log4j文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM