# Copyright 2015 The Apache Software Foundation
# 
# 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.

# Define some default values that can be overridden by system properties
property.zookeeper.console.threshold = TRACE

property.zookeeper.log.dir = .
property.zookeeper.log.file = zookeeper.log
property.zookeeper.log.threshold = INFO
property.zookeeper.log.maxfilesize = 256MB
property.zookeeper.log.maxbackupindex = 20

property.zookeeper.tracelog.dir = ${sys:zookeeper.log.dir}
property.zookeeper.tracelog.file = zookeeper_trace.log

status = ERROR
name = PropertiesConfig

rootLogger.level = INFO
#rootLogger.appenderRef.CONSOLE.ref = CONSOLE
rootLogger.appenderRef.ROLLINGFILE.ref = ROLLINGFILE

appenders = ROLLINGFILE

#
# Add CONSOLE to rootlogger above if you want to use this 
#
appender.CONSOLE.type = Console
appender.CONSOLE.name = CONSOLE
appender.CONSOLE.filter.threshold.type = ThresholdFilter
appender.CONSOLE.filter.threshold.level = ${sys:zookeeper.console.threshold}
appender.CONSOLE.layout.type = PatternLayout
appender.CONSOLE.layout.pattern = %d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n

#
# Add ROLLINGFILE to rootLogger to get log file output
#
appender.ROLLINGFILE.type = RollingFile
appender.ROLLINGFILE.name = ROLLINGFILE
appender.ROLLINGFILE.filter.threshold.type = ThresholdFilter
appender.ROLLINGFILE.filter.threshold.level = ${sys:zookeeper.log.threshold}
appender.ROLLINGFILE.layout.type = PatternLayout
appender.ROLLINGFILE.layout.pattern = %d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
appender.ROLLINGFILE.fileName = ${sys:zookeeper.log.dir}/${sys:zookeeper.log.file}
appender.ROLLINGFILE.filePattern = ${sys:zookeeper.log.dir}/${sys:zookeeper.log.file}.%i
appender.ROLLINGFILE.policies.type = Policies
appender.ROLLINGFILE.policies.size.type = SizeBasedTriggeringPolicy
appender.ROLLINGFILE.policies.size.size = ${sys:zookeeper.log.maxfilesize}
appender.ROLLINGFILE.strategy.type = DefaultRolloverStrategy
appender.ROLLINGFILE.strategy.max = ${sys:zookeeper.log.maxbackupindex}
#
# Add TRACEFILE to rootLogger to get log file output
#    Log TRACE level and above messages to a log file
#
appender.TRACEFILE.type = File
appender.TRACEFILE.name = TRACEFILE
appender.TRACEFILE.filter.threshold.type = ThresholdFilter
appender.TRACEFILE.filter.threshold.level = TRACE
appender.TRACEFILE.fileName = ${sys:zookeeper.tracelog.dir}/${sys:zookeeper.tracelog.file}
appender.TRACEFILE.layout.type = PatternLayout
### Notice we are including log4j's NDC here (%x)
appender.TRACEFILE.layout.pattern = %d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n

#
# zk audit logging
#
property.zookeeper.auditlog.file = zookeeper_audit.log
property.zookeeper.auditlog.threshold = INFO

logger.audit.name = org.apache.zookeeper.audit.Log4jAuditLogger
logger.audit.level = INFO
logger.audit.appenderRef.RFAAUDIT.ref = RFAAUDIT
logger.audit.additivity = false

appender.RFAAUDIT.type = RollingFile
appender.RFAAUDIT.name = RFAAUDIT
appender.RFAAUDIT.filter.threshold.type = ThresholdFilter
appender.RFAAUDIT.filter.threshold.level = ${sys:zookeeper.auditlog.threshold}
appender.RFAAUDIT.layout.type = PatternLayout
appender.RFAAUDIT.layout.pattern = %d{ISO8601} %p %c{2}: %m%n
appender.RFAAUDIT.fileName = ${sys:zookeeper.log.dir}/${sys:zookeeper.auditlog.file}
appender.RFAAUDIT.filePattern = ${sys:zookeeper.log.dir}/${sys:zookeeper.auditlog.file}.%i
appender.RFAAUDIT.policies.type = Policies
appender.RFAAUDIT.policies.size.type = SizeBasedTriggeringPolicy
appender.RFAAUDIT.policies.size.size = 10MB
appender.RFAAUDIT.strategy.type = DefaultRolloverStrategy
appender.RFAAUDIT.strategy.max = 10
