################################################################################
#
#    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.
#
################################################################################

# Common pattern layout for appenders
log4j2.pattern = %d{ISO8601} %X{task.id}-%X{entity.ids} %-5.5p %3X{bundle.id} %c{1.} [%.16t] %m%n

###############
# Root logger #
###############
log4j2.rootLogger.level = INFO

## Karaf console log (log:tail)
log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi

## Console log
log4j2.rootLogger.appenderRef.Console.ref = Console
log4j2.rootLogger.appenderRef.Console.filter.threshold.type = ThresholdFilter
log4j2.rootLogger.appenderRef.Console.filter.threshold.level = ${karaf.log.console:-OFF}

## Brooklyn INFO file log
log4j2.rootLogger.appenderRef.BrooklynInfo.ref = BrooklynInfo
log4j2.rootLogger.appenderRef.BrooklynInfo.filter.threshold.type = ThresholdFilter
log4j2.rootLogger.appenderRef.BrooklynInfo.filter.threshold.level = INFO

## Brooklyn DEBUG file log
log4j2.rootLogger.appenderRef.BrooklynDebug.ref = BrooklynDebug
log4j2.rootLogger.appenderRef.BrooklynDebug.filter.threshold.type = ThresholdFilter
log4j2.rootLogger.appenderRef.BrooklynDebug.filter.threshold.level = DEBUG

###################
# Appender Config #
###################

## OSGi appender
log4j2.appender.osgi.type = PaxOsgi
log4j2.appender.osgi.name = PaxOsgi
log4j2.appender.osgi.filter = *

## Console appender
log4j2.appender.console.type = Console
log4j2.appender.console.name = Console
log4j2.appender.console.layout.type = PatternLayout
log4j2.appender.console.layout.pattern = ${log4j2.pattern}

## Brooklyn INFO appender
log4j2.appender.rolling_info.type = RollingRandomAccessFile
log4j2.appender.rolling_info.name = BrooklynInfo
log4j2.appender.rolling_info.fileName = ${karaf.data}/log/brooklyn.info.log
log4j2.appender.rolling_info.filePattern = ${karaf.data}/log/brooklyn.info.log.%i
log4j2.appender.rolling_info.append = true
log4j2.appender.rolling_info.layout.type = PatternLayout
log4j2.appender.rolling_info.layout.pattern = ${log4j2.pattern}
log4j2.appender.rolling_info.policies.type = Policies
log4j2.appender.rolling_info.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.rolling_info.policies.size.size = 16MB

## Brooklyn DEBUG appender
log4j2.appender.rolling_debug.type = RollingRandomAccessFile
log4j2.appender.rolling_debug.name = BrooklynDebug
log4j2.appender.rolling_debug.fileName = ${karaf.data}/log/brooklyn.debug.log
log4j2.appender.rolling_debug.filePattern = ${karaf.data}/log/brooklyn.debug.log.%i
log4j2.appender.rolling_debug.append = true
log4j2.appender.rolling_debug.layout.type = PatternLayout
log4j2.appender.rolling_debug.layout.pattern = ${log4j2.pattern}
log4j2.appender.rolling_debug.policies.type = Policies
log4j2.appender.rolling_debug.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.rolling_debug.policies.size.size = 16MB

## Audit log appender
log4j2.appender.audit.type = RollingRandomAccessFile
log4j2.appender.audit.name = AuditRollingFile
log4j2.appender.audit.fileName = ${karaf.data}/security/audit.log
log4j2.appender.audit.filePattern = ${karaf.data}/security/audit.log.%i
log4j2.appender.audit.append = true
log4j2.appender.audit.layout.type = PatternLayout
log4j2.appender.audit.layout.pattern = ${log4j2.pattern}
log4j2.appender.audit.policies.type = Policies
log4j2.appender.audit.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.audit.policies.size.size = 8MB

#########################
# Loggers configuration #
#########################

## Brooklyn
log4j2.logger.brooklyn.name = org.apache.brooklyn
log4j2.logger.brooklyn.level = DEBUG
log4j2.logger.brooklyn.additivity = true

## JClouds
log4j2.logger.jclouds.name = org.jclouds
log4j2.logger.jclouds.level = DEBUG
log4j2.logger.jclouds.additivity = true

log4j2.logger.jclouds_compute.name = jclouds.compute
log4j2.logger.jclouds_compute.level = DEBUG
log4j2.logger.jclouds_compute.additivity = true

log4j2.logger.jclouds_headers.name = jclouds.headers
log4j2.logger.jclouds_headers.level = DEBUG
log4j2.logger.jclouds_headers.additivity = true

log4j2.logger.jclouds_wire.name = jclouds.wire
log4j2.logger.jclouds_wire.level = OFF

## Karaf
log4j2.logger.karaf.name = org.apache.karaf
log4j2.logger.karaf.level = INFO

## Security audit logger
log4j2.logger.audit.name = org.apache.karaf.jaas.modules.audit
log4j2.logger.audit.level = INFO
log4j2.logger.audit.additivity = false
log4j2.logger.audit.appenderRef.AuditRollingFile.ref = AuditRollingFile

## Misc loggers
log4j2.logger.swagger.name = com.wordnik.swagger
log4j2.logger.swagger.level = OFF

log4j2.logger.mongodb.name = org.mongodb.driver
log4j2.logger.mongodb.level = WARN

log4j2.logger.cxf.name = org.apache.cxf
log4j2.logger.cxf.level =  WARN

log4j2.logger.jetty.name = org.eclipse.jetty
log4j2.logger.jetty.level =  WARN

log4j2.logger.spifly.name = org.apache.aries.spifly
log4j2.logger.spifly.level = WARN

log4j2.logger.schmizz.name = net.schmizz
log4j2.logger.schmizz.level = WARN
