-
1. Re: Bundle specific log4j.properties
ffang May 19, 2013 8:17 PM (in response to gsehgal1)Hi,
You shouldn't have specific log4j.properties for each bundle.
All logging stuff should be delegated to pax-logging which is a OSGi loging service, that said, there's a central file $FUSE_ESB/etc/org.ops4j.pax.logging.cfg where you can configre the logging stuff.
In this file you can define a customer file appender which could be used for your specific bundles, something like
# Customter File appender
log4j.appender.myout=org.apache.log4j.RollingFileAppender
log4j.appender.myout.layout=org.apache.log4j.PatternLayout
log4j.appender.myout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.myout.file=${karaf.data}/log/my.log #or anywhere you want
log4j.appender.myout.append=true
log4j.appender.myout.maxFileSize=1MB
log4j.appender.myout.maxBackupIndex=10
then add
log4j.category.package_for_your_specific_bundle=INFO, myout
And there is a related discussion[1], you may wanna take a look to get more details.
Freeman
-
2. Re: Bundle specific log4j.properties
rgiordanizz Jun 2, 2014 2:07 PM (in response to ffang)Hi,
I'm trying to find some information to configure org.ops4j.logging.cfg on Jboss Fuse 6.1 to send container logs to my remote logstash server , but I found only some forum that talk about this.
One is http://joelholder.com/author/jclosure/ but in this example the logstash agent is locally so they will use local file as input.
So reading in some post I've found this configuration
log4j.appender.server=org.apache.log4j.net.SocketAppender
log4j.appender.server.Port=5545
log4j.appender.server.RemoteHost=x.x.x.x
log4j.appender.server.ReconnectionDelay=10000
and on logstash config file this section
input {
tcp {
type => log4j
port => 5545
}
}
But after restarting the container I didn't found the socket opened to remoteHost :-(
Could someone help me?
Regards,
Roberto