Removing the text field from a log entry

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Removing the text field from a log entry

jeunii
This post has NOT been accepted by the mailing list yet.
I am currently using ServiceMix to 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&amp;maxChars=0" />
        <to uri="kubeActivemq:SMX_PRODUCES_HERE-2" />
      </route>
    </camelContext>

The custom logger that I am using is configured as follows.

# Root logger
log4j.rootLogger=DEBUG, out, stdout, osgi:VmLogAppender
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer

# To avoid flooding the log when using INFO level on an ssh connection and doing log:tail
log4j.logger.org.apache.sshd.server.channel.ChannelSession=INFO

# CONSOLE appender not used by 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 for 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 as my root logger goes, a sample of the log file I get is as 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 with 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 you can see the log entries output a "text" field. e.g. "text = Jun's test message 1"

Is there a way I can remove the "text" field from the log entries ?