karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Grzybek <gr.grzy...@gmail.com>
Subject Re: [K4.1] Pax Logging: Sift appender
Date Thu, 28 Mar 2019 10:42:19 GMT
Hello

Hmm, maybe JDK11 is an issue? Does it work with JDK8?

ALSO it could be because appenders may have to be declared before they
added to loggers? :) Just a blind guess.

regards
Grzegorz Grzybek


czw., 28 mar 2019 o 11:38 Jayamani <jayamanijai92@gmail.com> napisaƂ(a):

> Hi Grzegorz,
>  As suggested i have added appender and logger template in pax logging
> config file, below is the complete config file:
>
> ################################################################################
> #
> #    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.
> #
>
> ################################################################################
>
> # Colors for log level rendering
> color.fatal = bright red
> color.error = bright red
> color.warn = bright yellow
> color.info = bright green
> color.debug = cyan
> color.trace = cyan
>
> # Common pattern layout for appenders
> log4j2.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} -
> %X{bundle.name} - %X{bundle.version} | %m%n
> log4j2.out.pattern = \u001b[90m%d{HH:mm:ss\.SSS}\u001b[0m
> %highlight{%-5level}{FATAL=${color.fatal}, ERROR=${color.error},
> WARN=${color.warn}, INFO=${color.info}, DEBUG=${color.debug},
> TRACE=${color.trace}} \u001b[90m[%t]\u001b[0m %msg%n%throwable
>
>
> # Root logger
> log4j2.rootLogger.level = INFO, demo
> # uncomment to use asynchronous loggers, which require
> mvn:com.lmax/disruptor/3.3.2 library
> #log4j2.rootLogger.type = asyncRoot
> #log4j2.rootLogger.includeLocation = false
> log4j2.rootLogger.appenderRef.RollingFile.ref = RollingFile
> log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
> 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}
>
> # Loggers configuration
>
> # SSHD logger
> log4j2.logger.sshd.name = org.apache.sshd
> log4j2.logger.sshd.level = INFO
>
> # Spifly logger
> log4j2.logger.spifly.name = org.apache.aries.spifly
> log4j2.logger.spifly.level = WARN
>
> # Security audit logger
> log4j2.logger.audit.name = audit
> log4j2.logger.audit.level = TRACE
> log4j2.logger.audit.additivity = false
> log4j2.logger.audit.appenderRef.AuditRollingFile.ref = AuditRollingFile
>
>
> log4j2.logger.demo.name = org.apache.camel
> log4j2.logger.demo.level = DEBUG
> log4j2.logger.demo.appenderRef.SiftAppender.ref = SiftAppender
>
> # Appenders configuration
>
> # Console appender not used by default (see log4j2.rootLogger.appenderRefs)
> log4j2.appender.console.type = Console
> log4j2.appender.console.name = Console
> log4j2.appender.console.layout.type = PatternLayout
> log4j2.appender.console.layout.pattern = ${log4j2.out.pattern}
>
> # Rolling file appender
> log4j2.appender.rolling.type = RollingRandomAccessFile
> log4j2.appender.rolling.name = RollingFile
> log4j2.appender.rolling.fileName = ${karaf.log}/karaf.log
> log4j2.appender.rolling.filePattern = ${karaf.log}/karaf.log.%i
> # uncomment to not force a disk flush
> #log4j2.appender.rolling.immediateFlush = false
> log4j2.appender.rolling.append = true
> log4j2.appender.rolling.layout.type = PatternLayout
> log4j2.appender.rolling.layout.pattern = ${log4j2.out.pattern}
> log4j2.appender.rolling.policies.type = Policies
> log4j2.appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
> log4j2.appender.rolling.policies.size.size = 16MB
>
> # Audit file appender
> log4j2.appender.audit.type = RollingRandomAccessFile
> log4j2.appender.audit.name = AuditRollingFile
> log4j2.appender.audit.fileName = ${karaf.log}/security.log
> log4j2.appender.audit.filePattern = ${karaf.log}/security-%i.log
> log4j2.appender.audit.append = true
> log4j2.appender.audit.layout.type = PatternLayout
> log4j2.appender.audit.layout.pattern = %m%n
> log4j2.appender.audit.policies.type = Policies
> log4j2.appender.audit.policies.size.type = SizeBasedTriggeringPolicy
> log4j2.appender.audit.policies.size.size = 8MB
>
> # OSGi appender
> log4j2.appender.osgi.type = PaxOsgi
> log4j2.appender.osgi.name = PaxOsgi
> log4j2.appender.osgi.filter = *
>
> # help with identification of maven-related problems with pax-url-aether
> #log4j2.logger.aether.name = shaded.org.eclipse.aether
> #log4j2.logger.aether.level = TRACE
> #log4j2.logger.http-headers.name = shaded.org.apache.http.headers
> #log4j2.logger.http-headers.level = DEBUG
> #log4j2.logger.maven.name = org.ops4j.pax.url.mvn
> #log4j2.logger.maven.level = TRACE
>
> # Sift appender
> log4j2.appender.mdc.type = Routing
> log4j2.appender.mdc.name = SiftAppender
> log4j2.appender.mdc.routes.type = Routes
> # see: http://logging.apache.org/log4j/2.x/manual/appenders.html#Routes
> log4j2.appender.mdc.routes.pattern = $\\{ctx:bundle.name}
> log4j2.appender.mdc.routes.sift.type = Route
> log4j2.appender.mdc.routes.sift.appender.type = RollingRandomAccessFile
> log4j2.appender.mdc.routes.sift.appender.name = RollingFile
> log4j2.appender.mdc.routes.sift.appender.fileName =
> ${karaf.data}/log/sift-$\\{ctx:bundle.name}.log
> log4j2.appender.mdc.routes.sift.appender.filePattern =
> ${karaf.data}/log/sift-$\\{ctx:bundle.name}-%i.log.gz
> log4j2.appender.mdc.routes.sift.appender.append = true
> log4j2.appender.mdc.routes.sift.appender.layout.type = PatternLayout
> log4j2.appender.mdc.routes.sift.appender.layout.pattern =
> ${log4j2.pattern}
> log4j2.appender.mdc.routes.sift.appender.policies.type = Policies
> log4j2.appender.mdc.routes.sift.appender.policies.size.type =
> SizeBasedTriggeringPolicy
> log4j2.appender.mdc.routes.sift.appender.policies.size.size = 16MB
> log4j2.appender.mdc.routes.sift.appender.strategy.type =
> DefaultRolloverStrategy
> log4j2.appender.mdc.routes.sift.appender.strategy.max = 20
>
>
> i am getting below exception,
>
> 2019-03-28 15:16:57,666 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin type for
> Routing
> 2019-03-28 15:16:57,719 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for
> SizeBasedTriggeringPolicy
> 2019-03-28 15:16:57,719 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for Policies
> 2019-03-28 15:16:57,720 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for
> DefaultRolloverStrategy
> 2019-03-28 15:16:57,720 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for
> PatternLayout
> 2019-03-28 15:16:57,720 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for
> RollingRandomAccessFile
> 2019-03-28 15:16:57,720 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for Route
> 2019-03-28 15:16:57,720 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for Routes
> 2019-03-28 15:16:57,721 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate plugin for Routing
> 2019-03-28 15:16:57,721 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to invoke factory method in class
> class org.apache.logging.log4j.core.config.AppendersPlugin for element
> Appenders. java.lang.NullPointerException
>         at
>
> org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
>         at
>
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:248)
>         at
>
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)
>         at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
>         at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
>         at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
>         at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
>         at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
>         at
>
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
>         at
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
>         at
>
> org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
>         at
>
> org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
>         at
>
> org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:426)
>         at
>
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
>         at
>
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
>         at
>
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
>         at
>
> org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1113)
>         at
>
> org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1069)
>         at
> org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138)
>         at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105)
>         at java.lang.Thread.run(Thread.java:748)
>
> 2019-03-28 15:16:57,722 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate appender "PaxOsgi" for
> logger config "root"
> 2019-03-28 15:16:57,723 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate appender "RollingFile"
> for logger config "root"
> 2019-03-28 15:16:57,723 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate appender "Console" for
> logger config "root"
> 2019-03-28 15:16:57,723 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate appender "SiftAppender"
> for logger config "org.apache.camel"
> 2019-03-28 15:16:57,723 CM Configuration Updater (ManagedService Update:
> pid=[org.ops4j.pax.logging]) ERROR Unable to locate appender
> "AuditRollingFile" for logger config "audit"
>
>
> I am using karaf-4.2.3 with openjdk 11.,is there anyting i am
> missing?please
> guide me.
>
> Thanks in advance.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message