Skip to content

Instantly share code, notes, and snippets.

@sneakybeaky
Created May 14, 2013 21:07
Show Gist options
  • Save sneakybeaky/5579559 to your computer and use it in GitHub Desktop.
Save sneakybeaky/5579559 to your computer and use it in GitHub Desktop.
Logging config for tracking issues in Apache CXF DOSGi 1.5 SNAPSHOT
################################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# Root logger
log4j.rootLogger=INFO, out, osgi:*
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
# To avoid flooding the log when using DEBUG level on an ssh connection and doing log:tail
log4j.logger.org.apache.sshd.server.channel.ChannelSession = INFO
log4j.logger.org.apache.cxf.dosgi.discovery.zookeeper = TRACE
log4j.logger.org.apache.cxf.dosgi.discovery.zookeeper.PublishingEndpointListener = TRACE, dosgi
log4j.logger.org.apache.cxf.dosgi.dsw.service.ExportRegistrationImpl = TRACE, dosgi
log4j.logger.org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport = TRACE,dosgi
# 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} | %-32.32C %4L | %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} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.out.file=${karaf.data}/log/karaf.log
log4j.appender.out.append=true
log4j.appender.out.maxFileSize=1MB
log4j.appender.out.maxBackupIndex=10
# File appender for DOSGi logging
log4j.appender.dosgi=org.apache.log4j.RollingFileAppender
log4j.appender.dosgi.layout=org.apache.log4j.PatternLayout
log4j.appender.dosgi.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.dosgi.file=${karaf.data}/log/dosgi.log
log4j.appender.dosgi.append=true
log4j.appender.dosgi.maxFileSize=1MB
log4j.appender.dosgi.maxBackupIndex=10
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=karaf
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} | %-32.32C %4L | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
@sneakybeaky
Copy link
Author

With the above config, this is what I see in dosgi.log

2013-05-14 22:09:15,125 | INFO  | l Console Thread | ExportRegistrationImpl           | service.ExportRegistrationImpl$1  181 | 114 - cxf-dosgi-ri-dsw-cxf - 1.5.0.SNAPSHOT | Service [260] has been unregistered: Removing service export
2013-05-14 22:09:15,126 | DEBUG | l Console Thread | ExportRegistrationImpl           | w.service.ExportRegistrationImpl   96 | 114 - cxf-dosgi-ri-dsw-cxf - 1.5.0.SNAPSHOT | really closing ExportRegistartion now! 
2013-05-14 22:09:15,127 | DEBUG | l Console Thread | TopologyManagerExport            | exporter.TopologyManagerExport$2  105 | 113 - cxf-dosgi-ri-topology-manager - 1.5.0.SNAPSHOT | Received UNREGISTERING ServiceEvent: org.osgi.framework.ServiceEvent[source=[com.ninedemons.spikes.dosgi.shared.PingService]]

This means that the node will not be deleted from Zookeeper as this is done by the ServiceEvent listeners, which need the service export to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment