logging - Servicemix - Removing the text field from a log entry -
i using servicemix route between activemq queues.
<bean id="kubeactivemq" class="org.apache.activemq.camel.component.activemqcomponent"> <property name="brokerurl" value="tcp://172.9.9.6:30785" /> </bean> <camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="kubeactivemq:queue:///smx_consumes_from_here" /> <to uri="log:ebipmastermessage?level=info&maxchars=0" /> <to uri="kubeactivemq:smx_produces_here-2" /> </route> </camelcontext>
the custom logger using configured follows.
# root logger log4j.rootlogger=debug, out, stdout, osgi:vmlogappender log4j.throwablerenderer=org.apache.log4j.osgithrowablerenderer # avoid flooding log when using info level on ssh connection , doing log:tail log4j.logger.org.apache.sshd.server.channel.channelsession=info # console appender not used default log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{iso8601} | %-5.5p | %-16.16t | %-32.32c{1} | %x{bundle.id} - %x{bundle.name} - %x{bundle.version} | %m%n # file appender log4j.appender.out=org.apache.log4j.rollingfileappender log4j.appender.out.layout=org.apache.log4j.patternlayout log4j.appender.out.layout.conversionpattern=%d{iso8601} | %-5.5p | %-16.16t | %-32.32c{1} | %x{bundle.id} - %x{bundle.name} - %x{bundle.version} | %m%n log4j.appender.out.file=/logs/servicemix.log log4j.appender.out.append=true log4j.appender.out.maxfilesize=1mb log4j.appender.out.maxbackupindex=10 # sift appender log4j.appender.sift=org.apache.log4j.sift.mdcsiftingappender log4j.appender.sift.key=bundle.name log4j.appender.sift.default=servicemix log4j.appender.sift.appender=org.apache.log4j.fileappender log4j.appender.sift.appender.layout=org.apache.log4j.patternlayout log4j.appender.sift.appender.layout.conversionpattern=%d{iso8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log log4j.appender.sift.appender.append=true # log ebip messages master data queue log4j.appender.ebipmaster=org.apache.log4j.rollingfileappender log4j.appender.ebipmaster.file=/logs/ebip-master.log log4j.appender.ebipmaster.datepattern='.'yyyy-mm-dd log4j.appender.ebipmaster.append=true log4j.appender.ebipmaster.layout=org.apache.log4j.patternlayout log4j.appender.ebipmaster.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c %3x - %m%n log4j.appender.ebipmaster.maxfilesize=1mb log4j.appender.ebipmaster.maxbackupindex=10 log4j.logger.ebipmastermessage=debug, ebipmaster log4j.additivity.ebipmastermessage=false
as far root logger goes, sample of log file follows :
2017-08-10 18:10:24,137 | debug | sumes_from_here] | endpointmessagelistener | 118 - org.apache.camel.camel-jms - 2.16.3 | endpoint[kubeactivemq://smx_consumes_from_here] consumer received jms message: activemqtextmessage {commandid = 11, responserequired = true, messageid = id:ca00201262-61888-1502388591181-1:1:1:1:7, originaldestination = null, originaltransactionid = null, producerid = id:ca00201262-61888-1502388591181-1:1:1:1, destination = queue://smx_consumes_from_here, transactionid = null, expiration = 0, timestamp = 1502388599084, arrival = 0, brokerintime = 1502388624136, brokerouttime = 1502388624136, correlationid = null, replyto = null, persistent = true, type = null, priority = 4, groupid = null, groupsequence = 0, targetconsumerid = null, compressed = false, userid = null, content = org.apache.activemq.util.bytesequence@4530e9b8, marshalledproperties = null, datastructure = null, redeliverycounter = 0, size = 0, properties = null, readonlyproperties = true, readonlybody = true, droppable = false, jmsxgroupfirstforconsumer = false, text = jun's test message 1} 2017-08-10 18:10:26,450 | debug | sumes_from_here] | jmsconfiguration | 118 - org.apache.camel.camel-jms - 2.16.3 | sending jms message to: queue://smx_produces_here message: activemqtextmessage {commandid = 0, responserequired = false, messageid = null, originaldestination = null, originaltransactionid = null, producerid = null, destination = null, transactionid = null, expiration = 0, timestamp = 0, arrival = 0, brokerintime = 0, brokerouttime = 0, correlationid = null, replyto = null, persistent = true, type = null, priority = 4, groupid = null, groupsequence = 0, targetconsumerid = null, compressed = false, userid = null, content = null, marshalledproperties = null, datastructure = null, redeliverycounter = 0, size = 0, properties = {breadcrumbid=id:ca00201262-61888-1502388591181-1:1:1:1:9, cameljmsdeliverymode=2}, readonlyproperties = false, readonlybody = false, droppable = false, jmsxgroupfirstforconsumer = false, text = jun's test message 1}
as can see log entries output text
field. e.g. text = jun's test message 1
is there way can remove text
field log entries ?
what using custom layout? extend patternlayout , override string format(loggingevent event)
method.
in overridden version copy data , remove text
header before calling super.format(event)
. sure not modify actual value passed.
then configure custom logger.
# log ebip messages master data queue log4j.appender.ebipmaster.layout=my.custom.donotprinttextpatternlayout
since you're running in servicemix sure have bundle exposing such class.
take @ anwser: fuse 6.3 dbcp basic datasource regarding classloading.
Comments
Post a Comment