karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rocco Lagrotteria (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (KARAF-5444) Unable to use Log4j2 ContextMapLookup with pax-logging
Date Thu, 26 Oct 2017 09:31:00 GMT

     [ https://issues.apache.org/jira/browse/KARAF-5444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rocco Lagrotteria updated KARAF-5444:
-------------------------------------
    Description: 
ContextMapLookup has been worked fine using escaped {noformat}${ctx:xxx}{noformat} placeholder
in log4j config,  but in karaf 4.1.2 it doesn't work anymore.

To replicate the issue, add this properties in {{etc/org.ops4j.pax.logging.cfg}} trying to
setup a single log file per bundle:
{noformat}

log4j2.appender.bundle.type = Routing
log4j2.appender.bundle.name = RoutingByBundle
log4j2.appender.bundle.routes.type = Routes
log4j2.appender.bundle.routes.pattern = \$\$\\\{ctx:bundle.name\}
log4j2.appender.bundle.routes.bundlename.type = Route
log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-\$\\\{ctx:bundle.name\}
log4j2.appender.bundle.routes.bundlename.appender.fileName = ${karaf.data}/log/karaf.\$\\\{ctx:bundle.name\}-\$\\\{ctx:bundle.id\}.log
log4j2.appender.bundle.routes.bundlename.appender.append = true
log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n

log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
{noformat}

Configuration works, but restarting karaf empty values replace placeholders in config settings,
breaking configuration:
{noformat}
log4j2.appender.bundle.type = Routing
log4j2.appender.bundle.name = RoutingByBundle
log4j2.appender.bundle.routes.type = Routes
log4j2.appender.bundle.routes.pattern = $
log4j2.appender.bundle.routes.bundlename.type = Route
log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-
log4j2.appender.bundle.routes.bundlename.appender.fileName = /home/rolag/Desktop/apache-karaf-4.1.2/data/log/karaf.-.log
log4j2.appender.bundle.routes.bundlename.appender.append = true
log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n

log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
{noformat}


  was:
ContextMapLookup has been worked fine using escaped {noformat}${ctx:xxx}{noformat} placeholder
in log4j config,  but in karaf 4.1.2 it does't work anymore.

To replicate the issue, add this properties in {{etc/org.ops4j.pax.logging.cfg}} trying to
setup a single log file per bundle:
{noformat}

log4j2.appender.bundle.type = Routing
log4j2.appender.bundle.name = RoutingByBundle
log4j2.appender.bundle.routes.type = Routes
log4j2.appender.bundle.routes.pattern = \$\$\\\{ctx:bundle.name\}
log4j2.appender.bundle.routes.bundlename.type = Route
log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-\$\\\{ctx:bundle.name\}
log4j2.appender.bundle.routes.bundlename.appender.fileName = ${karaf.data}/log/karaf.\$\\\{ctx:bundle.name\}-\$\\\{ctx:bundle.id\}.log
log4j2.appender.bundle.routes.bundlename.appender.append = true
log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n

log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
{noformat}

Configuration works, but restarting karaf empty values replace placeholders in config settings,
breaking configuration:
{noformat}
log4j2.appender.bundle.type = Routing
log4j2.appender.bundle.name = RoutingByBundle
log4j2.appender.bundle.routes.type = Routes
log4j2.appender.bundle.routes.pattern = $
log4j2.appender.bundle.routes.bundlename.type = Route
log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-
log4j2.appender.bundle.routes.bundlename.appender.fileName = /home/rolag/Desktop/apache-karaf-4.1.2/data/log/karaf.-.log
log4j2.appender.bundle.routes.bundlename.appender.append = true
log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n

log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
{noformat}



> Unable to use Log4j2 ContextMapLookup with pax-logging
> ------------------------------------------------------
>
>                 Key: KARAF-5444
>                 URL: https://issues.apache.org/jira/browse/KARAF-5444
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-logging
>    Affects Versions: 4.1.2
>         Environment: JVM:
> {noformat}
> java version "1.8.0_144"
> Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
> {noformat}
> OS:
> {noformat}
> os.arch=amd64
> os.name=Linux
> os.version=4.10.3-041003-generic
> {noformat}
>            Reporter: Rocco Lagrotteria
>
> ContextMapLookup has been worked fine using escaped {noformat}${ctx:xxx}{noformat} placeholder
in log4j config,  but in karaf 4.1.2 it doesn't work anymore.
> To replicate the issue, add this properties in {{etc/org.ops4j.pax.logging.cfg}} trying
to setup a single log file per bundle:
> {noformat}
> log4j2.appender.bundle.type = Routing
> log4j2.appender.bundle.name = RoutingByBundle
> log4j2.appender.bundle.routes.type = Routes
> log4j2.appender.bundle.routes.pattern = \$\$\\\{ctx:bundle.name\}
> log4j2.appender.bundle.routes.bundlename.type = Route
> log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
> log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-\$\\\{ctx:bundle.name\}
> log4j2.appender.bundle.routes.bundlename.appender.fileName = ${karaf.data}/log/karaf.\$\\\{ctx:bundle.name\}-\$\\\{ctx:bundle.id\}.log
> log4j2.appender.bundle.routes.bundlename.appender.append = true
> log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
> log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n
> log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
> {noformat}
> Configuration works, but restarting karaf empty values replace placeholders in config
settings, breaking configuration:
> {noformat}
> log4j2.appender.bundle.type = Routing
> log4j2.appender.bundle.name = RoutingByBundle
> log4j2.appender.bundle.routes.type = Routes
> log4j2.appender.bundle.routes.pattern = $
> log4j2.appender.bundle.routes.bundlename.type = Route
> log4j2.appender.bundle.routes.bundlename.appender.type = RandomAccessFile
> log4j2.appender.bundle.routes.bundlename.appender.name = RandomAccessFile-
> log4j2.appender.bundle.routes.bundlename.appender.fileName = /home/rolag/Desktop/apache-karaf-4.1.2/data/log/karaf.-.log
> log4j2.appender.bundle.routes.bundlename.appender.append = true
> log4j2.appender.bundle.routes.bundlename.appender.layout.type = PatternLayout
> log4j2.appender.bundle.routes.bundlename.appender.layout.pattern = [%d{ISO8601}][%-5.5p][%t]
- %m%n
> log4j2.rootLogger.appenderRef.RoutingByBundle.ref = RoutingByBundle
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message