You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Pankaj (Jira)" <ji...@apache.org> on 2020/06/10 13:33:00 UTC

[jira] [Commented] (LOG4J2-2865) Default route in Routing Appender not working

    [ https://issues.apache.org/jira/browse/LOG4J2-2865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17130680#comment-17130680 ] 

Pankaj commented on LOG4J2-2865:
--------------------------------

As it can be seen in screenshot, i am getting logs in a static named file '${ctx:camel.contextId}', which should have been coming in default-file.log file.

below is the routing appender:-

# Sift - MDC routing
log4j2.appender.routing.name = sift
log4j2.appender.routing.type = Routing
log4j2.appender.routing.routes.type = Routes
log4j2.appender.routing.routes.pattern = $${ctx:camel.contextId\\}
log4j2.appender.routing.routes.sift.type = Route
# dynamic declaration of the appender - to resolve file name using the map
log4j2.appender.routing.routes.sift.appender.type = RollingRandomAccessFile
log4j2.appender.routing.routes.sift.appender.name = Bundle-${ctx:camel.contextId\}
log4j2.appender.routing.routes.sift.appender.fileName = ${karaf.log}/Bundle-${ctx:camel.contextId\\}.log
log4j2.appender.routing.routes.sift.appender.filePattern = ${karaf.log}/Bundle-${ctx:camel.contextId\\}.log.%i
log4j2.appender.routing.routes.sift.appender.layout.type = PatternLayout
log4j2.appender.routing.routes.sift.appender.layout.pattern = ${log4j2.pattern}
log4j2.appender.routing.routes.sift.appender.policies.type = Policies
log4j2.appender.routing.routes.sift.appender.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.routing.routes.sift.appender.policies.size.size = 8MB
log4j2.appender.routing.routes.karaf.type = Route
log4j2.appender.routing.routes.karaf.key = ${ctx:camel.contextId}
# static reference to appender
log4j2.appender.routing.routes.karaf.ref = file

 

# normal appender that may be referenced from logger or from the route above
log4j2.appender.file.type = RollingRandomAccessFile
log4j2.appender.file.name = file
log4j2.appender.file.fileName = ${karaf.log}/default-file.log
log4j2.appender.file.filePattern = ${karaf.log}/default-file.log.%i
log4j2.appender.file.layout.type = PatternLayout
log4j2.appender.file.layout.pattern = ${log4j2.pattern}
log4j2.appender.file.policies.type = Policies
log4j2.appender.file.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.file.policies.size.size = 8MB

> Default route in Routing Appender not working
> ---------------------------------------------
>
>                 Key: LOG4J2-2865
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2865
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>         Environment: apache karaf 2.4.8
>            Reporter: Pankaj
>            Priority: Major
>         Attachments: Screenshot from 2020-06-10 18-54-56.png, org.ops4j.pax.logging.cfg
>
>
> Default route in Routing Appender meant to log all the logs in a default.log file when there is no key in MDC not working in apache karaf 2.4.8's org.ops4j.pax.logging.cfg logging config file.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)