#
# Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. 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.
#

##
# This is the log4j2 configuration file used by WSO2 MI Monitoring Dashboard
# =====================================================
#
# IMPORTANT : Please do not remove or change the names of any of the Appenders defined here.
##
# the root category is ERROR (applies for all 3rd party JARs etc) and will be logged to the
# LOG_APPENDER and the CONSOLE_APPENDER

# list of all appenders
#add entry "syslog" to use the syslog appender
appenders = CARBON_CONSOLE, CARBON_LOGFILE, ERROR_LOGFILE

# CARBON_CONSOLE is set to be a ConsoleAppender using a PatternLayout.
appender.CARBON_CONSOLE.type = Console
appender.CARBON_CONSOLE.name = CARBON_CONSOLE
appender.CARBON_CONSOLE.layout.type = PatternLayout
appender.CARBON_CONSOLE.layout.pattern = [%d] %5p {%c{1}} - %m%ex%n
appender.CARBON_CONSOLE.filter.threshold.type = ThresholdFilter
appender.CARBON_CONSOLE.filter.threshold.level = DEBUG

# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
appender.CARBON_LOGFILE.type = RollingFile
appender.CARBON_LOGFILE.name = CARBON_LOGFILE
appender.CARBON_LOGFILE.fileName = ${sys:wso2.runtime.path}/logs/wso2carbon.log
appender.CARBON_LOGFILE.filePattern = ${sys:wso2.runtime.path}/logs/wso2carbon-%d{MM-dd-yyyy}.log
appender.CARBON_LOGFILE.layout.type = PatternLayout
appender.CARBON_LOGFILE.layout.pattern = [%d] %5p {%c} - %m%ex%n
appender.CARBON_LOGFILE.policies.type = Policies
appender.CARBON_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy
appender.CARBON_LOGFILE.policies.time.interval = 1
appender.CARBON_LOGFILE.policies.time.modulate = true
appender.CARBON_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy
appender.CARBON_LOGFILE.policies.size.size=10MB
appender.CARBON_LOGFILE.strategy.type = DefaultRolloverStrategy
appender.CARBON_LOGFILE.strategy.max = 20
appender.CARBON_LOGFILE.filter.threshold.type = ThresholdFilter
appender.CARBON_LOGFILE.filter.threshold.level = DEBUG

# Appender config to ERROR_LOGFILE
appender.ERROR_LOGFILE.type = RollingFile
appender.ERROR_LOGFILE.name = ERROR_LOGFILE
appender.ERROR_LOGFILE.fileName = ${sys:wso2.runtime.path}/logs/wso2error.log
appender.ERROR_LOGFILE.filePattern = ${sys:wso2.runtime.path}/logs/wso2error-%d{MM-dd-yyyy}.log
appender.ERROR_LOGFILE.layout.type = PatternLayout
appender.ERROR_LOGFILE.layout.pattern = [%d] %5p {%c} - %m%ex%n
appender.ERROR_LOGFILE.policies.type = Policies
appender.ERROR_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy
appender.ERROR_LOGFILE.policies.time.interval = 1
appender.ERROR_LOGFILE.policies.time.modulate = true
appender.ERROR_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy
appender.ERROR_LOGFILE.policies.size.size=10MB
appender.ERROR_LOGFILE.strategy.type = DefaultRolloverStrategy
appender.ERROR_LOGFILE.strategy.max = 20
appender.ERROR_LOGFILE.filter.threshold.type = ThresholdFilter
appender.ERROR_LOGFILE.filter.threshold.level = WARN

# 3rd party loggers
logger.org-eclipse-jetty.name = org.eclipse.jetty
logger.org-eclipse-jetty.level = ERROR

logger.org-zaxxer-hikari.name = com.zaxxer.hikari
logger.org-zaxxer-hikari.level = ERROR

logger.stax-dialect-detector.name = org.apache.axiom.util.stax.dialect.StAXDialectDetector
logger.stax-dialect-detector.level = ERROR

# root loggers
rootLogger.level = INFO
rootLogger.appenderRef.CARBON_CONSOLE.ref = CARBON_CONSOLE
rootLogger.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE
rootLogger.appenderRef.ERROR_LOGFILE.ref = ERROR_LOGFILE
